Ignore:
Timestamp:
May 23, 2008, 6:56:41 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.29

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/smbd/msdfs.c

    r62 r134  
    3434 We cope with either here.
    3535
     36 If conn != NULL then ensure the provided service is
     37 the one pointed to by the connection.
     38
    3639 Unfortunately, due to broken clients who might set the
    3740 SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES bit and then
     
    4144**********************************************************************/
    4245
    43 static NTSTATUS parse_dfs_path(const char *pathname,
     46static NTSTATUS parse_dfs_path(connection_struct *conn,
     47                                const char *pathname,
    4448                                BOOL allow_wcards,
    4549                                struct dfs_path *pdp,
     
    4751{
    4852        pstring pathname_local;
    49         char *p,*temp;
     53        char *p,*temp, *servicename;
    5054        NTSTATUS status = NT_STATUS_OK;
    5155        char sepchar;
     
    107111        DEBUG(10,("parse_dfs_path: hostname: %s\n",pdp->hostname));
    108112
    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
    115129                /*
    116130                 * Possibly client sent a local path by mistake.
     
    121135                pdp->servicename[0] = '\0';
    122136
     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
    123145                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",
    125148                        temp));
    126149                goto local_path;
    127150        }
    128151
    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
    132156        if(p == NULL) {
    133                 fstrcpy(pdp->servicename,temp);
    134157                pdp->reqpath[0] = '\0';
    135158                return NT_STATUS_OK;
    136159        }
    137         *p = '\0';
    138         fstrcpy(pdp->servicename,temp);
    139         DEBUG(10,("parse_dfs_path: servicename: %s\n",pdp->servicename));
    140 
    141160        p++;
    142161
     
    497516        pstring targetpath;
    498517       
    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);
    500519        if (!NT_STATUS_IS_OK(status)) {
    501520                return status;
     
    522541                pstrcpy(dfs_path, dp.reqpath);
    523542                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;
    533543        }
    534544
     
    606616        *self_referralp = False;
    607617
    608         status = parse_dfs_path(dfs_path, False, &dp, &dummy);
     618        status = parse_dfs_path(NULL, dfs_path, False, &dp, &dummy);
    609619        if (!NT_STATUS_IS_OK(status)) {
    610620                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;
    618621        }
    619622
     
    10091012        struct dfs_path dp;
    10101013 
    1011         NTSTATUS status = parse_dfs_path(dfs_path, False, &dp, &dummy);
     1014        NTSTATUS status = parse_dfs_path(NULL, dfs_path, False, &dp, &dummy);
    10121015
    10131016        if (!NT_STATUS_IS_OK(status)) {
Note: See TracChangeset for help on using the changeset viewer.