Fix dfs referrals - don't use check_path_syntax. Also use mb char calls in
authorJeremy Allison <jra@samba.org>
Tue, 9 Mar 2004 23:26:58 +0000 (23:26 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 9 Mar 2004 23:26:58 +0000 (23:26 +0000)
dfs code.
Jeremy.

source/msdfs/msdfs.c
source/smbd/trans2.c

index cd8375605613bff4a37a3b23555e125a4da35747..081ce809cf85234bffc240873baf29d43cd7a2ff 100644 (file)
@@ -45,7 +45,7 @@ static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
 
        /* now tokenize */
        /* parse out hostname */
-       p = strchr(temp,'\\');
+       p = strchr_m(temp,'\\');
        if(p == NULL)
                return False;
        *p = '\0';
@@ -54,7 +54,7 @@ static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
 
        /* parse out servicename */
        temp = p+1;
-       p = strchr(temp,'\\');
+       p = strchr_m(temp,'\\');
        if(p == NULL) {
                pstrcpy(pdp->servicename,temp);
                pdp->reqpath[0] = '\0';
@@ -67,9 +67,8 @@ static BOOL parse_dfs_path(char* pathname, struct dfs_path* pdp)
        /* rest is reqpath */
        pstrcpy(pdp->reqpath, p+1);
        p = pdp->reqpath;
-       while (*p) {
-               if (*p == '\\') *p = '/';
-               p++;
+       while ((p = strchr_m(p, '\\'))!=NULL) {
+               *p++ = '/';
        }
 
        DEBUG(10,("rest of the path: %s\n",pdp->reqpath));
@@ -148,7 +147,7 @@ static BOOL parse_symlink(char* buf,struct referral** preflist,
        
        for(i=0;i<count;i++) {
                /* replace / in the alternate path by a \ */
-               char* p = strchr(alt_path[i],'/');
+               char* p = strchr_m(alt_path[i],'/');
                if(p)
                        *p = '\\'; 
 
@@ -270,7 +269,7 @@ static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp,
 
        /* redirect if any component in the path is a link */
        pstrcpy(reqpath, dp->reqpath);
-       p = strrchr(reqpath, '/');
+       p = strrchr_m(reqpath, '/');
        while (p) {
                *p = '\0';
                pstrcpy(localpath, reqpath);
@@ -288,7 +287,7 @@ static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp,
                                pstrcpy(buf, dfspath);
                                trim_char(buf, '\0', '\\');
                                for (; consumed_level; consumed_level--) {
-                                       q = strrchr(buf, '\\');
+                                       q = strrchr_m(buf, '\\');
                                        if (q)
                                                *q = 0;
                                }
@@ -298,7 +297,7 @@ static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp,
                        
                        return True;
                }
-               p = strrchr(reqpath, '/');
+               p = strrchr_m(reqpath, '/');
                consumed_level++;
        }
        
@@ -526,7 +525,7 @@ static int setup_ver2_dfs_referral(char* pathname, char** ppdata,
        offset = 8;
        /* add the referral elements */
        for(i=0;i<junction->referral_count;i++) {
-               struct referral* ref = &(junction->referral_list[i]);
+               struct referral* ref = &junction->referral_list[i];
                int unilen;
 
                SSVAL(pdata,offset,2); /* version 2 */
index 38fed4beae223935b7b14a7aa99a6662007766a0..19269cbc6cc739dbadddefde19e1b21fdc6e5e64 100644 (file)
@@ -3390,7 +3390,6 @@ static int call_trans2getdfsreferral(connection_struct *conn, char* inbuf,
        pstring pathname;
        int reply_size = 0;
        int max_referral_level;
-       NTSTATUS status = NT_STATUS_OK;
 
        DEBUG(10,("call_trans2getdfsreferral\n"));
 
@@ -3402,11 +3401,7 @@ static int call_trans2getdfsreferral(connection_struct *conn, char* inbuf,
        if(!lp_host_msdfs())
                return ERROR_DOS(ERRDOS,ERRbadfunc);
 
-       srvstr_get_path(inbuf, pathname, &params[2], sizeof(pathname), -1, STR_TERMINATE, &status);
-       if (!NT_STATUS_IS_OK(status)) {
-               return ERROR_NT(status);
-       }
-
+       srvstr_pull(inbuf, pathname, &params[2], sizeof(pathname), -1, STR_TERMINATE);
        if((reply_size = setup_dfs_referral(conn, pathname,max_referral_level,ppdata)) < 0)
                return UNIXERROR(ERRDOS,ERRbadfile);