Changeset 134 for branches/samba-3.0/source/smbd/msdfs.c
- Timestamp:
- May 23, 2008, 6:56:41 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/smbd/msdfs.c
r62 r134 34 34 We cope with either here. 35 35 36 If conn != NULL then ensure the provided service is 37 the one pointed to by the connection. 38 36 39 Unfortunately, due to broken clients who might set the 37 40 SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES bit and then … … 41 44 **********************************************************************/ 42 45 43 static NTSTATUS parse_dfs_path(const char *pathname, 46 static NTSTATUS parse_dfs_path(connection_struct *conn, 47 const char *pathname, 44 48 BOOL allow_wcards, 45 49 struct dfs_path *pdp, … … 47 51 { 48 52 pstring pathname_local; 49 char *p,*temp ;53 char *p,*temp, *servicename; 50 54 NTSTATUS status = NT_STATUS_OK; 51 55 char sepchar; … … 107 111 DEBUG(10,("parse_dfs_path: hostname: %s\n",pdp->hostname)); 108 112 109 /* If we got a hostname, is it ours (or an IP address) ? */ 110 if (!is_myname_or_ipaddr(pdp->hostname)) { 111 /* Repair path. */ 112 *p = sepchar; 113 DEBUG(10,("parse_dfs_path: hostname %s isn't ours. Try local path from path %s\n", 114 pdp->hostname, temp)); 113 /* Parse out servicename. */ 114 servicename = p+1; 115 p = strchr_m(servicename,sepchar); 116 if (p) { 117 *p = '\0'; 118 } 119 120 /* Is this really our servicename ? */ 121 if (conn && !( strequal(servicename, lp_servicename(SNUM(conn))) 122 || (strequal(servicename, HOMES_NAME) 123 && strequal(lp_servicename(SNUM(conn)), 124 get_current_username()) )) ) { 125 126 DEBUG(10,("parse_dfs_path: %s is not our servicename\n", 127 servicename)); 128 115 129 /* 116 130 * Possibly client sent a local path by mistake. … … 121 135 pdp->servicename[0] = '\0'; 122 136 137 /* Repair the path - replace the sepchar's 138 we nulled out */ 139 servicename--; 140 *servicename = sepchar; 141 if (p) { 142 *p = sepchar; 143 } 144 123 145 p = temp; 124 DEBUG(10,("parse_dfs_path: trying to convert %s to a local path\n", 146 DEBUG(10,("parse_dfs_path: trying to convert %s " 147 "to a local path\n", 125 148 temp)); 126 149 goto local_path; 127 150 } 128 151 129 /* Parse out servicename. */ 130 temp = p+1; 131 p = strchr_m(temp,sepchar); 152 fstrcpy(pdp->servicename,servicename); 153 154 DEBUG(10,("parse_dfs_path: servicename: %s\n",pdp->servicename)); 155 132 156 if(p == NULL) { 133 fstrcpy(pdp->servicename,temp);134 157 pdp->reqpath[0] = '\0'; 135 158 return NT_STATUS_OK; 136 159 } 137 *p = '\0';138 fstrcpy(pdp->servicename,temp);139 DEBUG(10,("parse_dfs_path: servicename: %s\n",pdp->servicename));140 141 160 p++; 142 161 … … 497 516 pstring targetpath; 498 517 499 status = parse_dfs_path( dfs_path, search_wcard_flag, &dp, ppath_contains_wcard);518 status = parse_dfs_path(conn, dfs_path, search_wcard_flag, &dp, ppath_contains_wcard); 500 519 if (!NT_STATUS_IS_OK(status)) { 501 520 return status; … … 522 541 pstrcpy(dfs_path, dp.reqpath); 523 542 return NT_STATUS_OK; 524 }525 526 if (!( strequal(dp.servicename, lp_servicename(SNUM(conn)))527 || (strequal(dp.servicename, HOMES_NAME)528 && strequal(lp_servicename(SNUM(conn)), get_current_username()) )) ) {529 530 /* The given sharename doesn't match this connection. */531 532 return NT_STATUS_OBJECT_PATH_NOT_FOUND;533 543 } 534 544 … … 606 616 *self_referralp = False; 607 617 608 status = parse_dfs_path( dfs_path, False, &dp, &dummy);618 status = parse_dfs_path(NULL, dfs_path, False, &dp, &dummy); 609 619 if (!NT_STATUS_IS_OK(status)) { 610 620 return status; 611 }612 613 /* Verify hostname in path */614 if (!is_myname_or_ipaddr(dp.hostname)) {615 DEBUG(3, ("get_referred_path: Invalid hostname %s in path %s\n",616 dp.hostname, dfs_path));617 return NT_STATUS_NOT_FOUND;618 621 } 619 622 … … 1009 1012 struct dfs_path dp; 1010 1013 1011 NTSTATUS status = parse_dfs_path( dfs_path, False, &dp, &dummy);1014 NTSTATUS status = parse_dfs_path(NULL, dfs_path, False, &dp, &dummy); 1012 1015 1013 1016 if (!NT_STATUS_IS_OK(status)) {
Note:
See TracChangeset
for help on using the changeset viewer.