fixed the problem with messages not getting through
authorAndrew Tridgell <tridge@samba.org>
Fri, 17 Nov 2000 03:15:18 +0000 (03:15 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 17 Nov 2000 03:15:18 +0000 (03:15 +0000)
the problem had nothing to do with being your own pid, it was instead
a problem with IPC$ connections not being registered in the
connections database and an incorrect test for -1 in the messaging
code.

These changes also mean that IPC$ shares now show up in
smbstatus. That is probably a good thing.

source/lib/messages.c
source/smbd/connection.c
source/smbd/service.c

index 8f181f0982a6c1488e2eb8794c4ad5e7d3327c8a..7a0343b24985b768b75f4d930223324f8ecd9dff 100644 (file)
@@ -374,7 +374,7 @@ static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void
 
        memcpy(&crec, dbuf.dptr, sizeof(crec));
 
-       if (crec.cnum == -1) return 0;
+       if (crec.cnum != -1) return 0;
        message_send_pid(crec.pid, msg_all.msg_type, msg_all.buf, msg_all.len, msg_all.duplicates);
        return 0;
 }
index 6e088f9f8f566743201e5d70bd7b440c053f5dae..cf455c0a8b807aea99f4556344ebaf4cbc0f58ee 100644 (file)
@@ -72,9 +72,6 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
        struct connections_data crec;
        TDB_DATA kbuf, dbuf;
 
-       if (max_connections <= 0)
-               return(True);
-
        if (!tdb) {
                tdb = tdb_open(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST, 
                               O_RDWR | O_CREAT, 0644);
index fcdd9a376bf45e8ac06665f94373394ae7ba3f46..ba381a40e8218e79726e11ea2f119065533a2e5a 100644 (file)
@@ -452,27 +452,25 @@ connection_struct *make_connection(char *service,char *user,char *password, int
        conn->ngroups = 0;
        conn->groups = NULL;
        
-       if (!IS_IPC(conn)) {
-               /* Find all the groups this uid is in and
-                  store them. Used by become_user() */
-               initialise_groups(conn->user, conn->uid, conn->gid); 
-               get_current_groups(&conn->ngroups,&conn->groups);
+       /* Find all the groups this uid is in and
+          store them. Used by become_user() */
+       initialise_groups(conn->user, conn->uid, conn->gid); 
+       get_current_groups(&conn->ngroups,&conn->groups);
                
-               /* check number of connections */
-               if (!claim_connection(conn,
-                                     lp_servicename(SNUM(conn)),
-                                     lp_max_connections(SNUM(conn)),
-                                     False)) {
-                       DEBUG(1,("too many connections - rejected\n"));
-                       *ecode = ERRnoresource;
-                       conn_free(conn);
-                       return NULL;
-               }  
+       /* check number of connections */
+       if (!claim_connection(conn,
+                             lp_servicename(SNUM(conn)),
+                             lp_max_connections(SNUM(conn)),
+                             False)) {
+               DEBUG(1,("too many connections - rejected\n"));
+               *ecode = ERRnoresource;
+               conn_free(conn);
+               return NULL;
+       }  
                
-               if (lp_status(SNUM(conn)))
-                       claim_connection(conn,"",
-                                        MAXSTATUS,False);
-       } /* IS_IPC */
+       if (lp_status(SNUM(conn)))
+               claim_connection(conn,"",
+                                MAXSTATUS,False);
 
        conn->nt_user_token = create_nt_token(conn->uid, conn->gid, conn->ngroups, conn->groups);
 
@@ -519,13 +517,11 @@ connection_struct *make_connection(char *service,char *user,char *password, int
        
        if (!become_user(conn, conn->vuid)) {
                DEBUG(0,("Can't become connected user!\n"));
-               if (!IS_IPC(conn)) {
-                       yield_connection(conn,
-                                        lp_servicename(SNUM(conn)),
-                                        lp_max_connections(SNUM(conn)));
-                       if (lp_status(SNUM(conn))) {
-                               yield_connection(conn,"",MAXSTATUS);
-                       }
+               yield_connection(conn,
+                                lp_servicename(SNUM(conn)),
+                                lp_max_connections(SNUM(conn)));
+               if (lp_status(SNUM(conn))) {
+                       yield_connection(conn,"",MAXSTATUS);
                }
                conn_free(conn);
                *ecode = ERRbadpw;
@@ -536,13 +532,11 @@ connection_struct *make_connection(char *service,char *user,char *password, int
                DEBUG(0,("Can't change directory to %s (%s)\n",
                         conn->connectpath,strerror(errno)));
                unbecome_user();
-               if (!IS_IPC(conn)) {
-                       yield_connection(conn,
-                                        lp_servicename(SNUM(conn)),
-                                        lp_max_connections(SNUM(conn)));
-                       if (lp_status(SNUM(conn))) 
-                               yield_connection(conn,"",MAXSTATUS);
-               }
+               yield_connection(conn,
+                                lp_servicename(SNUM(conn)),
+                                lp_max_connections(SNUM(conn)));
+               if (lp_status(SNUM(conn))) 
+                       yield_connection(conn,"",MAXSTATUS);
                conn_free(conn);
                *ecode = ERRnosuchshare;
                return NULL;