diff options
author | Jeremy Allison <jra@samba.org> | 2000-03-22 20:39:31 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-03-22 20:39:31 +0000 |
commit | 6814d0f45689d2a17af3d95511208421d10f5fce (patch) | |
tree | a4ae5be71672b98f19d3319af45bd82312bbb6f4 /source3 | |
parent | 8f1620125dcb9c29c223f4efb6485528ece70f11 (diff) | |
download | samba-6814d0f45689d2a17af3d95511208421d10f5fce.tar.gz samba-6814d0f45689d2a17af3d95511208421d10f5fce.tar.bz2 samba-6814d0f45689d2a17af3d95511208421d10f5fce.zip |
Correctly convert from little-endian UNICODE to dos_codepage when doing
secure file create.
Jeremy.
(This used to be commit 90134dd13721f60d4fb05ce9434b65e95ff09629)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 34 | ||||
-rw-r--r-- | source3/lib/util_unistr.c | 2 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 21 |
3 files changed, 24 insertions, 33 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 27d3de49b8..0b911b00ca 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1442,8 +1442,8 @@ struct passdb_ops *nisplus_initialize_password_db(void); /*The following definitions come from passdb/pass_check.c */ void dfs_unlogin(void); -BOOL pass_check(char *user,char *password, int pwlen, struct passwd *pwd, - BOOL (*fn)(char *, char *)); +BOOL pass_check(char *user, char *password, int pwlen, struct passwd *pwd, + BOOL (*fn) (char *, char *)); /*The following definitions come from passdb/passdb.c */ @@ -2865,22 +2865,24 @@ void process_blocking_lock_queue(time_t t); /*The following definitions come from smbd/chgpasswd.c */ -BOOL chgpasswd(char *name,char *oldpass,char *newpass, BOOL as_root); -BOOL chgpasswd(char *name,char *oldpass,char *newpass, BOOL as_root); -BOOL check_lanman_password(char *user, uchar *pass1, - uchar *pass2, struct smb_passwd **psmbpw); -BOOL change_lanman_password(struct smb_passwd *smbpw, uchar *pass1, uchar *pass2); +BOOL chgpasswd(char *name, char *oldpass, char *newpass, BOOL as_root); +BOOL chgpasswd(char *name, char *oldpass, char *newpass, BOOL as_root); +BOOL check_lanman_password(char *user, uchar * pass1, + uchar * pass2, struct smb_passwd **psmbpw); +BOOL change_lanman_password(struct smb_passwd *smbpw, uchar * pass1, + uchar * pass2); BOOL pass_oem_change(char *user, - uchar *lmdata, uchar *lmhash, - uchar *ntdata, uchar *nthash); + uchar * lmdata, uchar * lmhash, + uchar * ntdata, uchar * nthash); BOOL check_oem_password(char *user, - uchar *lmdata, uchar *lmhash, - uchar *ntdata, uchar *nthash, - struct smb_passwd **psmbpw, char *new_passwd, - int new_passwd_size); -BOOL change_oem_password(struct smb_passwd *smbpw, char *new_passwd, BOOL override); -BOOL check_plaintext_password(char *user,char *old_passwd, - int old_passwd_size, struct smb_passwd **psmbpw); + uchar * lmdata, uchar * lmhash, + uchar * ntdata, uchar * nthash, + struct smb_passwd **psmbpw, char *new_passwd, + int new_passwd_size); +BOOL change_oem_password(struct smb_passwd *smbpw, char *new_passwd, + BOOL override); +BOOL check_plaintext_password(char *user, char *old_passwd, + int old_passwd_size, struct smb_passwd **psmbpw); /*The following definitions come from smbd/close.c */ diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index c981aba51a..27bd615bf4 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -149,6 +149,8 @@ char *skip_unicode_string(char *buf,int n) /******************************************************************* Return a DOS codepage version of a little-endian unicode string. + len is the filename length (ignoring any terminating zero) in uin16 + units. Always null terminates. Hack alert: uses fixed buffer(s). ********************************************************************/ diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 05d9c82c38..1a43350e90 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -244,19 +244,6 @@ static int send_nt_replies(char *inbuf, char *outbuf, int bufsize, uint32 nt_err strings in NT calls AND DOESN'T SET THE UNICODE BIT !!!!!!! ****************************************************************************/ -static void my_wcstombs(char *dst, uint16 *src, size_t len) -{ - size_t i; - - for(i = 0; i < len; i++) - dst[i] = (char)SVAL(src,i*2); -} - -/**************************************************************************** - (Hopefully) temporary call to fix bugs in NT5.0beta2. This OS sends unicode - strings in NT calls AND DOESN'T SET THE UNICODE BIT !!!!!!! -****************************************************************************/ - static void get_filename( char *fname, char *inbuf, int data_offset, int data_len, int fname_len) { /* @@ -277,11 +264,11 @@ static void get_filename( char *fname, char *inbuf, int data_offset, int data_le fname_len = fname_len/2; if(data_offset & 1) data_offset++; - my_wcstombs( fname, (uint16 *)(inbuf+data_offset), fname_len); + pstrcpy(fname, dos_unistrn2((uint16 *)(inbuf+data_offset), fname_len)); } else { StrnCpy(fname,inbuf+data_offset,fname_len); + fname[fname_len] = '\0'; } - fname[fname_len] = '\0'; } /**************************************************************************** @@ -312,11 +299,11 @@ static void get_filename_transact( char *fname, char *inbuf, int data_offset, in fname_len = fname_len/2; if(data_offset & 1) data_offset++; - my_wcstombs( fname, (uint16 *)(inbuf+data_offset), fname_len); + pstrcpy(fname, dos_unistrn2((uint16 *)(inbuf+data_offset), fname_len)); } else { StrnCpy(fname,inbuf+data_offset,fname_len); + fname[fname_len] = '\0'; } - fname[fname_len] = '\0'; } /**************************************************************************** |