summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-05-07 15:31:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:21:54 -0500
commitbe7bac55c37676a8137c59a22dfb2e4c4821ac21 (patch)
tree7281783dc3efef808fb29d8e6f7a33071dd116e7
parenta66a04e9f11f6c4462f2b56b447bae4eca7b177c (diff)
downloadsamba-be7bac55c37676a8137c59a22dfb2e4c4821ac21.tar.gz
samba-be7bac55c37676a8137c59a22dfb2e4c4821ac21.tar.xz
samba-be7bac55c37676a8137c59a22dfb2e4c4821ac21.zip
r22751: Next step for the cluster merge: sessionid.tdb should contain a 'struct
server_id' instead of a 'uint32 pid'
-rw-r--r--source/include/session.h2
-rw-r--r--source/rpc_server/srv_srvsvc_nt.c8
-rw-r--r--source/smbd/session.c2
-rw-r--r--source/smbd/sesssetup.c6
-rw-r--r--source/utils/net_status.c16
-rw-r--r--source/utils/status.c16
6 files changed, 25 insertions, 25 deletions
diff --git a/source/include/session.h b/source/include/session.h
index 8c8faab5325..1220f66dc50 100644
--- a/source/include/session.h
+++ b/source/include/session.h
@@ -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;
};
diff --git a/source/rpc_server/srv_srvsvc_nt.c b/source/rpc_server/srv_srvsvc_nt.c
index bdd8f68d512..2365f7ece37 100644
--- a/source/rpc_server/srv_srvsvc_nt.c
+++ b/source/rpc_server/srv_srvsvc_nt.c
@@ -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;
}
}
diff --git a/source/smbd/session.c b/source/smbd/session.c
index 30ade8aedfb..cd7511430e3 100644
--- a/source/smbd/session.c
+++ b/source/smbd/session.c
@@ -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,
diff --git a/source/smbd/sesssetup.c b/source/smbd/sesssetup.c
index 7dbf20a189e..d6cdf777d8a 100644
--- a/source/smbd/sesssetup.c
+++ b/source/smbd/sesssetup.c
@@ -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;
}
diff --git a/source/utils/net_status.c b/source/utils/net_status.c
index 72ea645896a..af6952389cb 100644
--- a/source/utils/net_status.c
+++ b/source/utils/net_status.c
@@ -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;
diff --git a/source/utils/status.c b/source/utils/status.c
index 944158567ab..d3bb79dd016 100644
--- a/source/utils/status.c
+++ b/source/utils/status.c
@@ -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);