Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/libsmb/clisecdesc.c

    r414 r740  
    33   client security descriptor functions
    44   Copyright (C) Andrew Tridgell 2000
    5    
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 3 of the License, or
    99   (at your option) any later version.
    10    
     10
    1111   This program is distributed in the hope that it will be useful,
    1212   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1313   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1414   GNU General Public License for more details.
    15    
     15
    1616   You should have received a copy of the GNU General Public License
    1717   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    1919
    2020#include "includes.h"
     21#include "libsmb/libsmb.h"
    2122
    2223/****************************************************************************
    2324  query the security descriptor for a open file
    2425 ****************************************************************************/
    25 SEC_DESC *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
     26struct security_descriptor *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
    2627                            TALLOC_CTX *mem_ctx)
    2728{
    2829        uint8_t param[8];
    29         uint8_t *rparam=NULL, *rdata=NULL;
    30         unsigned int rparam_count=0, rdata_count=0;
    31         SEC_DESC *psd = NULL;
     30        uint8_t *rdata=NULL;
     31        uint32_t rdata_count=0;
     32        struct security_descriptor *psd = NULL;
    3233        NTSTATUS status;
    3334
     
    4142                           param, 8, 4, /* param, length, max */
    4243                           NULL, 0, 0x10000, /* data, length, max */
    43                            NULL, NULL, /* rsetup, length */
    44                            &rparam, &rparam_count,
    45                            &rdata, &rdata_count);
     44                           NULL,             /* recv_flags2 */
     45                           NULL, 0, NULL, /* rsetup, length */
     46                           NULL, 0, NULL,
     47                           &rdata, 0, &rdata_count);
    4648
    4749        if (!NT_STATUS_IS_OK(status)) {
     
    6264 cleanup:
    6365
    64         TALLOC_FREE(rparam);
    6566        TALLOC_FREE(rdata);
    6667
     
    7172  set the security descriptor for a open file
    7273 ****************************************************************************/
    73 bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, SEC_DESC *sd)
     74NTSTATUS cli_set_secdesc(struct cli_state *cli, uint16_t fnum,
     75                         struct security_descriptor *sd)
    7476{
    75         char param[8];
    76         char *rparam=NULL, *rdata=NULL;
    77         unsigned int rparam_count=0, rdata_count=0;
     77        uint8_t param[8];
    7878        uint32 sec_info = 0;
    79         TALLOC_CTX *frame = talloc_stackframe();
    80         bool ret = False;
    8179        uint8 *data;
    8280        size_t len;
     
    8785                DEBUG(10, ("marshall_sec_desc failed: %s\n",
    8886                           nt_errstr(status)));
    89                 goto cleanup;
     87                return status;
    9088        }
    9189
     
    9391
    9492        if (sd->dacl)
    95                 sec_info |= DACL_SECURITY_INFORMATION;
     93                sec_info |= SECINFO_DACL;
    9694        if (sd->owner_sid)
    97                 sec_info |= OWNER_SECURITY_INFORMATION;
     95                sec_info |= SECINFO_OWNER;
    9896        if (sd->group_sid)
    99                 sec_info |= GROUP_SECURITY_INFORMATION;
     97                sec_info |= SECINFO_GROUP;
    10098        SSVAL(param, 4, sec_info);
    10199
    102         if (!cli_send_nt_trans(cli,
    103                                NT_TRANSACT_SET_SECURITY_DESC,
    104                                0,
    105                                NULL, 0, 0,
    106                                param, 8, 0,
    107                                (char *)data, len, 0)) {
    108                 DEBUG(1,("Failed to send NT_TRANSACT_SET_SECURITY_DESC\n"));
    109                 goto cleanup;
     100        status = cli_trans(talloc_tos(), cli, SMBnttrans,
     101                           NULL, -1, /* name, fid */
     102                           NT_TRANSACT_SET_SECURITY_DESC, 0,
     103                           NULL, 0, 0, /* setup */
     104                           param, 8, 0, /* param */
     105                           data, len, 0, /* data */
     106                           NULL,         /* recv_flags2 */
     107                           NULL, 0, NULL, /* rsetup */
     108                           NULL, 0, NULL, /* rparam */
     109                           NULL, 0, NULL); /* rdata */
     110        TALLOC_FREE(data);
     111        if (!NT_STATUS_IS_OK(status)) {
     112                DEBUG(1, ("Failed to send NT_TRANSACT_SET_SECURITY_DESC: %s\n",
     113                          nt_errstr(status)));
    110114        }
    111 
    112 
    113         if (!cli_receive_nt_trans(cli,
    114                                   &rparam, &rparam_count,
    115                                   &rdata, &rdata_count)) {
    116                 DEBUG(1,("NT_TRANSACT_SET_SECURITY_DESC failed\n"));
    117                 goto cleanup;
    118         }
    119 
    120         ret = True;
    121 
    122   cleanup:
    123 
    124         SAFE_FREE(rparam);
    125         SAFE_FREE(rdata);
    126 
    127         TALLOC_FREE(frame);
    128 
    129         return ret;
     115        return status;
    130116}
Note: See TracChangeset for help on using the changeset viewer.