Ignore:
Timestamp:
May 20, 2009, 6:46:53 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/libsmb/libsmb_xattr.c

    r133 r204  
    747747        uint16 mode = 0;
    748748        SMB_INO_T ino = 0;
    749         struct cli_state *cli = srv->cli;
     749        struct cli_state *cli = srv->cli;
    750750        struct {
    751751                const char * create_time_attr;
     
    884884         */
    885885        if (ipc_cli && (all || some_nt || all_nt_acls)) {
     886                char *targetpath = NULL;
     887                struct cli_state *targetcli = NULL;
     888
    886889                /* Point to the portion after "system.nt_sec_desc." */
    887890                name += 19;     /* if (all) this will be invalid but unused */
    888                
     891
     892                if (!cli_resolve_path(ctx, "", cli, filename,
     893                                &targetcli, &targetpath)) {
     894                        DEBUG(5, ("cacl_get Could not resolve %s\n",
     895                                filename));
     896                        errno = ENOENT;
     897                        return -1;
     898                }
     899
    889900                /* ... then obtain any NT attributes which were requested */
    890                 fnum = cli_nt_create(cli, filename, CREATE_ACCESS_READ);
    891                
     901                fnum = cli_nt_create(targetcli, targetpath, CREATE_ACCESS_READ);
     902
    892903                if (fnum == -1) {
    893                         DEBUG(5, ("cacl_get failed to open %s: %s\n",
    894                                   filename, cli_errstr(cli)));
    895                         errno = 0;
    896                         return -1;
    897                 }
    898                
    899                 sd = cli_query_secdesc(cli, fnum, ctx);
    900                
     904                        DEBUG(5, ("cacl_get failed to open %s: %s\n",
     905                                targetpath, cli_errstr(targetcli)));
     906                        errno = 0;
     907                        return -1;
     908                }
     909
     910                sd = cli_query_secdesc(targetcli, fnum, ctx);
     911
    901912                if (!sd) {
    902913                        DEBUG(5,
     
    905916                        return -1;
    906917                }
    907                
    908                 cli_close(cli, fnum);
    909                
     918
     919                cli_close(targetcli, fnum);
     920
    910921                if (! exclude_nt_revision) {
    911922                        if (all || all_nt) {
     
    15041515        char *p;
    15051516        bool numeric = True;
    1506        
     1517        char *targetpath = NULL;
     1518        struct cli_state *targetcli = NULL;
     1519
    15071520        /* the_acl will be null for REMOVE_ALL operations */
    15081521        if (the_acl) {
     
    15331546                return -1;
    15341547        }
    1535        
     1548
     1549        if (!cli_resolve_path(ctx, "", cli, filename,
     1550                                &targetcli, &targetpath)) {
     1551                DEBUG(5,("cacl_set: Could not resolve %s\n", filename));
     1552                errno = ENOENT;
     1553                return -1;
     1554        }
     1555
    15361556        /* The desired access below is the only one I could find that works
    15371557           with NT4, W2KP and Samba */
    1538        
    1539         fnum = cli_nt_create(cli, filename, CREATE_ACCESS_READ);
    1540        
     1558
     1559        fnum = cli_nt_create(targetcli, targetpath, CREATE_ACCESS_READ);
     1560
    15411561        if (fnum == -1) {
    15421562                DEBUG(5, ("cacl_set failed to open %s: %s\n",
    1543                           filename, cli_errstr(cli)));
     1563                          targetpath, cli_errstr(targetcli)));
    15441564                errno = 0;
    15451565                return -1;
    15461566        }
    1547        
    1548         old = cli_query_secdesc(cli, fnum, ctx);
    1549        
     1567
     1568        old = cli_query_secdesc(targetcli, fnum, ctx);
     1569
    15501570        if (!old) {
    15511571                DEBUG(5, ("cacl_set Failed to query old descriptor\n"));
     
    15531573                return -1;
    15541574        }
    1555        
    1556         cli_close(cli, fnum);
    1557        
     1575
     1576        cli_close(targetcli, fnum);
     1577
    15581578        switch (mode) {
    15591579        case SMBC_XATTR_MODE_REMOVE_ALL:
     
    15611581                dacl = old->dacl;
    15621582                break;
    1563                
     1583
    15641584        case SMBC_XATTR_MODE_REMOVE:
    15651585                for (i=0;sd->dacl && i<sd->dacl->num_aces;i++) {
    15661586                        bool found = False;
    1567                        
     1587
    15681588                        for (j=0;old->dacl && j<old->dacl->num_aces;j++) {
    15691589                                if (sec_ace_equal(&sd->dacl->aces[i],
     
    16431663                           owner_sid, group_sid, NULL, dacl, &sd_size);
    16441664       
    1645         fnum = cli_nt_create(cli, filename,
     1665        fnum = cli_nt_create(targetcli, targetpath,
    16461666                             WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS);
    16471667       
    16481668        if (fnum == -1) {
    16491669                DEBUG(5, ("cacl_set failed to open %s: %s\n",
    1650                           filename, cli_errstr(cli)));
     1670                          targetpath, cli_errstr(targetcli)));
    16511671                errno = 0;
    16521672                return -1;
    16531673        }
    16541674       
    1655         if (!cli_set_secdesc(cli, fnum, sd)) {
    1656                 DEBUG(5, ("ERROR: secdesc set failed: %s\n", cli_errstr(cli)));
     1675        if (!cli_set_secdesc(targetcli, fnum, sd)) {
     1676                DEBUG(5, ("ERROR: secdesc set failed: %s\n",
     1677                        cli_errstr(targetcli)));
    16571678                ret = -1;
    16581679        }
     
    16611682       
    16621683failed:
    1663         cli_close(cli, fnum);
     1684        cli_close(targetcli, fnum);
    16641685       
    16651686        if (err != 0) {
Note: See TracChangeset for help on using the changeset viewer.