summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-01-26 05:52:20 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-01-26 05:52:20 +0000
commit4fc9e16ad7a77cf2e37b27640c0dec2052e9cda0 (patch)
treeefdbb2b8427a689bcaf91716e15575db989b08cc
parent3db417c2ebfda0d5872dee39e36edc4fb6299b9a (diff)
downloadsamba-4fc9e16ad7a77cf2e37b27640c0dec2052e9cda0.tar.gz
samba-4fc9e16ad7a77cf2e37b27640c0dec2052e9cda0.tar.xz
samba-4fc9e16ad7a77cf2e37b27640c0dec2052e9cda0.zip
Try to move towards slightly sane linking for Samba by removing some pdb_...()
calls from rpc_parse/parse_net.c - instead these values are passed as a paramater. Unfortunetly some there is still some samr work to be done before this is actually useful. Andrew Bartlett
-rw-r--r--source/rpc_parse/parse_net.c49
-rw-r--r--source/rpc_server/srv_netlog_nt.c42
2 files changed, 62 insertions, 29 deletions
diff --git a/source/rpc_parse/parse_net.c b/source/rpc_parse/parse_net.c
index c113daefab4..28fb175bb7c 100644
--- a/source/rpc_parse/parse_net.c
+++ b/source/rpc_parse/parse_net.c
@@ -1192,10 +1192,32 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int d
}
/*************************************************************************
- Init
+ Inits a NET_USER_INFO_3 structure.
+
+ This is a network logon reply packet, and contains much information about
+ the user. This information is passed as a (very long) paramater list
+ to avoid having to link in the PASSDB code to every program that deals
+ with this file.
*************************************************************************/
-void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw,
+void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr,
+ uint32 user_rid,
+ uint32 group_rid,
+
+ const char* user_name,
+ const char* full_name,
+ const char* home_dir,
+ const char* dir_drive,
+ const char* logon_script,
+ const char* profile_path,
+
+ time_t unix_logon_time,
+ time_t unix_logoff_time,
+ time_t unix_kickoff_time,
+ time_t unix_pass_last_set_time,
+ time_t unix_pass_can_change_time,
+ time_t unix_pass_must_change_time,
+
uint16 logon_count, uint16 bad_pw_count,
uint32 num_groups, DOM_GID *gids,
uint32 user_flgs, uchar *sess_key,
@@ -1214,13 +1236,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam
int len_user_name, len_full_name, len_home_dir,
len_dir_drive, len_logon_script, len_profile_path;
- const char* user_name = pdb_get_username(sampw);
- const char* full_name = pdb_get_fullname(sampw);
- const char* home_dir = pdb_get_homedir(sampw);
- const char* dir_drive = pdb_get_dirdrive(sampw);
- const char* logon_script = pdb_get_logon_script(sampw);
- const char* profile_path = pdb_get_profile_path(sampw);
-
int len_logon_srv = strlen(logon_srv);
int len_logon_dom = strlen(logon_dom);
@@ -1238,12 +1253,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam
/* Create NTTIME structs */
- unix_to_nt_time (&logon_time, pdb_get_logon_time(sampw));
- unix_to_nt_time (&logoff_time, pdb_get_logoff_time(sampw));
- unix_to_nt_time (&kickoff_time, pdb_get_kickoff_time(sampw));
- unix_to_nt_time (&pass_last_set_time, pdb_get_pass_last_set_time(sampw));
- unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(sampw));
- unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(sampw));
+ unix_to_nt_time (&logon_time, unix_logon_time);
+ unix_to_nt_time (&logoff_time, unix_logoff_time);
+ unix_to_nt_time (&kickoff_time, unix_kickoff_time);
+ unix_to_nt_time (&pass_last_set_time, unix_pass_last_set_time);
+ unix_to_nt_time (&pass_can_change_time, unix_pass_can_change_time);
+ unix_to_nt_time (&pass_must_change_time, unix_pass_must_change_time);
usr->logon_time = logon_time;
usr->logoff_time = logoff_time;
@@ -1262,8 +1277,8 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam
usr->logon_count = logon_count;
usr->bad_pw_count = bad_pw_count;
- usr->user_rid = pdb_get_user_rid(sampw);
- usr->group_rid = pdb_get_group_rid(sampw);
+ usr->user_rid = user_rid;
+ usr->group_rid = group_rid;
usr->num_groups = num_groups;
usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */
diff --git a/source/rpc_server/srv_netlog_nt.c b/source/rpc_server/srv_netlog_nt.c
index 75a64b3039b..7a1c69fb25d 100644
--- a/source/rpc_server/srv_netlog_nt.c
+++ b/source/rpc_server/srv_netlog_nt.c
@@ -505,6 +505,7 @@ NTSTATUS _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *
auth_usersupplied_info *user_info = NULL;
auth_serversupplied_info *server_info = NULL;
extern userdom_struct current_user_info;
+ SAM_ACCOUNT *sampw;
usr_info = (NET_USER_INFO_3 *)talloc(p->mem_ctx, sizeof(NET_USER_INFO_3));
if (!usr_info)
@@ -675,18 +676,35 @@ NTSTATUS _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *
gids = NULL;
get_domain_user_groups(p->mem_ctx, &num_gids, &gids, server_info->sam_account);
- init_net_user_info3(p->mem_ctx, usr_info, server_info->sam_account,
- 0, /* logon_count */
- 0, /* bad_pw_count */
- num_gids, /* uint32 num_groups */
- gids , /* DOM_GID *gids */
- 0x20 , /* uint32 user_flgs (?) */
- NULL, /* uchar sess_key[16] */
- my_name , /* char *logon_srv */
- my_workgroup, /* char *logon_dom */
- &global_sam_sid, /* DOM_SID *dom_sid */
- NULL); /* char *other_sids */
-
+ sampw = server_info->sam_account;
+
+ init_net_user_info3(p->mem_ctx, usr_info,
+ pdb_get_user_rid(sampw),
+ pdb_get_group_rid(sampw),
+
+ pdb_get_username(sampw),
+ pdb_get_fullname(sampw),
+ pdb_get_homedir(sampw),
+ pdb_get_dirdrive(sampw),
+ pdb_get_logon_script(sampw),
+ pdb_get_profile_path(sampw),
+ pdb_get_logon_time(sampw),
+ pdb_get_logoff_time(sampw),
+ pdb_get_kickoff_time(sampw),
+ pdb_get_pass_last_set_time(sampw),
+ pdb_get_pass_can_change_time(sampw),
+ pdb_get_pass_must_change_time(sampw),
+
+ 0, /* logon_count */
+ 0, /* bad_pw_count */
+ num_gids, /* uint32 num_groups */
+ gids , /* DOM_GID *gids */
+ 0x20 , /* uint32 user_flgs (?) */
+ NULL, /* uchar sess_key[16] */
+ my_name , /* char *logon_srv */
+ my_workgroup, /* char *logon_dom */
+ &global_sam_sid, /* DOM_SID *dom_sid */
+ NULL); /* char *other_sids */
}
free_server_info(&server_info);
return status;