From d8d9f7723337c267a8740750fe19a6387cfbb1f6 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 7 May 1998 18:19:05 +0000 Subject: created "passdb.c" which is an interface point to (at present) either smbpasswd or ldap passwd, at compile-time (-DUSE_LDAP). _none_ of the functions in ldap.c or smbpass.c should be called directly: only those in passdb.c should be used. -DUSE_LDAP is unlikely to compile at the moment. (This used to be commit 57b01ad4ffb14ebd600d4e66602b54ed987f6106) --- source3/rpc_server/srv_netlog.c | 60 +++++++++++++++++++++-------------------- source3/rpc_server/srv_samr.c | 26 +++++++++--------- source3/rpc_server/srv_util.c | 4 +-- 3 files changed, 46 insertions(+), 44 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c index 6229d5ea0b..76dd5dd74d 100644 --- a/source3/rpc_server/srv_netlog.c +++ b/source3/rpc_server/srv_netlog.c @@ -237,7 +237,7 @@ static BOOL get_md4pw(char *md4pw, char *mach_name, char *mach_acct) } become_root(True); - smb_pass = getsmbpwnam(mach_acct); + smb_pass = getsampwnam(mach_acct); unbecome_root(True); if (smb_pass != NULL) @@ -377,48 +377,50 @@ static void api_net_srv_pwset( int uid, /* checks and updates credentials. creates reply credentials */ if (deal_with_creds(vuser->dc.sess_key, &(vuser->dc.clnt_cred), - &(q_a.clnt_id.cred), &srv_cred)) + &(q_a.clnt_id.cred), &srv_cred)) { memcpy(&(vuser->dc.srv_cred), &(vuser->dc.clnt_cred), sizeof(vuser->dc.clnt_cred)); DEBUG(5,("api_net_srv_pwset: %d\n", __LINE__)); - pstrcpy(mach_acct, unistrn2(q_a.clnt_id.login.uni_acct_name.buffer, - q_a.clnt_id.login.uni_acct_name.uni_str_len)); + pstrcpy(mach_acct, unistrn2(q_a.clnt_id.login.uni_acct_name.buffer, + q_a.clnt_id.login.uni_acct_name.uni_str_len)); - DEBUG(3,("Server Password Set Wksta:[%s]\n", mach_acct)); + DEBUG(3,("Server Password Set Wksta:[%s]\n", mach_acct)); - become_root(True); - smb_pass = getsmbpwnam(mach_acct); - unbecome_root(True); + become_root(True); + smb_pass = getsampwnam(mach_acct); + unbecome_root(True); if (smb_pass != NULL) { - unsigned char pwd[16]; - int i; + unsigned char pwd[16]; + int i; - DEBUG(100,("Server password set : new given value was :\n")); - for(i = 0; i < 16; i++) - DEBUG(100,("%02X ", q_a.pwd[i])); - DEBUG(100,("\n")); + DEBUG(100,("Server password set : new given value was :\n")); + for(i = 0; i < 16; i++) + { + DEBUG(100,("%02X ", q_a.pwd[i])); + } + DEBUG(100,("\n")); - cred_hash3( pwd, q_a.pwd, vuser->dc.sess_key, 0); + cred_hash3( pwd, q_a.pwd, vuser->dc.sess_key, 0); - /* lies! nt and lm passwords are _not_ the same: don't care */ - smb_pass->smb_passwd = pwd; - smb_pass->smb_nt_passwd = pwd; - smb_pass->acct_ctrl = ACB_WSTRUST; + /* lies! nt and lm passwords are _not_ the same: don't care */ + smb_pass->smb_passwd = pwd; + smb_pass->smb_nt_passwd = pwd; + smb_pass->acct_ctrl = ACB_WSTRUST; - become_root(True); - ret = mod_smbpwd_entry(smb_pass,False); - unbecome_root(True); + become_root(True); + ret = mod_sampwd_entry(smb_pass,False); + unbecome_root(True); - if (ret) - { - /* hooray! */ - status = 0x0; - } - } + if (ret) + { + /* hooray! */ + status = 0x0; + } + } DEBUG(5,("api_net_srv_pwset: %d\n", __LINE__)); @@ -629,7 +631,7 @@ static void api_net_sam_logon( int uid, DEBUG(3,("User:[%s]\n", samlogon_user)); become_root(True); - smb_pass = getsmbpwnam(samlogon_user); + smb_pass = getsampwnam(samlogon_user); unbecome_root(True); if (smb_pass == NULL) diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 353da9bd29..c8c483ac31 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -38,7 +38,7 @@ extern rid_name domain_alias_rids[]; dynamically returns the correct user info..... JRA. ********************************************************************/ -static BOOL get_smbpwd_entries(SAM_USER_INFO_21 *pw_buf, +static BOOL get_sampwd_entries(SAM_USER_INFO_21 *pw_buf, int *total_entries, int *num_entries, int max_num_entries, uint16 acb_mask) @@ -51,14 +51,14 @@ static BOOL get_smbpwd_entries(SAM_USER_INFO_21 *pw_buf, if (pw_buf == NULL) return False; - vp = startsmbpwent(False); + vp = startsampwent(False); if (!vp) { - DEBUG(0, ("get_smbpwd_entries: Unable to open SMB password file.\n")); + DEBUG(0, ("get_sampwd_entries: Unable to open SMB password file.\n")); return False; } - while (((pwd = getsmbpwent(vp)) != NULL) && (*num_entries) < max_num_entries) + while (((pwd = getsampwent(vp)) != NULL) && (*num_entries) < max_num_entries) { int user_name_len = strlen(pwd->smb_name); make_unistr2(&(pw_buf[(*num_entries)].uni_user_name), pwd->smb_name, user_name_len-1); @@ -75,7 +75,7 @@ static BOOL get_smbpwd_entries(SAM_USER_INFO_21 *pw_buf, pw_buf[(*num_entries)].acb_info = (uint16)pwd->acct_ctrl; - DEBUG(5, ("get_smbpwd_entries: idx: %d user %s, uid %d, acb %x", + DEBUG(5, ("get_sampwd_entries: idx: %d user %s, uid %d, acb %x", (*num_entries), pwd->smb_name, pwd->smb_userid, pwd->acct_ctrl)); if (acb_mask == 0 || IS_BITS_SET_SOME(pwd->acct_ctrl, acb_mask)) @@ -91,7 +91,7 @@ static BOOL get_smbpwd_entries(SAM_USER_INFO_21 *pw_buf, (*total_entries)++; } - endsmbpwent(vp); + endsampwent(vp); return (*num_entries) > 0; } @@ -295,7 +295,7 @@ static void samr_reply_enum_dom_users(SAMR_Q_ENUM_DOM_USERS *q_u, DEBUG(5,("samr_reply_enum_dom_users: %d\n", __LINE__)); become_root(True); - got_pwds = get_smbpwd_entries(pass, &total_entries, &num_entries, MAX_SAM_ENTRIES, q_u->acb_mask); + got_pwds = get_sampwd_entries(pass, &total_entries, &num_entries, MAX_SAM_ENTRIES, q_u->acb_mask); unbecome_root(True); make_samr_r_enum_dom_users(&r_e, total_entries, @@ -466,7 +466,7 @@ static void samr_reply_query_dispinfo(SAMR_Q_QUERY_DISPINFO *q_u, #ifndef USE_LDAP become_root(True); - got_pwds = get_smbpwd_entries(pass, &total_entries, &num_entries, MAX_SAM_ENTRIES, 0); + got_pwds = get_sampwd_entries(pass, &total_entries, &num_entries, MAX_SAM_ENTRIES, 0); unbecome_root(True); #endif /* USE_LDAP */ @@ -633,7 +633,7 @@ static void samr_reply_lookup_ids(SAMR_Q_LOOKUP_IDS *q_u, /* find the user account */ become_root(True); - smb_pass = get_smbpwd_entry(user_name, 0); + smb_pass = get_sampwd_entry(user_name, 0); unbecome_root(True); if (smb_pass == NULL) @@ -825,7 +825,7 @@ static void samr_reply_open_user(SAMR_Q_OPEN_USER *q_u, } become_root(True); - smb_pass = getsmbpwuid(q_u->user_rid); + smb_pass = getsampwuid(q_u->user_rid); unbecome_root(True); /* check that the RID exists in our domain. */ @@ -896,7 +896,7 @@ static BOOL get_user_info_21(SAM_USER_INFO_21 *id21, uint32 rid) struct smb_passwd *smb_pass; become_root(True); - smb_pass = getsmbpwuid(rid); + smb_pass = getsampwuid(rid); unbecome_root(True); if (smb_pass == NULL) @@ -1117,7 +1117,7 @@ static void samr_reply_query_usergroups(SAMR_Q_QUERY_USERGROUPS *q_u, if (status == 0x0) { become_root(True); - smb_pass = getsmbpwuid(rid); + smb_pass = getsampwuid(rid); unbecome_root(True); if (smb_pass == NULL) @@ -1213,7 +1213,7 @@ static void api_samr_unknown_32( int uid, prs_struct *data, prs_struct *rdata) q_u.uni_mach_acct.uni_str_len)); become_root(True); - smb_pass = getsmbpwnam(mach_acct); + smb_pass = getsampwnam(mach_acct); unbecome_root(True); if (smb_pass != NULL) diff --git a/source3/rpc_server/srv_util.c b/source3/rpc_server/srv_util.c index 898269dc4a..a84dbb43ef 100644 --- a/source3/rpc_server/srv_util.c +++ b/source3/rpc_server/srv_util.c @@ -406,7 +406,7 @@ uint32 lookup_user_name(uint32 rid, char *user_name, uint32 *type) /* ok, it's a user. find the user account */ become_root(True); - smb_pass = getsmbpwuid(rid); /* lkclXXXX SHOULD use rid mapping here! */ + smb_pass = getsampwuid(rid); /* lkclXXXX SHOULD use rid mapping here! */ unbecome_root(True); if (smb_pass != NULL) @@ -468,7 +468,7 @@ uint32 lookup_user_rid(char *user_name, uint32 *rid) /* find the user account */ become_root(True); - smb_pass = getsmbpwnam(user_name); + smb_pass = getsampwnam(user_name); unbecome_root(True); if (smb_pass != NULL) -- cgit