libsmbclient: '@' can occur in filename

Ong Kian Win codegrunt at rubbercookie.com
Tue Oct 16 12:34:25 GMT 2001


[libsmbclient.c]

If @ occurs as part of a filename in a smb path, smbc_parse_path will
mistakenly parse out the username.

For example:
smb://computer/share/email@domain.com.bkp/mail is a valid path. However,
smbc_parse_path would treat computer/share/email as the username and
domain.com.bkp as the computer name instead.

Regards,
Kian Win

---snip---

*** libsmbclient.c.bkp  Tue Oct 16 22:32:29 2001
--- libsmbclient.c      Wed Oct 17 01:14:03 2001
***************
*** 94,97 ****
--- 94,98 ----
    char *p;
    int len;
+   char *q, *r;

    server[0] = share[0] = path[0] = user[0] = password[0] = (char)0;
***************
*** 134,138 ****
     */

!   if (strchr_m(p, '@')) {
      pstring username, passwd, domain;
      char *u = userinfo;
--- 135,142 ----
     */

!   /* check that '@' occurs before '/', if '/' exists at all */
!   q = strchr_m(p, '@');
!   r = strchr_m(p, '/');
!   if (q && (!r || q < r)) {
      pstring username, passwd, domain;
      char *u = userinfo;





More information about the samba-technical mailing list