mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r22751: Next step for the cluster merge: sessionid.tdb should contain a 'struct
server_id' instead of a 'uint32 pid'
This commit is contained in:
parent
a66a04e9f1
commit
be7bac55c3
@ -36,7 +36,7 @@ struct sessionid {
|
|||||||
fstring remote_machine;
|
fstring remote_machine;
|
||||||
fstring id_str;
|
fstring id_str;
|
||||||
uint32 id_num;
|
uint32 id_num;
|
||||||
uint32 pid;
|
struct server_id pid;
|
||||||
fstring ip_addr;
|
fstring ip_addr;
|
||||||
time_t connect_start;
|
time_t connect_start;
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ struct file_enum_count {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct sess_file_count {
|
struct sess_file_count {
|
||||||
pid_t pid;
|
struct server_id pid;
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
int count;
|
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;
|
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++;
|
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;
|
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' ) &&
|
if ((strequal(session_list[snum].username, r->in.user) || r->in.user[0] == '\0' ) &&
|
||||||
strequal(session_list[snum].remote_machine, machine)) {
|
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;
|
status = WERR_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ BOOL session_claim(user_struct *vuser)
|
|||||||
struct sockaddr sa;
|
struct sockaddr sa;
|
||||||
struct in_addr *client_ip;
|
struct in_addr *client_ip;
|
||||||
struct sessionid sessionid;
|
struct sessionid sessionid;
|
||||||
uint32 pid = (uint32)sys_getpid();
|
struct server_id pid = procid_self();
|
||||||
fstring keystr;
|
fstring keystr;
|
||||||
char * hostname;
|
char * hostname;
|
||||||
int tdb_store_flag; /* If using utmp, we do an inital 'lock hold' store,
|
int tdb_store_flag; /* If using utmp, we do an inital 'lock hold' store,
|
||||||
|
@ -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;
|
struct sessionid *sessionid = (struct sessionid *)dbuf.dptr;
|
||||||
const char *ip = (const char *)p;
|
const char *ip = (const char *)p;
|
||||||
|
|
||||||
if (!process_exists(pid_to_procid(sessionid->pid))) {
|
if (!process_exists(sessionid->pid)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sessionid->pid == sys_getpid()) {
|
if (procid_is_me(&sessionid->pid)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1192,7 +1192,7 @@ static int shutdown_other_smbds(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
message_send_pid(pid_to_procid(sessionid->pid), MSG_SHUTDOWN,
|
message_send_pid(sessionid->pid, MSG_SHUTDOWN,
|
||||||
NULL, 0, True);
|
NULL, 0, True);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -31,18 +31,18 @@ static int show_session(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
|
|||||||
|
|
||||||
memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
|
memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
|
||||||
|
|
||||||
if (!process_exists_by_pid(sessionid.pid)) {
|
if (!process_exists(sessionid.pid)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*parseable) {
|
if (*parseable) {
|
||||||
d_printf("%d\\%s\\%s\\%s\\%s\n",
|
d_printf("%s\\%s\\%s\\%s\\%s\n",
|
||||||
(int)sessionid.pid, uidtoname(sessionid.uid),
|
procid_str_static(&sessionid.pid), uidtoname(sessionid.uid),
|
||||||
gidtoname(sessionid.gid),
|
gidtoname(sessionid.gid),
|
||||||
sessionid.remote_machine, sessionid.hostname);
|
sessionid.remote_machine, sessionid.hostname);
|
||||||
} else {
|
} else {
|
||||||
d_printf("%5d %-12s %-12s %-12s (%s)\n",
|
d_printf("%7s %-12s %-12s %-12s (%s)\n",
|
||||||
(int)sessionid.pid, uidtoname(sessionid.uid),
|
procid_str_static(&sessionid.pid), uidtoname(sessionid.uid),
|
||||||
gidtoname(sessionid.gid),
|
gidtoname(sessionid.gid),
|
||||||
sessionid.remote_machine, sessionid.hostname);
|
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",
|
d_printf("%-10.10s %s %-12s %s",
|
||||||
crec.servicename,procid_str_static(&crec.pid),
|
crec.servicename, procid_str_static(&crec.pid),
|
||||||
crec.machine,
|
crec.machine,
|
||||||
time_to_asc(crec.start));
|
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));
|
memcpy(&sessionid, dbuf.dptr, sizeof(sessionid));
|
||||||
|
|
||||||
if (!process_exists_by_pid(sessionid.pid))
|
if (!process_exists(sessionid.pid))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ids->num_entries += 1;
|
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++) {
|
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)) {
|
if (procid_equal(&id, &crec.pid)) {
|
||||||
guest = False;
|
guest = False;
|
||||||
break;
|
break;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#define SMB_MAXPIDS 2048
|
#define SMB_MAXPIDS 2048
|
||||||
static uid_t Ucrit_uid = 0; /* added by OH */
|
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 int Ucrit_MaxPid=0; /* added by OH */
|
||||||
static unsigned int Ucrit_IsActive = 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int Ucrit_checkPid(pid_t pid)
|
static unsigned int Ucrit_checkPid(struct server_id pid)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -77,14 +77,14 @@ static unsigned int Ucrit_checkPid(pid_t pid)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (i=0;i<Ucrit_MaxPid;i++) {
|
for (i=0;i<Ucrit_MaxPid;i++) {
|
||||||
if( pid == Ucrit_pid[i] )
|
if (cluster_id_equal(&pid, &Ucrit_pid[i]))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL Ucrit_addPid( pid_t pid )
|
static BOOL Ucrit_addPid( struct server_id pid )
|
||||||
{
|
{
|
||||||
if ( !Ucrit_IsActive )
|
if ( !Ucrit_IsActive )
|
||||||
return True;
|
return True;
|
||||||
@ -119,7 +119,7 @@ static void print_share_mode(const struct share_mode_entry *e,
|
|||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (Ucrit_checkPid(procid_to_pid(&e->pid))) {
|
if (Ucrit_checkPid(e->pid)) {
|
||||||
d_printf("%-11s ",procid_str_static(&e->pid));
|
d_printf("%-11s ",procid_str_static(&e->pid));
|
||||||
d_printf("%-9u ", (unsigned int)e->uid);
|
d_printf("%-9u ", (unsigned int)e->uid);
|
||||||
switch (map_share_mode_to_deny_mode(e->share_access,
|
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));
|
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;
|
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(uid_str, "%d", sessionid.uid);
|
||||||
fstr_sprintf(gid_str, "%d", sessionid.gid);
|
fstr_sprintf(gid_str, "%d", sessionid.gid);
|
||||||
|
|
||||||
d_printf("%5d %-12s %-12s %-12s (%s)\n",
|
d_printf("%s %-12s %-12s %-12s (%s)\n",
|
||||||
(int)sessionid.pid,
|
procid_str_static(&sessionid.pid),
|
||||||
numeric_only ? uid_str : uidtoname(sessionid.uid),
|
numeric_only ? uid_str : uidtoname(sessionid.uid),
|
||||||
numeric_only ? gid_str : gidtoname(sessionid.gid),
|
numeric_only ? gid_str : gidtoname(sessionid.gid),
|
||||||
sessionid.remote_machine, sessionid.hostname);
|
sessionid.remote_machine, sessionid.hostname);
|
||||||
|
Loading…
Reference in New Issue
Block a user