r22751: Next step for the cluster merge: sessionid.tdb should contain a 'struct
authorVolker Lendecke <vlendec@samba.org>
Mon, 7 May 2007 15:31:12 +0000 (15:31 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:21:54 +0000 (12:21 -0500)
server_id' instead of a 'uint32 pid'

source/include/session.h
source/rpc_server/srv_srvsvc_nt.c
source/smbd/session.c
source/smbd/sesssetup.c
source/utils/net_status.c
source/utils/status.c

index 8c8faab53250695236eb5f4e506dfef4efa70039..1220f66dc50e621fcdde2e4bef6e8f0c24f45353 100644 (file)
@@ -36,7 +36,7 @@ struct sessionid {
        fstring remote_machine;
        fstring id_str;
        uint32  id_num;
-       uint32  pid;
+       struct server_id pid;
        fstring ip_addr;
        time_t connect_start;
 };
index bdd8f68d5122b9bbd85ce5cc0b3d6ccf037c8251..2365f7ece37c558dee5686ae92c2ac5e6d94e436 100644 (file)
@@ -43,7 +43,7 @@ struct file_enum_count {
 };
 
 struct sess_file_count {
-       pid_t pid;
+       struct server_id pid;
        uid_t uid;
        int count;
 };
@@ -809,7 +809,7 @@ static void sess_file_fn( const struct share_mode_entry *e,
 {
        struct sess_file_count *sess = (struct sess_file_count *)private_data;
  
-       if ( (procid_to_pid(&e->pid) == sess->pid) && (sess->uid == e->uid) ) {
+       if ( procid_equal(&e->pid, &sess->pid) && (sess->uid == e->uid) ) {
                sess->count++;
        }
        
@@ -819,7 +819,7 @@ static void sess_file_fn( const struct share_mode_entry *e,
 /*******************************************************************
 ********************************************************************/
 
-static int net_count_files( uid_t uid, pid_t pid )
+static int net_count_files( uid_t uid, struct server_id pid )
 {
        struct sess_file_count s_file_cnt;
 
@@ -1237,7 +1237,7 @@ WERROR _srvsvc_NetSessDel(pipes_struct *p, struct srvsvc_NetSessDel *r)
                if ((strequal(session_list[snum].username, r->in.user) || r->in.user[0] == '\0' ) &&
                     strequal(session_list[snum].remote_machine, machine)) {
                
-                       if (NT_STATUS_IS_OK(message_send_pid(pid_to_procid(session_list[snum].pid), MSG_SHUTDOWN, NULL, 0, False)))
+                       if (NT_STATUS_IS_OK(message_send_pid(session_list[snum].pid, MSG_SHUTDOWN, NULL, 0, False)))
                                status = WERR_OK;
                }
        }
index 30ade8aedfb798f6a83e1e832f77fc0a857928cf..cd7511430e3a70f70f17999db0207924839a5a69 100644 (file)
@@ -60,7 +60,7 @@ BOOL session_claim(user_struct *vuser)
        struct sockaddr sa;
        struct in_addr *client_ip;
        struct sessionid sessionid;
-       uint32 pid = (uint32)sys_getpid();
+       struct server_id pid = procid_self();
        fstring keystr;
        char * hostname;
        int tdb_store_flag;  /* If using utmp, we do an inital 'lock hold' store,
index 7dbf20a189ecd6be0e3a6cabb960e13767708a4e..d6cdf777d8ae9d8faa35e43ddb3fc54a7c5b149b 100644 (file)
@@ -1180,11 +1180,11 @@ static int shutdown_other_smbds(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
        struct sessionid *sessionid = (struct sessionid *)dbuf.dptr;
        const char *ip = (const char *)p;
 
-       if (!process_exists(pid_to_procid(sessionid->pid))) {
+       if (!process_exists(sessionid->pid)) {
                return 0;
        }
 
-       if (sessionid->pid == sys_getpid()) {
+       if (procid_is_me(&sessionid->pid)) {
                return 0;
        }
 
@@ -1192,7 +1192,7 @@ static int shutdown_other_smbds(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
                return 0;
        }
 
-       message_send_pid(pid_to_procid(sessionid->pid), MSG_SHUTDOWN,
+       message_send_pid(sessionid->pid, MSG_SHUTDOWN,
                         NULL, 0, True);
        return 0;
 }
index 72ea645896ace2b304173a8a1a17a5b8185b9b55..af6952389cbdf584b541ce27fdd575773c4f2369 100644 (file)
@@ -31,18 +31,18 @@ static int show_session(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
 
        memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
 
-       if (!process_exists_by_pid(sessionid.pid)) {
+       if (!process_exists(sessionid.pid)) {
                return 0;
        }
 
        if (*parseable) {
-               d_printf("%d\\%s\\%s\\%s\\%s\n",
-                        (int)sessionid.pid, uidtoname(sessionid.uid),
+               d_printf("%s\\%s\\%s\\%s\\%s\n",
+                        procid_str_static(&sessionid.pid), uidtoname(sessionid.uid),
                         gidtoname(sessionid.gid), 
                         sessionid.remote_machine, sessionid.hostname);
        } else {
-               d_printf("%5d   %-12s  %-12s  %-12s (%s)\n",
-                        (int)sessionid.pid, uidtoname(sessionid.uid),
+               d_printf("%7s   %-12s  %-12s  %-12s (%s)\n",
+                        procid_str_static(&sessionid.pid), uidtoname(sessionid.uid),
                         gidtoname(sessionid.gid), 
                         sessionid.remote_machine, sessionid.hostname);
        }
@@ -102,7 +102,7 @@ static int show_share(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
        }
 
        d_printf("%-10.10s   %s   %-12s  %s",
-              crec.servicename,procid_str_static(&crec.pid),
+              crec.servicename, procid_str_static(&crec.pid),
               crec.machine,
               time_to_asc(crec.start));
 
@@ -125,7 +125,7 @@ static int collect_pid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
 
        memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
 
-       if (!process_exists_by_pid(sessionid.pid)) 
+       if (!process_exists(sessionid.pid)) 
                return 0;
 
        ids->num_entries += 1;
@@ -160,7 +160,7 @@ static int show_share_parseable(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
        }
 
        for (i=0; i<ids->num_entries; i++) {
-               struct server_id id = pid_to_procid(ids->entries[i].pid);
+               struct server_id id = ids->entries[i].pid;
                if (procid_equal(&id, &crec.pid)) {
                        guest = False;
                        break;
index 944158567abdd187eca327ce38c35ea0a2e577b1..d3bb79dd016b0d4f398408aaf505fe0ec2e73e91 100644 (file)
@@ -35,7 +35,7 @@
 
 #define SMB_MAXPIDS            2048
 static uid_t           Ucrit_uid = 0;               /* added by OH */
-static pid_t           Ucrit_pid[SMB_MAXPIDS];  /* Ugly !!! */   /* added by OH */
+static struct server_id        Ucrit_pid[SMB_MAXPIDS];  /* Ugly !!! */   /* added by OH */
 static int             Ucrit_MaxPid=0;                    /* added by OH */
 static unsigned int    Ucrit_IsActive = 0;                /* added by OH */
 
@@ -69,7 +69,7 @@ static unsigned int Ucrit_checkUid(uid_t uid)
        return 0;
 }
 
-static unsigned int Ucrit_checkPid(pid_t pid)
+static unsigned int Ucrit_checkPid(struct server_id pid)
 {
        int i;
        
@@ -77,14 +77,14 @@ static unsigned int Ucrit_checkPid(pid_t pid)
                return 1;
        
        for (i=0;i<Ucrit_MaxPid;i++) {
-               if( pid == Ucrit_pid[i] 
+               if (cluster_id_equal(&pid, &Ucrit_pid[i])
                        return 1;
        }
        
        return 0;
 }
 
-static BOOL Ucrit_addPid( pid_t pid )
+static BOOL Ucrit_addPid( struct server_id pid )
 {
        if ( !Ucrit_IsActive )
                return True;
@@ -119,7 +119,7 @@ static void print_share_mode(const struct share_mode_entry *e,
        }
        count++;
 
-       if (Ucrit_checkPid(procid_to_pid(&e->pid))) {
+       if (Ucrit_checkPid(e->pid)) {
                d_printf("%-11s  ",procid_str_static(&e->pid));
                d_printf("%-9u  ", (unsigned int)e->uid);
                switch (map_share_mode_to_deny_mode(e->share_access,
@@ -222,7 +222,7 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
 
        memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
 
-       if (!process_exists_by_pid(sessionid.pid) || !Ucrit_checkUid(sessionid.uid)) {
+       if (!process_exists(sessionid.pid) || !Ucrit_checkUid(sessionid.uid)) {
                return 0;
        }
 
@@ -231,8 +231,8 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
        fstr_sprintf(uid_str, "%d", sessionid.uid);
        fstr_sprintf(gid_str, "%d", sessionid.gid);
 
-       d_printf("%5d   %-12s  %-12s  %-12s (%s)\n",
-                (int)sessionid.pid,
+       d_printf("%s   %-12s  %-12s  %-12s (%s)\n",
+                procid_str_static(&sessionid.pid),
                 numeric_only ? uid_str : uidtoname(sessionid.uid),
                 numeric_only ? gid_str : gidtoname(sessionid.gid), 
                 sessionid.remote_machine, sessionid.hostname);