mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
Following info from TAKAHASHI Motonobu <monyo@samba.gr.jp>,
Samba Users Group Japan, ensure that we don't use dos_to_unix(xx,True), but always use dos_to_unix(xx,False) to prevent overwriting. Jeremy.
This commit is contained in:
parent
05a2911403
commit
244aec8ea6
@ -179,9 +179,12 @@ int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, co
|
||||
int type = SVAL(p,14);
|
||||
int comment_offset = IVAL(p,16) & 0xFFFF;
|
||||
char *cmnt = comment_offset?(rdata+comment_offset-converter):"";
|
||||
dos_to_unix(sname,True);
|
||||
dos_to_unix(cmnt,True);
|
||||
fn(sname, type, cmnt, state);
|
||||
pstring s1, s2;
|
||||
|
||||
pstrcpy(s1, dos_to_unix(sname, False));
|
||||
pstrcpy(s2, dos_to_unix(cmnt, False));
|
||||
|
||||
fn(s1, type, s2, state);
|
||||
}
|
||||
} else {
|
||||
DEBUG(4,("NetShareEnum res=%d\n", res));
|
||||
@ -256,13 +259,15 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
|
||||
char *sname = p;
|
||||
int comment_offset = (IVAL(p,22) & 0xFFFF)-converter;
|
||||
char *cmnt = comment_offset?(rdata+comment_offset):"";
|
||||
pstring s1, s2;
|
||||
|
||||
if (comment_offset < 0 || comment_offset > rdrcnt) continue;
|
||||
|
||||
stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
|
||||
|
||||
dos_to_unix(sname, True);
|
||||
dos_to_unix(cmnt, True);
|
||||
fn(sname, stype, cmnt, state);
|
||||
pstrcpy(s1, dos_to_unix(sname, False));
|
||||
pstrcpy(s2, dos_to_unix(cmnt, False));
|
||||
fn(s1, stype, s2, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,8 @@ int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len
|
||||
memcpy(dest, src, len);
|
||||
dest[len] = 0;
|
||||
}
|
||||
if (flags & STR_CONVERT) dos_to_unix(dest,True);
|
||||
if (flags & STR_CONVERT)
|
||||
safe_strcpy(dest,dos_to_unix(dest,False),dest_len);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -129,7 +130,8 @@ int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len
|
||||
*dest++ = 0;
|
||||
len = src_len;
|
||||
}
|
||||
if (flags & STR_CONVERT) dos_to_unix(dest,True);
|
||||
if (flags & STR_CONVERT)
|
||||
safe_strcpy(dest,dos_to_unix(dest,False),dest_len);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -61,13 +61,12 @@ static void msg_deliver(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Incoming message is in DOS codepage format. Convert to UNIX in
|
||||
* place.
|
||||
* Incoming message is in DOS codepage format. Convert to UNIX.
|
||||
*/
|
||||
|
||||
if(msgpos > 0) {
|
||||
msgbuf[msgpos] = '\0'; /* Ensure null terminated. */
|
||||
dos_to_unix(msgbuf,True);
|
||||
pstrcpy(msgbuf,dos_to_unix(msgbuf,False));
|
||||
}
|
||||
|
||||
for (i=0;i<msgpos;) {
|
||||
|
@ -209,9 +209,9 @@ int reply_tcon(connection_struct *conn,
|
||||
* Ensure the user and password names are in UNIX codepage format.
|
||||
*/
|
||||
|
||||
dos_to_unix(user,True);
|
||||
pstrcpy(user,dos_to_unix(user,False));
|
||||
if (!doencrypt)
|
||||
dos_to_unix(password,True);
|
||||
pstrcpy(password,dos_to_unix(password,False));
|
||||
|
||||
/*
|
||||
* Pass the user through the NT -> unix user mapping
|
||||
@ -797,8 +797,8 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
|
||||
* Ensure the plaintext passwords are in UNIX format.
|
||||
*/
|
||||
if(!doencrypt) {
|
||||
dos_to_unix(smb_apasswd,True);
|
||||
dos_to_unix(smb_ntpasswd,True);
|
||||
pstrcpy(smb_apasswd,dos_to_unix(smb_apasswd,False));
|
||||
pstrcpy(smb_ntpasswd,dos_to_unix(smb_ntpasswd,False));
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -808,7 +808,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int
|
||||
/*
|
||||
* Ensure the plaintext password is in UNIX format.
|
||||
*/
|
||||
dos_to_unix(smb_apasswd,True);
|
||||
pstrcpy(smb_apasswd,dos_to_unix(smb_apasswd,False));
|
||||
|
||||
/* trim the password */
|
||||
smb_apasslen = strlen(smb_apasswd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user