summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-02-09 19:51:44 +0000
committerLuke Leighton <lkcl@samba.org>1999-02-09 19:51:44 +0000
commit748f296a76a76d38525ad35df6658811cae60222 (patch)
tree977f07b580b89f7f8494847e2fad36946679d51e
parent3b12477f34a4311235c7c0b2e9a9cdc9f5a4f0e9 (diff)
downloadsamba-748f296a76a76d38525ad35df6658811cae60222.tar.gz
samba-748f296a76a76d38525ad35df6658811cae60222.tar.bz2
samba-748f296a76a76d38525ad35df6658811cae60222.zip
removal of the use of unistrn2 function: replace it with unistr2_to_str
which is more appropriate. (This used to be commit ac72fe1ab3d10f64a5945ccbd4ed3817e30f9f7b)
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/lib/domain_namemap.c2
-rw-r--r--source3/rpc_client/cli_lsarpc.c8
-rw-r--r--source3/rpc_parse/parse_lsa.c5
-rw-r--r--source3/rpc_parse/parse_misc.c4
-rw-r--r--source3/rpc_server/srv_reg.c2
-rw-r--r--source3/rpc_server/srv_samr.c7
-rw-r--r--source3/rpcclient/display.c50
8 files changed, 39 insertions, 43 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 8f2d73f95f..2ed35ee0af 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/lib/domain_namemap.c b/source3/lib/domain_namemap.c
index f095c8d764..892263f084 100644
--- a/source3/lib/domain_namemap.c
+++ b/source3/lib/domain_namemap.c
@@ -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));
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 6f78f308dd..4c55572b62 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -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)
{
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
index 239c0847af..cb88e71536 100644
--- a/source3/rpc_parse/parse_lsa.c
+++ b/source3/rpc_parse/parse_lsa.c
@@ -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;
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index e1a7d3c6a5..bf3bba1249 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -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);
}
/*******************************************************************
diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c
index b90912488f..f98133626d 100644
--- a/source3/rpc_server/srv_reg.c
+++ b/source3/rpc_server/srv_reg.c
@@ -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)
{
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 1fb64c10ef..8961660071 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -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);
diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c
index d37b7283f8..173a42bf73 100644
--- a/source3/rpcclient/display.c
+++ b/source3/rpcclient/display.c
@@ -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 ))));