1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

removal of the use of unistrn2 function: replace it with unistr2_to_str

which is more appropriate.
(This used to be commit ac72fe1ab3)
This commit is contained in:
Luke Leighton 1999-02-09 19:51:44 +00:00
parent 3b12477f34
commit 748f296a76
8 changed files with 39 additions and 43 deletions

View File

@ -185,7 +185,7 @@ BOOL map_alias_sid(DOM_SID *psid, DOM_NAME_MAP *grp_info);
BOOL map_group_sid(DOM_SID *psid, DOM_NAME_MAP *grp_info);
BOOL lookupsmbpwnam(const char *unix_usr_name, DOM_NAME_MAP *grp);
BOOL lookupsmbpwuid(uid_t uid, DOM_NAME_MAP *gmep);
BOOL lookupsmbpwntnam(char *fullntname, DOM_NAME_MAP *gmep);
BOOL lookupsmbpwntnam(const char *fullntname, DOM_NAME_MAP *gmep);
BOOL lookupsmbpwsid(DOM_SID *sid, DOM_NAME_MAP *gmep);
BOOL lookupsmbgrpnam(const char *unix_grp_name, DOM_NAME_MAP *grp);
BOOL lookupsmbgrpsid(DOM_SID *sid, DOM_NAME_MAP *gmep);
@ -1880,7 +1880,7 @@ void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf);
void copy_unistr2(UNISTR2 *str, UNISTR2 *from);
void make_string2(STRING2 *str, char *buf, int len);
void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth);
void make_unistr2(UNISTR2 *str, char *buf, int len);
void make_unistr2(UNISTR2 *str, const char *buf, int len);
void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth);
void make_dom_rid2(DOM_RID2 *rid2, uint32 rid, uint8 type, uint32 idx);
void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth);

View File

@ -1070,7 +1070,7 @@ BOOL lookupsmbpwuid(uid_t uid, DOM_NAME_MAP *gmep)
/*************************************************************************
looks up by NT name, returns User Information.
*************************************************************************/
BOOL lookupsmbpwntnam(char *fullntname, DOM_NAME_MAP *gmep)
BOOL lookupsmbpwntnam(const char *fullntname, DOM_NAME_MAP *gmep)
{
DEBUG(10,("lookupsmbpwntnam: nt user name %s\n", fullntname));

View File

@ -427,9 +427,7 @@ BOOL lsa_query_info_pol(struct cli_state *cli, uint16 fnum,
{
if (r_q.dom.id3.buffer_dom_name != 0)
{
char *dom_name = unistrn2(r_q.dom.id3.uni_domain_name.buffer,
r_q.dom.id3.uni_domain_name.uni_str_len);
fstrcpy(domain_name, dom_name);
fstrcpy(domain_name, unistr2_to_str(&r_q.dom.id3.uni_domain_name));
}
if (r_q.dom.id3.buffer_dom_sid != 0)
{
@ -443,9 +441,7 @@ BOOL lsa_query_info_pol(struct cli_state *cli, uint16 fnum,
{
if (r_q.dom.id5.buffer_dom_name != 0)
{
char *dom_name = unistrn2(r_q.dom.id5.uni_domain_name.buffer,
r_q.dom.id5.uni_domain_name.uni_str_len);
fstrcpy(domain_name, dom_name);
fstrcpy(domain_name, unistr2_to_str(&r_q.dom.id5.uni_domain_name));
}
if (r_q.dom.id5.buffer_dom_sid != 0)
{

View File

@ -688,9 +688,10 @@ void make_q_lookup_names(LSA_Q_LOOKUP_NAMES *q_l, POLICY_HND *hnd,
for (i = 0; i < num_names; i++)
{
int len = strlen(names[i]);
const char* name = names[i];
int len = strlen(name);
make_uni_hdr(&q_l->hdr_name[i], len, len, len != 0);
make_unistr2(&q_l->uni_name[i], names[i], len);
make_unistr2(&q_l->uni_name[i], name, len);
}
q_l->num_trans_entries = 0;

View File

@ -563,7 +563,7 @@ void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, i
/*******************************************************************
creates a UNISTR2 structure.
********************************************************************/
void make_unistr2(UNISTR2 *str, char *buf, int len)
void make_unistr2(UNISTR2 *str, const char *buf, int len)
{
ZERO_STRUCTP(str);
@ -573,7 +573,7 @@ void make_unistr2(UNISTR2 *str, char *buf, int len)
str->uni_str_len = len;
/* store the string (null-terminated 8 bit chars into 16 bit chars) */
struni2((char *)(str->buffer), buf);
struni2((char*)(str->buffer), buf);
}
/*******************************************************************

View File

@ -136,7 +136,7 @@ static void reg_reply_open_entry(REG_Q_OPEN_ENTRY *q_u,
status = 0xC000000 | NT_STATUS_TOO_MANY_SECRETS; /* ha ha very droll */
}
fstrcpy(name, unistrn2(q_u->uni_name.buffer, q_u->uni_name.uni_str_len));
fstrcpy(name, unistr2_to_str(&q_u->uni_name));
if (status == 0x0)
{

View File

@ -1527,8 +1527,8 @@ static void samr_reply_chgpasswd_user(SAMR_Q_CHGPASSWD_USER *q_u,
fstring user_name;
fstring wks;
fstrcpy(user_name, unistrn2(q_u->uni_user_name.buffer, q_u->uni_user_name.uni_str_len));
fstrcpy(wks , unistrn2(q_u->uni_dest_host.buffer, q_u->uni_dest_host.uni_str_len));
fstrcpy(user_name, unistr2_to_str(&q_u->uni_user_name));
fstrcpy(wks , unistr2_to_str(&q_u->uni_dest_host));
DEBUG(5,("samr_chgpasswd_user: user: %s wks: %s\n", user_name, wks));
@ -2340,8 +2340,7 @@ static void api_samr_unknown_32( uint16 vuid, prs_struct *data, prs_struct *rdat
reply if the account already exists...
*/
fstrcpy(mach_acct, unistrn2(q_u.uni_mach_acct.buffer,
q_u.uni_mach_acct.uni_str_len));
fstrcpy(mach_acct, unistr2_to_str(&q_u.uni_mach_acct));
become_root(True);
sam_pass = getsam21pwntnam(mach_acct);

View File

@ -192,8 +192,8 @@ void display_srv_info_101(FILE *out_hnd, enum action_type action,
fstring name;
fstring comment;
fstrcpy(name , unistrn2(sv101->uni_name .buffer, sv101->uni_name .uni_str_len));
fstrcpy(comment , unistrn2(sv101->uni_comment .buffer, sv101->uni_comment .uni_str_len));
fstrcpy(name , unistr2_to_str(&sv101->uni_name ));
fstrcpy(comment , unistr2_to_str(&sv101->uni_comment ));
display_server(out_hnd, action, name, sv101->srv_type, comment);
@ -234,9 +234,9 @@ void display_srv_info_102(FILE *out_hnd, enum action_type action,SRV_INFO_102 *s
fstring comment;
fstring usr_path;
fstrcpy(name , unistrn2(sv102->uni_name .buffer, sv102->uni_name .uni_str_len));
fstrcpy(comment , unistrn2(sv102->uni_comment .buffer, sv102->uni_comment .uni_str_len));
fstrcpy(usr_path, unistrn2(sv102->uni_usr_path.buffer, sv102->uni_usr_path.uni_str_len));
fstrcpy(name , unistr2_to_str(&sv102->uni_name ));
fstrcpy(comment , unistr2_to_str(&sv102->uni_comment ));
fstrcpy(usr_path, unistr2_to_str(&sv102->uni_usr_path));
display_server(out_hnd, action, name, sv102->srv_type, comment);
@ -347,8 +347,8 @@ void display_conn_info_1(FILE *out_hnd, enum action_type action,
fstring usr_name;
fstring net_name;
fstrcpy(usr_name, unistrn2(str1->uni_usr_name.buffer, str1->uni_usr_name.uni_str_len));
fstrcpy(net_name, unistrn2(str1->uni_net_name.buffer, str1->uni_net_name.uni_str_len));
fstrcpy(usr_name, unistr2_to_str(&str1->uni_usr_name));
fstrcpy(net_name, unistr2_to_str(&str1->uni_net_name));
fprintf(out_hnd, "\tid :\t%d\n", info1->id);
fprintf(out_hnd, "\ttype :\t%s\n", get_share_type_str(info1->type));
@ -503,8 +503,8 @@ void display_share_info_1(FILE *out_hnd, enum action_type action,
fstring remark ;
fstring net_name;
fstrcpy(net_name, unistrn2(str1->uni_netname.buffer, str1->uni_netname.uni_str_len));
fstrcpy(remark , unistrn2(str1->uni_remark .buffer, str1->uni_remark .uni_str_len));
fstrcpy(net_name, unistr2_to_str(&str1->uni_netname));
fstrcpy(remark , unistr2_to_str(&str1->uni_remark ));
display_share(out_hnd, action, net_name, info1->type, remark);
@ -545,10 +545,10 @@ void display_share_info_2(FILE *out_hnd, enum action_type action,
fstring path ;
fstring passwd ;
fstrcpy(net_name, unistrn2(str2->uni_netname.buffer, str2->uni_netname.uni_str_len));
fstrcpy(remark , unistrn2(str2->uni_remark .buffer, str2->uni_remark .uni_str_len));
fstrcpy(path , unistrn2(str2->uni_path .buffer, str2->uni_path .uni_str_len));
fstrcpy(passwd , unistrn2(str2->uni_passwd .buffer, str2->uni_passwd .uni_str_len));
fstrcpy(net_name, unistr2_to_str(&str2->uni_netname));
fstrcpy(remark , unistr2_to_str(&str2->uni_remark ));
fstrcpy(path , unistr2_to_str(&str2->uni_path ));
fstrcpy(passwd , unistr2_to_str(&str2->uni_passwd ));
display_share2(out_hnd, action, net_name, info2->type, remark,
info2->perms, info2->max_uses, info2->num_uses,
@ -698,8 +698,8 @@ void display_file_info_3(FILE *out_hnd, enum action_type action,
fstring path_name;
fstring user_name;
fstrcpy(path_name, unistrn2(str3->uni_path_name.buffer, str3->uni_path_name.uni_str_len));
fstrcpy(user_name, unistrn2(str3->uni_user_name.buffer, str3->uni_user_name.uni_str_len));
fstrcpy(path_name, unistr2_to_str(&str3->uni_path_name));
fstrcpy(user_name, unistr2_to_str(&str3->uni_user_name));
fprintf(out_hnd, "\tid :\t%d\n", info3->id);
fprintf(out_hnd, "\tperms :\t%s\n", get_file_mode_str(info3->perms));
@ -1148,16 +1148,16 @@ void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_I
}
case ACTION_ENUMERATE:
{
fprintf(out_hnd, "\t\tUser Name :\t%s\n", unistrn2(usr->uni_user_name .buffer, usr->uni_user_name .uni_str_len)); /* username unicode string */
fprintf(out_hnd, "\t\tFull Name :\t%s\n", unistrn2(usr->uni_full_name .buffer, usr->uni_full_name .uni_str_len)); /* user's full name unicode string */
fprintf(out_hnd, "\t\tHome Drive :\t%s\n", unistrn2(usr->uni_home_dir .buffer, usr->uni_home_dir .uni_str_len)); /* home directory unicode string */
fprintf(out_hnd, "\t\tDir Drive :\t%s\n", unistrn2(usr->uni_dir_drive .buffer, usr->uni_dir_drive .uni_str_len)); /* home directory drive unicode string */
fprintf(out_hnd, "\t\tProfile Path:\t%s\n", unistrn2(usr->uni_profile_path.buffer, usr->uni_profile_path.uni_str_len)); /* profile path unicode string */
fprintf(out_hnd, "\t\tLogon Script:\t%s\n", unistrn2(usr->uni_logon_script.buffer, usr->uni_logon_script.uni_str_len)); /* logon script unicode string */
fprintf(out_hnd, "\t\tDescription :\t%s\n", unistrn2(usr->uni_acct_desc .buffer, usr->uni_acct_desc .uni_str_len)); /* user description unicode string */
fprintf(out_hnd, "\t\tWorkstations:\t%s\n", unistrn2(usr->uni_workstations.buffer, usr->uni_workstations.uni_str_len)); /* workstaions unicode string */
fprintf(out_hnd, "\t\tUnknown Str :\t%s\n", unistrn2(usr->uni_unknown_str .buffer, usr->uni_unknown_str .uni_str_len)); /* unknown string unicode string */
fprintf(out_hnd, "\t\tRemote Dial :\t%s\n", unistrn2(usr->uni_munged_dial .buffer, usr->uni_munged_dial .uni_str_len)); /* munged remote access unicode string */
fprintf(out_hnd, "\t\tUser Name :\t%s\n", unistr2_to_str(&usr->uni_user_name )); /* username unicode string */
fprintf(out_hnd, "\t\tFull Name :\t%s\n", unistr2_to_str(&usr->uni_full_name )); /* user's full name unicode string */
fprintf(out_hnd, "\t\tHome Drive :\t%s\n", unistr2_to_str(&usr->uni_home_dir )); /* home directory unicode string */
fprintf(out_hnd, "\t\tDir Drive :\t%s\n", unistr2_to_str(&usr->uni_dir_drive )); /* home directory drive unicode string */
fprintf(out_hnd, "\t\tProfile Path:\t%s\n", unistr2_to_str(&usr->uni_profile_path)); /* profile path unicode string */
fprintf(out_hnd, "\t\tLogon Script:\t%s\n", unistr2_to_str(&usr->uni_logon_script)); /* logon script unicode string */
fprintf(out_hnd, "\t\tDescription :\t%s\n", unistr2_to_str(&usr->uni_acct_desc )); /* user description unicode string */
fprintf(out_hnd, "\t\tWorkstations:\t%s\n", unistr2_to_str(&usr->uni_workstations)); /* workstaions unicode string */
fprintf(out_hnd, "\t\tUnknown Str :\t%s\n", unistr2_to_str(&usr->uni_unknown_str )); /* unknown string unicode string */
fprintf(out_hnd, "\t\tRemote Dial :\t%s\n", unistr2_to_str(&usr->uni_munged_dial )); /* munged remote access unicode string */
fprintf(out_hnd, "\t\tLogon Time :\t%s\n", http_timestring(nt_time_to_unix(&(usr->logon_time ))));
fprintf(out_hnd, "\t\tLogoff Time :\t%s\n", http_timestring(nt_time_to_unix(&(usr->logoff_time ))));