summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-02 13:10:25 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-02 13:10:25 +0000
commitff18825765440497a4eda97d6aaf7ff327db64bb (patch)
tree229acdab7c4ec99adff55e4d5bbca669c29c64fe
parent81c6415aa14d86630531d741a1c4c4f552cb84af (diff)
downloadsamba-ff18825765440497a4eda97d6aaf7ff327db64bb.tar.gz
samba-ff18825765440497a4eda97d6aaf7ff327db64bb.tar.bz2
samba-ff18825765440497a4eda97d6aaf7ff327db64bb.zip
We already have one function to move unistr2 -> multibyte-static, so we
don't need a second just for pdb. Also, remove magic 'is lp_guest_account' test - the magic RID should be up to the passdb backend to set. Andrew Bartlett (This used to be commit f71c8338d35a2e8c73c3d8006ea6858cb522c715)
-rw-r--r--source3/auth/auth_util.c10
-rw-r--r--source3/passdb/passdb.c19
-rw-r--r--source3/rpc_server/srv_samr_util.c40
3 files changed, 25 insertions, 44 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 5696b8f2dc..dd3f55539f 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -953,27 +953,27 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- if (!pdb_set_fullname(sam_account, pdb_unistr2_convert(&(info3->uni_full_name)), PDB_CHANGED)) {
+ if (!pdb_set_fullname(sam_account, unistr2_static(&(info3->uni_full_name)), PDB_CHANGED)) {
pdb_free_sam(&sam_account);
return NT_STATUS_NO_MEMORY;
}
- if (!pdb_set_logon_script(sam_account, pdb_unistr2_convert(&(info3->uni_logon_script)), PDB_CHANGED)) {
+ if (!pdb_set_logon_script(sam_account, unistr2_static(&(info3->uni_logon_script)), PDB_CHANGED)) {
pdb_free_sam(&sam_account);
return NT_STATUS_NO_MEMORY;
}
- if (!pdb_set_profile_path(sam_account, pdb_unistr2_convert(&(info3->uni_profile_path)), PDB_CHANGED)) {
+ if (!pdb_set_profile_path(sam_account, unistr2_static(&(info3->uni_profile_path)), PDB_CHANGED)) {
pdb_free_sam(&sam_account);
return NT_STATUS_NO_MEMORY;
}
- if (!pdb_set_homedir(sam_account, pdb_unistr2_convert(&(info3->uni_home_dir)), PDB_CHANGED)) {
+ if (!pdb_set_homedir(sam_account, unistr2_static(&(info3->uni_home_dir)), PDB_CHANGED)) {
pdb_free_sam(&sam_account);
return NT_STATUS_NO_MEMORY;
}
- if (!pdb_set_dir_drive(sam_account, pdb_unistr2_convert(&(info3->uni_dir_drive)), PDB_CHANGED)) {
+ if (!pdb_set_dir_drive(sam_account, unistr2_static(&(info3->uni_dir_drive)), PDB_CHANGED)) {
pdb_free_sam(&sam_account);
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index e13f0e9dfb..71a880d295 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -826,8 +826,6 @@ DOM_SID *local_uid_to_sid(DOM_SID *psid, uid_t uid)
if (pdb_getsampwnam(sam_user, pass->pw_name)) {
sid_copy(psid, pdb_get_user_sid(sam_user));
- } else if (strcmp(pass->pw_name, lp_guestaccount()) == 0) {
- sid_append_rid(psid, DOMAIN_USER_RID_GUEST);
} else {
sid_append_rid(psid, fallback_pdb_uid_to_user_rid(uid));
}
@@ -991,23 +989,6 @@ BOOL local_sid_to_gid(gid_t *pgid, const DOM_SID *psid, enum SID_NAME_USE *name_
return True;
}
-/**
- * Quick hack to do an easy ucs2 -> mulitbyte conversion
- * @return static buffer containing the converted string
- **/
-
-const char *pdb_unistr2_convert(const UNISTR2 *from)
-{
- static pstring convert_buffer;
- *convert_buffer = 0;
- if (!from) {
- return NULL;
- }
-
- unistr2_to_ascii(convert_buffer, from, sizeof(pstring));
- return convert_buffer;
-}
-
/*************************************************************
Change a password entry in the local smbpasswd file.
diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c
index 97c7b67839..d7ead0d15f 100644
--- a/source3/rpc_server/srv_samr_util.c
+++ b/source3/rpc_server/srv_samr_util.c
@@ -91,7 +91,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
/* Backend should check this for sainity */
if (from->hdr_user_name.buffer) {
old_string = pdb_get_username(to);
- new_string = pdb_unistr2_convert(&from->uni_user_name);
+ new_string = unistr2_static(&from->uni_user_name);
DEBUG(10,("INFO_21 UNI_USER_NAME: %s -> %s\n", old_string, new_string));
if (STRING_CHANGED)
pdb_set_username(to , new_string, PDB_CHANGED);
@@ -99,7 +99,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_full_name.buffer) {
old_string = pdb_get_fullname(to);
- new_string = pdb_unistr2_convert(&from->uni_full_name);
+ new_string = unistr2_static(&from->uni_full_name);
DEBUG(10,("INFO_21 UNI_FULL_NAME: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_fullname(to , new_string, PDB_CHANGED);
@@ -107,7 +107,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_home_dir.buffer) {
old_string = pdb_get_homedir(to);
- new_string = pdb_unistr2_convert(&from->uni_home_dir);
+ new_string = unistr2_static(&from->uni_home_dir);
DEBUG(10,("INFO_21 UNI_HOME_DIR: %s -> %s\n",old_string,new_string));
if (STRING_CHANGED)
pdb_set_homedir(to , new_string, PDB_CHANGED);
@@ -115,7 +115,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_dir_drive.buffer) {
old_string = pdb_get_dir_drive(to);
- new_string = pdb_unistr2_convert(&from->uni_dir_drive);
+ new_string = unistr2_static(&from->uni_dir_drive);
DEBUG(10,("INFO_21 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string));
if (STRING_CHANGED)
pdb_set_dir_drive(to , new_string, PDB_CHANGED);
@@ -123,7 +123,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_logon_script.buffer) {
old_string = pdb_get_logon_script(to);
- new_string = pdb_unistr2_convert(&from->uni_logon_script);
+ new_string = unistr2_static(&from->uni_logon_script);
DEBUG(10,("INFO_21 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string));
if (STRING_CHANGED)
pdb_set_logon_script(to , new_string, PDB_CHANGED);
@@ -131,7 +131,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_profile_path.buffer) {
old_string = pdb_get_profile_path(to);
- new_string = pdb_unistr2_convert(&from->uni_profile_path);
+ new_string = unistr2_static(&from->uni_profile_path);
DEBUG(10,("INFO_21 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_profile_path(to , new_string, PDB_CHANGED);
@@ -139,7 +139,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_acct_desc.buffer) {
old_string = pdb_get_acct_desc(to);
- new_string = pdb_unistr2_convert(&from->uni_acct_desc);
+ new_string = unistr2_static(&from->uni_acct_desc);
DEBUG(10,("INFO_21 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string));
if (STRING_CHANGED)
pdb_set_acct_desc(to , new_string, PDB_CHANGED);
@@ -147,7 +147,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_workstations.buffer) {
old_string = pdb_get_workstations(to);
- new_string = pdb_unistr2_convert(&from->uni_workstations);
+ new_string = unistr2_static(&from->uni_workstations);
DEBUG(10,("INFO_21 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_workstations(to , new_string, PDB_CHANGED);
@@ -155,7 +155,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_unknown_str.buffer) {
old_string = pdb_get_unknown_str(to);
- new_string = pdb_unistr2_convert(&from->uni_unknown_str);
+ new_string = unistr2_static(&from->uni_unknown_str);
DEBUG(10,("INFO_21 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_unknown_str(to , new_string, PDB_CHANGED);
@@ -163,7 +163,7 @@ void copy_id21_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_21 *from)
if (from->hdr_munged_dial.buffer) {
old_string = pdb_get_munged_dial(to);
- new_string = pdb_unistr2_convert(&from->uni_munged_dial);
+ new_string = unistr2_static(&from->uni_munged_dial);
DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_munged_dial(to , new_string, PDB_CHANGED);
@@ -293,7 +293,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
/* Backend should check this for sainity */
if (from->hdr_user_name.buffer) {
old_string = pdb_get_username(to);
- new_string = pdb_unistr2_convert(&from->uni_user_name);
+ new_string = unistr2_static(&from->uni_user_name);
DEBUG(10,("INFO_23 UNI_USER_NAME: %s -> %s\n", old_string, new_string));
if (STRING_CHANGED)
pdb_set_username(to , new_string, PDB_CHANGED);
@@ -301,7 +301,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_full_name.buffer) {
old_string = pdb_get_fullname(to);
- new_string = pdb_unistr2_convert(&from->uni_full_name);
+ new_string = unistr2_static(&from->uni_full_name);
DEBUG(10,("INFO_23 UNI_FULL_NAME: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_fullname(to , new_string, PDB_CHANGED);
@@ -309,7 +309,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_home_dir.buffer) {
old_string = pdb_get_homedir(to);
- new_string = pdb_unistr2_convert(&from->uni_home_dir);
+ new_string = unistr2_static(&from->uni_home_dir);
DEBUG(10,("INFO_23 UNI_HOME_DIR: %s -> %s\n",old_string,new_string));
if (STRING_CHANGED)
pdb_set_homedir(to , new_string, PDB_CHANGED);
@@ -317,7 +317,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_dir_drive.buffer) {
old_string = pdb_get_dir_drive(to);
- new_string = pdb_unistr2_convert(&from->uni_dir_drive);
+ new_string = unistr2_static(&from->uni_dir_drive);
DEBUG(10,("INFO_23 UNI_DIR_DRIVE: %s -> %s\n",old_string,new_string));
if (STRING_CHANGED)
pdb_set_dir_drive(to , new_string, PDB_CHANGED);
@@ -325,7 +325,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_logon_script.buffer) {
old_string = pdb_get_logon_script(to);
- new_string = pdb_unistr2_convert(&from->uni_logon_script);
+ new_string = unistr2_static(&from->uni_logon_script);
DEBUG(10,("INFO_23 UNI_LOGON_SCRIPT: %s -> %s\n",old_string,new_string));
if (STRING_CHANGED)
pdb_set_logon_script(to , new_string, PDB_CHANGED);
@@ -333,7 +333,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_profile_path.buffer) {
old_string = pdb_get_profile_path(to);
- new_string = pdb_unistr2_convert(&from->uni_profile_path);
+ new_string = unistr2_static(&from->uni_profile_path);
DEBUG(10,("INFO_23 UNI_PROFILE_PATH: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_profile_path(to , new_string, PDB_CHANGED);
@@ -341,7 +341,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_acct_desc.buffer) {
old_string = pdb_get_acct_desc(to);
- new_string = pdb_unistr2_convert(&from->uni_acct_desc);
+ new_string = unistr2_static(&from->uni_acct_desc);
DEBUG(10,("INFO_23 UNI_ACCT_DESC: %s -> %s\n",old_string,new_string));
if (STRING_CHANGED)
pdb_set_acct_desc(to , new_string, PDB_CHANGED);
@@ -349,7 +349,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_workstations.buffer) {
old_string = pdb_get_workstations(to);
- new_string = pdb_unistr2_convert(&from->uni_workstations);
+ new_string = unistr2_static(&from->uni_workstations);
DEBUG(10,("INFO_23 UNI_WORKSTATIONS: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_workstations(to , new_string, PDB_CHANGED);
@@ -357,7 +357,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_unknown_str.buffer) {
old_string = pdb_get_unknown_str(to);
- new_string = pdb_unistr2_convert(&from->uni_unknown_str);
+ new_string = unistr2_static(&from->uni_unknown_str);
DEBUG(10,("INFO_23 UNI_UNKNOWN_STR: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_unknown_str(to , new_string, PDB_CHANGED);
@@ -365,7 +365,7 @@ void copy_id23_to_sam_passwd(SAM_ACCOUNT *to, SAM_USER_INFO_23 *from)
if (from->hdr_munged_dial.buffer) {
old_string = pdb_get_munged_dial(to);
- new_string = pdb_unistr2_convert(&from->uni_munged_dial);
+ new_string = unistr2_static(&from->uni_munged_dial);
DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string));
if (STRING_CHANGED)
pdb_set_munged_dial(to , new_string, PDB_CHANGED);