Changeset 204 for branches/samba-3.2.x/source/libsmb/libsmb_xattr.c
- Timestamp:
- May 20, 2009, 6:46:53 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/libsmb/libsmb_xattr.c
r133 r204 747 747 uint16 mode = 0; 748 748 SMB_INO_T ino = 0; 749 749 struct cli_state *cli = srv->cli; 750 750 struct { 751 751 const char * create_time_attr; … … 884 884 */ 885 885 if (ipc_cli && (all || some_nt || all_nt_acls)) { 886 char *targetpath = NULL; 887 struct cli_state *targetcli = NULL; 888 886 889 /* Point to the portion after "system.nt_sec_desc." */ 887 890 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 889 900 /* ... 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 892 903 if (fnum == -1) { 893 894 filename, cli_errstr(cli)));895 896 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 901 912 if (!sd) { 902 913 DEBUG(5, … … 905 916 return -1; 906 917 } 907 908 cli_close( cli, fnum);909 918 919 cli_close(targetcli, fnum); 920 910 921 if (! exclude_nt_revision) { 911 922 if (all || all_nt) { … … 1504 1515 char *p; 1505 1516 bool numeric = True; 1506 1517 char *targetpath = NULL; 1518 struct cli_state *targetcli = NULL; 1519 1507 1520 /* the_acl will be null for REMOVE_ALL operations */ 1508 1521 if (the_acl) { … … 1533 1546 return -1; 1534 1547 } 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 1536 1556 /* The desired access below is the only one I could find that works 1537 1557 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 1541 1561 if (fnum == -1) { 1542 1562 DEBUG(5, ("cacl_set failed to open %s: %s\n", 1543 filename, cli_errstr(cli)));1563 targetpath, cli_errstr(targetcli))); 1544 1564 errno = 0; 1545 1565 return -1; 1546 1566 } 1547 1548 old = cli_query_secdesc( cli, fnum, ctx);1549 1567 1568 old = cli_query_secdesc(targetcli, fnum, ctx); 1569 1550 1570 if (!old) { 1551 1571 DEBUG(5, ("cacl_set Failed to query old descriptor\n")); … … 1553 1573 return -1; 1554 1574 } 1555 1556 cli_close( cli, fnum);1557 1575 1576 cli_close(targetcli, fnum); 1577 1558 1578 switch (mode) { 1559 1579 case SMBC_XATTR_MODE_REMOVE_ALL: … … 1561 1581 dacl = old->dacl; 1562 1582 break; 1563 1583 1564 1584 case SMBC_XATTR_MODE_REMOVE: 1565 1585 for (i=0;sd->dacl && i<sd->dacl->num_aces;i++) { 1566 1586 bool found = False; 1567 1587 1568 1588 for (j=0;old->dacl && j<old->dacl->num_aces;j++) { 1569 1589 if (sec_ace_equal(&sd->dacl->aces[i], … … 1643 1663 owner_sid, group_sid, NULL, dacl, &sd_size); 1644 1664 1645 fnum = cli_nt_create( cli, filename,1665 fnum = cli_nt_create(targetcli, targetpath, 1646 1666 WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS); 1647 1667 1648 1668 if (fnum == -1) { 1649 1669 DEBUG(5, ("cacl_set failed to open %s: %s\n", 1650 filename, cli_errstr(cli)));1670 targetpath, cli_errstr(targetcli))); 1651 1671 errno = 0; 1652 1672 return -1; 1653 1673 } 1654 1674 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))); 1657 1678 ret = -1; 1658 1679 } … … 1661 1682 1662 1683 failed: 1663 cli_close( cli, fnum);1684 cli_close(targetcli, fnum); 1664 1685 1665 1686 if (err != 0) {
Note:
See TracChangeset
for help on using the changeset viewer.