mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
Merge from HEAD - we already have one function for converting a unistr2 to a
static 'unix' string, so we don't need a second pdb specific version.
Andrew Bartlett
(This used to be commit 91ca4771c6
)
This commit is contained in:
parent
3bc3fabee2
commit
302bffc08f
@ -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;
|
||||
}
|
||||
|
@ -989,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.
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user