r1899: this is 3.0.6 -- will release tomorrow
authorGerald Carter <jerry@samba.org>
Thu, 19 Aug 2004 03:11:17 +0000 (03:11 +0000)
committerGerald Carter <jerry@samba.org>
Thu, 19 Aug 2004 03:11:17 +0000 (03:11 +0000)
13 files changed:
WHATSNEW.txt
source/Makefile.in
source/include/messages.h
source/lib/messages.c
source/passdb/passdb.c
source/passdb/pdb_smbpasswd.c
source/printing/nt_printing.c
source/printing/printing.c
source/rpc_server/srv_spoolss_nt.c
source/smbd/connection.c
source/smbd/reply.c
source/smbd/server.c
source/smbd/vfs.c

index 24622d1ce948829a82a8539bde03e3c7d58fcec5..45f47c12c309d2415249d46e6ab88e23995b9e9e 100644 (file)
@@ -107,19 +107,32 @@ o   Jeremy Allison <jra@samba.org>
     * BUG 1606: Force smbd to disable sendfile with DOS clients 
       and ensure that the chained header is filled in for ...&X 
       commands.
+    * BUG 1602: Fix access to shares when all symlink support 
+      has been disabled.
+
+
+o   Gerald (Jerry) Carter <jerry@samba.org>
+    * Tighten the cache consistency with the ntprinters.tdb entry 
+      an the in memory cache associated with open printer handles.
+    * Make sure that register_messages_flags() doesn't overwrite 
+      the originally registers flags.
 
 
 o   Steve French <sfrench@us.ibm.com>
-    o prevent infinite recusion in reopen_logs() when expanding 
+    * prevent infinite recusion in reopen_logs() when expanding 
       the smb.conf variable %I.
       
+o   Luke Howard <lukeh@padl.com>
+    * Correctly use uid_to_sid() and gid_to_sid() in 
+      pdb_set_sam_sids().
+
 
 o   Volker Lendecke <vl@samba.org>
-    o Improved NT->AFS ACL mapping VFS module.
+    * Improved NT->AFS ACL mapping VFS module.
 
 
 o   Lars Mueller <lmuelle@suse.de>
-    o Fix compiler warnings in the kerberos client code.
+    * Fix compiler warnings in the kerberos client code.
     
 
 o   James Peach <jpeach@sgi.com>
@@ -129,6 +142,10 @@ o   James Peach <jpeach@sgi.com>
       in a directory.
 
 
+o   Jelmer Vernooij <jelmer@samba.org>
+    * BUG 1474: Fix build of --with-expsma stuff on Solaris.
+
+
 Changes since 3.0.5
 -------------------
 
index 58c8a7895d62f6d0b1b59676ae792915f89490ba..0fa46f6f9e0c6c1ad4ecbe20a2aad8236a1edc47 100644 (file)
@@ -34,6 +34,9 @@ PASSDB_LIBS=@PASSDB_LIBS@
 IDMAP_LIBS=@IDMAP_LIBS@
 KRB5LIBS=@KRB5_LIBS@
 LDAP_LIBS=@LDAP_LIBS@
+XML_LIBS=@XML_LIBS@
+MYSQL_LIBS=@MYSQL_LIBS@
+PGSQL_LIBS=@PGSQL_LIBS@
 
 LINK=$(CC) $(FLAGS) $(LDFLAGS)
 
@@ -533,7 +536,7 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_ads_cldap.o utils/net_help.o \
           utils/net_rap.o utils/net_rpc.o utils/net_rpc_samsync.o \
           utils/net_rpc_join.o utils/net_time.o utils/net_lookup.o \
           utils/net_cache.o utils/net_groupmap.o utils/net_idmap.o \
-          utils/net_status.o
+          utils/net_status.o 
 
 NET_OBJ = $(NET_OBJ1) $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
          $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
@@ -835,7 +838,8 @@ bin/rpcclient@EXEEXT@: $(RPCCLIENT_OBJ) @BUILD_POPT@ bin/.dummy
        @echo Linking $@
        @$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(PASSDB_LIBS) $(RPCCLIENT_OBJ) \
                $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @POPTLIBS@ \
-               $(KRB5LIBS) $(LDAP_LIBS)
+               $(KRB5LIBS) $(LDAP_LIBS) \
+               $(XML_LIBS) $(MYSQL_LIBS) $(PGSQL_LIBS)
 
 bin/smbclient@EXEEXT@: $(CLIENT_OBJ) @BUILD_POPT@ bin/.dummy
        @echo Linking $@
@@ -1115,12 +1119,12 @@ bin/sam.@SHLIBEXT@: $(AUTH_SAM_OBJ:.o=.@PICSUFFIX@)
 
 bin/mysql.@SHLIBEXT@: $(MYSQL_OBJ:.o=.@PICSUFFIX@)
        @echo "Building plugin $@"
-       @$(SHLD) $(LDSHFLAGS) -o $@ $(MYSQL_OBJ:.o=.@PICSUFFIX@) @MYSQL_LIBS@ \
+       @$(SHLD) $(LDSHFLAGS) -o $@ $(MYSQL_OBJ:.o=.@PICSUFFIX@) $(MYSQL_LIBS) \
                @SONAMEFLAG@`basename $@`
 
 bin/pgsql.@SHLIBEXT@: $(PGSQL_OBJ:.o=.@PICSUFFIX@)
        @echo "Building plugin $@"
-       @$(SHLD) $(LDSHFLAGS) -o $@ $(PGSQL_OBJ:.o=.@PICSUFFIX@) @PGSQL_LIBS@ \
+       @$(SHLD) $(LDSHFLAGS) -o $@ $(PGSQL_OBJ:.o=.@PICSUFFIX@) $(PGSQL_LIBS) \
       @SONAMEFLAG@`basename $@`
 
 bin/ldapsam.@SHLIBEXT@: passdb/pdb_ldap.@PICSUFFIX@
@@ -1160,7 +1164,7 @@ bin/macosxfs.@SHLIBEXT@: $(CHARSET_MACOSXFS_OBJ:.o=.@PICSUFFIX@)
 
 bin/xml.@SHLIBEXT@: $(XML_OBJ:.o=.@PICSUFFIX@)
        @echo "Building plugin $@"
-       @$(SHLD) $(LDSHFLAGS) -o $@ $(XML_OBJ:.o=.@PICSUFFIX@) @XML_LIBS@ \
+       @$(SHLD) $(LDSHFLAGS) -o $@ $(XML_OBJ:.o=.@PICSUFFIX@) $(XML_LIBS) \
                @SONAMEFLAG@`basename $@`
 
 bin/audit.@SHLIBEXT@: $(VFS_AUDIT_OBJ:.o=.@PICSUFFIX@)
index 78f19fa0bdbde4679a966ae9cdab0fc33b9de29b..a87659f49849db84b99306d729f07d7e7a44181b 100644 (file)
 
 /* printing messages */
 /* #define MSG_PRINTER_NOTIFY  2001*/ /* Obsolete */
-#define MSG_PRINTER_DRVUPGRADE         2002
-#define MSG_PRINTER_NOTIFY2            2003
-#define MSG_PRINTERDATA_INIT_RESET     2004
-#define MSG_PRINTER_UPDATE             2005
+#define MSG_PRINTER_NOTIFY2            2002
+
+#define MSG_PRINTER_DRVUPGRADE         2101
+#define MSG_PRINTERDATA_INIT_RESET     2102
+#define MSG_PRINTER_UPDATE             2103
+#define MSG_PRINTER_MOD                        2104
 
 /* smbd messages */
 #define MSG_SMB_CONF_UPDATED 3001
@@ -67,6 +69,7 @@
 #define FLAG_MSG_GENERAL       0x0001
 #define FLAG_MSG_SMBD          0x0002
 #define FLAG_MSG_NMBD          0x0004
-#define FLAG_MSG_PRINTING      0x0008
+#define FLAG_MSG_PRINT_NOTIFY  0x0008
+#define FLAG_MSG_PRINT_GENERAL 0x0010
 
 #endif
index 8706ede70653cf6540ace0602f3ccda94988f29d..ded3ac95bb48414ece41aec6ad33032ddeae08b6 100644 (file)
@@ -576,8 +576,10 @@ BOOL message_send_all(TDB_CONTEXT *conn_tdb, int msg_type,
                msg_all.msg_flag = FLAG_MSG_GENERAL;
        else if (msg_type > 1000 && msg_type < 2000)
                msg_all.msg_flag = FLAG_MSG_NMBD;
-       else if (msg_type > 2000 && msg_type < 3000)
-               msg_all.msg_flag = FLAG_MSG_PRINTING;
+       else if (msg_type > 2000 && msg_type < 2100)
+               msg_all.msg_flag = FLAG_MSG_PRINT_NOTIFY;
+       else if (msg_type > 2100 && msg_type < 3000)
+               msg_all.msg_flag = FLAG_MSG_PRINT_GENERAL;
        else if (msg_type > 3000 && msg_type < 4000)
                msg_all.msg_flag = FLAG_MSG_SMBD;
        else
index 0905d8169203b0621f546a0a593d550487f3c071..14c8c67aa3cd8a0db53c94fbc13ba45e3145448f 100644 (file)
@@ -190,7 +190,9 @@ static NTSTATUS pdb_set_sam_sids(SAM_ACCOUNT *account_data, const struct passwd
        const char *guest_account = lp_guestaccount();
        GROUP_MAP map;
        BOOL ret;
-       
+       DOM_SID user_sid;
+       DOM_SID group_sid;
+
        if (!account_data || !pwd) {
                return NT_STATUS_INVALID_PARAMETER;
        }
@@ -198,7 +200,7 @@ static NTSTATUS pdb_set_sam_sids(SAM_ACCOUNT *account_data, const struct passwd
        /* this is a hack this thing should not be set
           this way --SSS */
        if (!(guest_account && *guest_account)) {
-               DEBUG(1, ("NULL guest account!?!?\n"));
+               DEBUG(1, ("pdb_set_sam_sids: NULL guest account!?!?\n"));
                return NT_STATUS_UNSUCCESSFUL;
        } else {
                /* Ensure this *must* be set right */
@@ -213,8 +215,13 @@ static NTSTATUS pdb_set_sam_sids(SAM_ACCOUNT *account_data, const struct passwd
                }
        }
 
-       if (!pdb_set_user_sid_from_rid(account_data, fallback_pdb_uid_to_user_rid(pwd->pw_uid), PDB_SET)) {
-               DEBUG(0,("Can't set User SID from RID!\n"));
+       if (NT_STATUS_IS_OK(uid_to_sid(&user_sid, pwd->pw_uid))) {
+               if (!pdb_set_user_sid(account_data, &user_sid, PDB_SET)) {
+                       DEBUG(0,("pdb_set_sam_sids: Can't set User SID from mapped UID\n"));
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+       } else if (!pdb_set_user_sid_from_rid(account_data, algorithmic_pdb_uid_to_user_rid(pwd->pw_uid), PDB_SET)) {
+               DEBUG(0,("pdb_set_sam_sids: Can't set User SID from RID!\n"));
                return NT_STATUS_INVALID_PARAMETER;
        }
        
@@ -225,13 +232,18 @@ static NTSTATUS pdb_set_sam_sids(SAM_ACCOUNT *account_data, const struct passwd
        
        if( ret ) {
                if (!pdb_set_group_sid(account_data, &map.sid, PDB_SET)){
-                       DEBUG(0,("Can't set Group SID!\n"));
+                       DEBUG(0,("pdb_set_sam_sids: Can't set Group SID!\n"));
                        return NT_STATUS_INVALID_PARAMETER;
                }
        } 
        else {
-               if (!pdb_set_group_sid_from_rid(account_data, pdb_gid_to_group_rid(pwd->pw_gid), PDB_SET)) {
-                       DEBUG(0,("Can't set Group SID\n"));
+               if (NT_STATUS_IS_OK(gid_to_sid(&group_sid, pwd->pw_gid))) {
+                       if (!pdb_set_group_sid(account_data, &group_sid, PDB_SET)) {
+                               DEBUG(0,("pdb_set_sam_sids: Can't set Group SID from mapped GID\n"));
+                               return NT_STATUS_INVALID_PARAMETER;
+                       }
+               } else if (!pdb_set_group_sid_from_rid(account_data, pdb_gid_to_group_rid(pwd->pw_gid), PDB_SET)) {
+                       DEBUG(0,("pdb_set_sam_sids: Can't set Group SID\n"));
                        return NT_STATUS_INVALID_PARAMETER;
                }
        }
@@ -370,7 +382,7 @@ NTSTATUS pdb_init_sam_new(SAM_ACCOUNT **new_sam_acct, const char *username,
        /* see if we need to generate a new rid using the 2.2 algorithm */
        if ( rid == 0 && lp_enable_rid_algorithm() ) {
                DEBUG(10,("pdb_init_sam_new: no RID specified.  Generating one via old algorithm\n"));
-               rid = fallback_pdb_uid_to_user_rid(pwd->pw_uid);
+               rid = algorithmic_pdb_uid_to_user_rid(pwd->pw_uid);
        }
        
        /* set the new SID */
@@ -660,7 +672,7 @@ int algorithmic_rid_base(void)
  Converts NT user RID to a UNIX uid.
  ********************************************************************/
 
-uid_t fallback_pdb_user_rid_to_uid(uint32 user_rid)
+uid_t algorithmic_pdb_user_rid_to_uid(uint32 user_rid)
 {
        int rid_offset = algorithmic_rid_base();
        return (uid_t)(((user_rid & (~USER_RID_TYPE)) - rid_offset)/RID_MULTIPLIER);
@@ -670,7 +682,7 @@ uid_t fallback_pdb_user_rid_to_uid(uint32 user_rid)
  converts UNIX uid to an NT User RID.
  ********************************************************************/
 
-uint32 fallback_pdb_uid_to_user_rid(uid_t uid)
+uint32 algorithmic_pdb_uid_to_user_rid(uid_t uid)
 {
        int rid_offset = algorithmic_rid_base();
        return (((((uint32)uid)*RID_MULTIPLIER) + rid_offset) | USER_RID_TYPE);
@@ -716,26 +728,19 @@ static BOOL pdb_rid_is_well_known(uint32 rid)
  Decides if a RID is a user or group RID.
  ********************************************************************/
 
-BOOL fallback_pdb_rid_is_user(uint32 rid)
+BOOL algorithmic_pdb_rid_is_user(uint32 rid)
 {
-  /* lkcl i understand that NT attaches an enumeration to a RID
-   * such that it can be identified as either a user, group etc
-   * type.  there are 5 such categories, and they are documented.
-   */
-       /* However, they are not in the RID, just somthing you can query
-          seperatly.  Sorry luke :-) */
-
-   if(pdb_rid_is_well_known(rid)) {
-      /*
-       * The only well known user RIDs are DOMAIN_USER_RID_ADMIN
-       * and DOMAIN_USER_RID_GUEST.
-       */
-     if(rid == DOMAIN_USER_RID_ADMIN || rid == DOMAIN_USER_RID_GUEST)
-       return True;
-   } else if((rid & RID_TYPE_MASK) == USER_RID_TYPE) {
-     return True;
-   }
-   return False;
+       if(pdb_rid_is_well_known(rid)) {
+               /*
+                * The only well known user RIDs are DOMAIN_USER_RID_ADMIN
+                * and DOMAIN_USER_RID_GUEST.
+                */
+               if(rid == DOMAIN_USER_RID_ADMIN || rid == DOMAIN_USER_RID_GUEST)
+                       return True;
+       } else if((rid & RID_TYPE_MASK) == USER_RID_TYPE) {
+               return True;
+       }
+       return False;
 }
 
 /*******************************************************************
@@ -806,13 +811,13 @@ BOOL local_lookup_sid(const DOM_SID *sid, char *name, enum SID_NAME_USE *psid_na
                return True;
        }
 
-       if (fallback_pdb_rid_is_user(rid)) {
+       if (algorithmic_pdb_rid_is_user(rid)) {
                uid_t uid;
                struct passwd *pw = NULL;
 
                DEBUG(5, ("assuming RID %u is a user\n", (unsigned)rid));
 
-                       uid = fallback_pdb_user_rid_to_uid(rid);
+                       uid = algorithmic_pdb_user_rid_to_uid(rid);
                pw = sys_getpwuid( uid );
                
                DEBUG(5,("local_lookup_sid: looking up uid %u %s\n", (unsigned int)uid,
@@ -851,7 +856,7 @@ BOOL local_lookup_sid(const DOM_SID *sid, char *name, enum SID_NAME_USE *psid_na
                DEBUG(5,("local_lookup_sid: found group %s for rid %u\n", name,
                         (unsigned int)rid ));
                
-               /* assume fallback groups aer domain global groups */
+               /* assume algorithmic groups are domain global groups */
                
                *psid_name_use = SID_NAME_DOM_GRP;
                
@@ -1119,7 +1124,7 @@ DOM_SID *algorithmic_uid_to_sid(DOM_SID *psid, uid_t uid)
 
        DEBUG(8,("algorithmic_uid_to_sid: falling back to RID algorithm\n"));
        sid_copy( psid, get_global_sam_sid() );
-       sid_append_rid( psid, fallback_pdb_uid_to_user_rid(uid) );
+       sid_append_rid( psid, algorithmic_pdb_uid_to_user_rid(uid) );
        DEBUG(10,("algorithmic_uid_to_sid:  uid (%d) -> SID %s.\n",
                (unsigned int)uid, sid_string_static(psid) ));
 
@@ -1263,7 +1268,7 @@ DOM_SID *local_gid_to_sid(DOM_SID *psid, gid_t gid)
        
        if ( !ret ) {
 
-               /* fallback to rid mapping if enabled */
+               /* algorithmic to rid mapping if enabled */
 
                if ( lp_enable_rid_algorithm() ) {
 
@@ -1308,7 +1313,7 @@ BOOL local_sid_to_gid(gid_t *pgid, const DOM_SID *psid, enum SID_NAME_USE *name_
        
        if ( !ret ) {
 
-               /* fallback to rid mapping if enabled */
+               /* Fallback to algorithmic rid mapping if enabled */
 
                if ( lp_enable_rid_algorithm() ) {
 
@@ -1324,7 +1329,7 @@ BOOL local_sid_to_gid(gid_t *pgid, const DOM_SID *psid, enum SID_NAME_USE *name_
 
                        DEBUG(10,("local_sid_to_gid: Fall back to algorithmic mapping\n"));
 
-                       if (fallback_pdb_rid_is_user(rid)) {
+                       if (algorithmic_pdb_rid_is_user(rid)) {
                                DEBUG(3, ("local_sid_to_gid: SID %s is *NOT* a group\n", sid_string_static(psid)));
                                return False;
                        } else {
@@ -2257,11 +2262,11 @@ BOOL get_free_rid_range(uint32 *low, uint32 *high)
                return False;
        }
 
-       *low = fallback_pdb_uid_to_user_rid(id_low);
-       if (fallback_pdb_user_rid_to_uid((uint32)-1) < id_high) {
+       *low = algorithmic_pdb_uid_to_user_rid(id_low);
+       if (algorithmic_pdb_user_rid_to_uid((uint32)-1) < id_high) {
                *high = (uint32)-1;
        } else {
-               *high = fallback_pdb_uid_to_user_rid(id_high);
+               *high = algorithmic_pdb_uid_to_user_rid(id_high);
        }
 
        return True;
index 562d50f89e36fb44b746b4ed1e31dba8364e0480..6ebac1c01a5a4b3f6d929c1a6ac9b27a50d5cdaa 100644 (file)
@@ -1144,8 +1144,8 @@ static BOOL build_smb_pass (struct smb_passwd *smb_pw, const SAM_ACCOUNT *sampas
                        smb_pw->smb_userid=passwd->pw_uid;
                        passwd_free(&passwd);
 
-               } else if (fallback_pdb_rid_is_user(rid)) {
-                       smb_pw->smb_userid=fallback_pdb_user_rid_to_uid(rid);
+               } else if (algorithmic_pdb_rid_is_user(rid)) {
+                       smb_pw->smb_userid=algorithmic_pdb_user_rid_to_uid(rid);
                } else {
                        DEBUG(0,("build_sam_pass: Failing attempt to store user with non-uid based user RID. \n"));
                        return False;
@@ -1366,7 +1366,7 @@ static NTSTATUS smbpasswd_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUN
                return nt_status;
        }
 
-       while ( ((smb_pw=getsmbfilepwent(smbpasswd_state, fp)) != NULL) && (fallback_pdb_uid_to_user_rid(smb_pw->smb_userid) != rid) )
+       while ( ((smb_pw=getsmbfilepwent(smbpasswd_state, fp)) != NULL) && (algorithmic_pdb_uid_to_user_rid(smb_pw->smb_userid) != rid) )
                /* do nothing */ ;
 
        endsmbfilepwent(fp, &(smbpasswd_state->pw_file_lock_depth));
index 225ff20ec3eb52b8f7a1fb670308cd0f817ea8f6..8c0302b4300ab272e62232c7009d0460bb57c742 100644 (file)
@@ -363,6 +363,17 @@ BOOL nt_printing_init(void)
 
        message_register( MSG_PRINTERDATA_INIT_RESET, reset_all_printerdata );
 
+       /*
+        * register callback to handle invalidating the printer cache 
+        * between smbd processes.
+        */
+
+       message_register( MSG_PRINTER_MOD, receive_printer_mod_msg);
+
+       /* of course, none of the message callbacks matter if you don't
+          tell messages.c that you interested in receiving PRINT_GENERAL 
+          msgs.  This is done in claim_connection() */
+
 
        return True;
 }
@@ -3456,6 +3467,27 @@ static uint32 rev_changeid(void)
 #endif
 }
 
+/********************************************************************
+ Send a message to all smbds about the printer that just changed
+ ********************************************************************/
+static BOOL send_printer_mod_msg( char* printername )
+{
+       int len = strlen(printername);
+       
+       if (!len)
+               return False;
+
+       DEBUG(10,("send_printer_mod_msg: Sending message about printer change [%s]\n",
+               printername));
+               
+       /* spam everyone that we just changed this printer */
+       
+       message_send_all( conn_tdb_ctx(), MSG_PRINTER_MOD, printername, len+1, False, NULL );
+
+       return True;
+}
+
 /*
  * The function below are the high level ones.
  * only those ones must be called from the spoolss code.
@@ -3479,6 +3511,7 @@ WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL printer, uint32 level)
         */
         
        invalidate_printer_hnd_cache( printer.info_2->sharename );
+       send_printer_mod_msg( printer.info_2->sharename );
        
        switch (level) {
                case 2:
index 10ca7e47e711d94baba0b8f4aba33c5ae8a65b2d..31cb0faa9b0379ac007d57d592c0e30d163106fd 100644 (file)
@@ -1183,7 +1183,7 @@ void start_background_queue(void)
                DEBUG(5,("start_background_queue: background LPQ thread started\n"));
 
                claim_connection( NULL, "smbd lpq backend", 0, False, 
-                       FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINTING );
+                       FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINT_GENERAL);
 
                if (!locking_init(0)) {
                        exit(1);
index e3c9ff08d93d18e92a0429ee6c924a4675d36e0b..db60855ba0977fd532adb95a7d85a19f48ea7849 100644 (file)
@@ -180,7 +180,7 @@ static void srv_spoolss_replycloseprinter(int snum, POLICY_HND *handle)
                /* Tell the connections db we're no longer interested in
                 * printer notify messages. */
 
-               register_message_flags( False, FLAG_MSG_PRINTING );
+               register_message_flags( False, FLAG_MSG_PRINT_NOTIFY );
        }
 
        smb_connections--;
@@ -1194,12 +1194,6 @@ static void receive_notify2_message_list(int msg_type, pid_t src, void *msg, siz
                notify2_unpack_msg( &notify, &msg_tv, msg_ptr, msg_len );
                msg_ptr += msg_len;
 
-               /* we don't know if the change was from us or not so kill 
-                  any cached printer objects */
-
-               if ( notify.type == PRINTER_NOTIFY_TYPE )
-                       invalidate_printer_hnd_cache( notify.printer );
-               
                /* add to correct list in container */
                
                notify_msg_ctr_addmsg( &messages, &notify );
@@ -1226,6 +1220,22 @@ static void receive_notify2_message_list(int msg_type, pid_t src, void *msg, siz
        return;
 }
 
+/********************************************************************
+ callback to MSG_PRINTER_CHANGED.  When a printer is changed by 
+ one smbd, all of processes must clear their printer cache immediately.
+ ********************************************************************/
+
+void receive_printer_mod_msg(int msg_type, pid_t src, void *buf, size_t len)
+{
+       fstring printername;
+       
+       fstrcpy( printername, buf );
+       
+       DEBUG(10,("receive_printer_mod_msg: Printer change [%s]\n", printername ));
+       
+       invalidate_printer_hnd_cache( printername );
+}
+
 /********************************************************************
  Send a message to ourself about new driver being installed
  so we can upgrade the information for each printer bound to this
@@ -2640,7 +2650,7 @@ static BOOL srv_spoolss_replyopenprinter(int snum, const char *printer,
                message_register(MSG_PRINTER_NOTIFY2, receive_notify2_message_list);
                /* Tell the connections db we're now interested in printer
                 * notify messages. */
-               register_message_flags( True, FLAG_MSG_PRINTING );
+               register_message_flags( True, FLAG_MSG_PRINT_NOTIFY );
        }
 
        /* 
index 5bb76eb3bd83a6cf43093dcb2b015e26f3acc1d5..fc5fe9d7418df7c0c7193c23f2da54a9f4972406 100644 (file)
@@ -222,7 +222,6 @@ BOOL register_message_flags(BOOL doreg, uint32 msg_flags)
        }
 
        pcrec = (struct connections_data *)dbuf.dptr;
-       pcrec->bcast_msg_flags = msg_flags;
        if (doreg)
                pcrec->bcast_msg_flags |= msg_flags;
        else
index 74872eeea9f563ccc117f6e84dd54428aca4df7a..611fb04c19bb02f8b6dc4964f3507edc277ddc34 100644 (file)
@@ -242,7 +242,7 @@ int reply_special(char *inbuf,char *outbuf)
                reload_services(True);
                reopen_logs();
 
-               claim_connection(NULL,"",0,True,FLAG_MSG_GENERAL|FLAG_MSG_SMBD);
+               claim_connection(NULL,"",0,True,FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINT_GENERAL);
 
                already_got_session = True;
                break;
index 16281dd86cbaad0ed128aa62584265086336b2d4..0fe633bb9692468d65bc47ce775e5134a6f9b3b3 100644 (file)
@@ -846,6 +846,8 @@ void build_options(BOOL screen);
                exit(1);
 
        /* Setup the main smbd so that we can get messages. */
+       /* don't worry about general printing messages here */
+
        claim_connection(NULL,"",0,True,FLAG_MSG_GENERAL|FLAG_MSG_SMBD);
 
        /* only start the background queue daemon if we are 
index 13cfdac0f35de330ff651e7fe2aa99f34b5131c5..a47f040f6a87f41acf38b99071a72eaa407a2f69 100644 (file)
@@ -814,7 +814,7 @@ BOOL canonicalize_path(connection_struct *conn, pstring path)
  it is below dir in the heirachy. This uses realpath.
 ********************************************************************/
 
-BOOL reduce_name(connection_struct *conn, pstring fname)
+BOOL reduce_name(connection_struct *conn, const pstring fname)
 {
 #ifdef REALPATH_TAKES_NULL
        BOOL free_resolved_name = True;
@@ -924,7 +924,11 @@ BOOL reduce_name(connection_struct *conn, pstring fname)
        }
 
        if (!*p) {
-               pstrcpy(resolved_name, ".");
+               if (fname[0] == '.' && fname[1] == '/' && fname[2] == '\0') {
+                       pstrcpy(resolved_name, "./");
+               } else {
+                       pstrcpy(resolved_name, ".");
+               }
                p = resolved_name;
        }