summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-03-13 06:55:47 +0000
committerAndrew Tridgell <tridge@samba.org>2001-03-13 06:55:47 +0000
commit20dd1f74893e9ea0a2a4ef21ec5e1b02eb9e504d (patch)
tree023d3ba2014ba0647d597a82d611d0d21ca59367 /source3/smbd
parenta7d2f5b06379cb0c553cd2d9a7c58e2cb8902965 (diff)
downloadsamba-20dd1f74893e9ea0a2a4ef21ec5e1b02eb9e504d.tar.gz
samba-20dd1f74893e9ea0a2a4ef21ec5e1b02eb9e504d.tar.bz2
samba-20dd1f74893e9ea0a2a4ef21ec5e1b02eb9e504d.zip
converted reply_tcon()
(This used to be commit 1e92d340ceb5be8e7d50cc7c889b2053ed67bad3)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c62
1 files changed, 22 insertions, 40 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index a401be1357..230b3db750 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -167,41 +167,6 @@ static int connection_error(char *inbuf,char *outbuf,int ecode)
}
-
-/****************************************************************************
- parse a share descriptor string
-****************************************************************************/
-static void parse_connect(char *p,char *service,char *user,
- char *password,int *pwlen,char *dev)
-{
- char *p2;
-
- DEBUG(4,("parsing connect string %s\n",p));
-
- p2 = strrchr(p,'\\');
- if (p2 == NULL)
- fstrcpy(service,p);
- else
- fstrcpy(service,p2+1);
-
- p += strlen(p) + 2;
-
- fstrcpy(password,p);
- *pwlen = strlen(password);
-
- p += strlen(p) + 2;
-
- fstrcpy(dev,p);
-
- *user = 0;
- p = strchr(service,'%');
- if (p != NULL)
- {
- *p = 0;
- fstrcpy(user,p+1);
- }
-}
-
/****************************************************************************
Reply to a tcon.
****************************************************************************/
@@ -218,17 +183,34 @@ int reply_tcon(connection_struct *conn,
uint16 vuid = SVAL(inbuf,smb_uid);
int pwlen=0;
int ecode = -1;
+ char *p;
+
START_PROFILE(SMBtcon);
*service = *user = *password = *dev = 0;
- parse_connect(smb_buf(inbuf)+1,service,user,password,&pwlen,dev);
+ p = smb_buf(inbuf)+1;
+ p += srvstr_pull(inbuf, service, p, sizeof(service), -1, STR_TERMINATE|STR_CONVERT) + 1;
+ p += srvstr_pull(inbuf, password, p, sizeof(password), -1, STR_TERMINATE|STR_CONVERT) + 1;
+ p += srvstr_pull(inbuf, dev, p, sizeof(dev), -1, STR_TERMINATE|STR_CONVERT) + 1;
- /*
- * Ensure the user and password names are in UNIX codepage format.
- */
+ *user = 0;
+ p = strchr(service,'%');
+ if (p != NULL) {
+ *p = 0;
+ fstrcpy(user,p+1);
+ }
- dos_to_unix(user,True);
+ p = strrchr(service,'\\');
+ if (p) {
+ pstrcpy(service, p+1);
+ }
+
+ /*
+ * Ensure the user and password names are in UNIX codepage format.
+ */
+
+ dos_to_unix(user,True);
if (!doencrypt)
dos_to_unix(password,True);