Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/source3/include
Files:
6 added
15 deleted
47 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/include/MacExtensions.h

    r414 r988  
    3131#define DefaultStreamTest               ":$DATA"
    3232#define AFPDATA_STREAM                  "::$DATA"
    33 #define AFPINFO_STREAM                  ":AFP_AfpInfo:$DATA"
    34 #define AFPRESOURCE_STREAM              ":AFP_Resource:$DATA"
    35 #define AFPCOMMENTS_STREAM              ":Comments:$DATA"
    36 #define AFPDESKTOP_STREAM               ":AFP_DeskTop:$DATA"
    37 #define AFPIDINDEX_STREAM               ":AFP_IdIndex:$DATA"
     33
     34#define AFPINFO_STREAM_NAME             ":AFP_AfpInfo"
     35#define AFPRESOURCE_STREAM_NAME         ":AFP_Resource"
     36#define AFPCOMMENTS_STREAM_NAME         ":Comments"
     37#define AFPDESKTOP_STREAM_NAME          ":AFP_DeskTop"
     38#define AFPIDINDEX_STREAM_NAME          ":AFP_IdIndex"
     39
     40#define AFPINFO_STREAM                  AFPINFO_STREAM_NAME ":$DATA"
     41#define AFPRESOURCE_STREAM              AFPRESOURCE_STREAM_NAME ":$DATA"
     42#define AFPCOMMENTS_STREAM              AFPCOMMENTS_STREAM_NAME ":$DATA"
     43#define AFPDESKTOP_STREAM               AFPDESKTOP_STREAM_NAME ":$DATA"
     44#define AFPIDINDEX_STREAM               AFPIDINDEX_STREAM_NAME ":$DATA"
    3845
    3946/*
    4047** NT's AFP_AfpInfo stream structure
    4148*/
    42 #define APF_INFO_SIZE           0x3c           
     49#define AFP_INFO_SIZE           0x3c
    4350#define AFP_Signature           0x41465000
    4451#define AFP_Version                     0x00000100
    45 #define AFP_BackupTime          0x00000080
     52#define AFP_BackupTime          0x80000000
    4653#define AFP_FinderSize          32
    4754/*
     
    5360typedef struct _AfpInfo
    5461{
    55          uint32         afpi_Signature;                 /* Must be *(PDWORD)"AFP" */
    56          uint32         afpi_Version;                   /* Must be 0x00010000 */
    57          uint32         afpi_Reserved1;
    58          uint32         afpi_BackupTime;                /* Backup time for the file/dir */
     62         uint32_t       afpi_Signature;                 /* Must be *(PDWORD)"AFP" */
     63         uint32_t       afpi_Version;                   /* Must be 0x00010000 */
     64         uint32_t       afpi_Reserved1;
     65         uint32_t       afpi_BackupTime;                /* Backup time for the file/dir */
    5966         unsigned char  afpi_FinderInfo[AFP_FinderSize];        /* Finder Info (32 bytes) */
    6067         unsigned char  afpi_ProDosInfo[6];     /* ProDos Info (6 bytes) # */
     
    7481
    7582/*
    76 ** These extentions are only supported with the NT LM 0.12 Dialect. These extentions
     83** These extensions are only supported with the NT LM 0.12 Dialect. These extentions
    7784** will be process on a share by share bases.
    7885*/
    7986
    8087/*
    81 ** Trans2_Query_FS_Information Call is used by the MacCIFS extentions for three reasons.
    82 ** First to see if the remote server share supports the basic Macintosh CIFS extentions.
     88** Trans2_Query_FS_Information Call is used by the MacCIFS extensions for three reasons.
     89** First to see if the remote server share supports the basic Macintosh CIFS extensions.
    8390** Second to return some basic need information about the share to the Macintosh.
    84 ** Third to see if this share support any other Macintosh extentions.
     91** Third to see if this share support any other Macintosh extensions.
    8592**
    8693** We will be using infromation levels that are betwwen 0x300 and 0x399 for all Macintosh
    87 ** extentions calls. The first of these will be the SMB_MAC_QUERY_FS_INFO level which
     94** extensions calls. The first of these will be the SMB_MAC_QUERY_FS_INFO level which
    8895** will allow the server to return the MacQueryFSInfo structure. All fields are Little
    8996** Endian unless other wise specified.
  • vendor/current/source3/include/ads.h

    r746 r988  
    1414struct ads_saslwrap_ops {
    1515        const char *name;
    16         ADS_STATUS (*wrap)(struct ads_struct *, uint8 *buf, uint32 len);
     16        ADS_STATUS (*wrap)(struct ads_struct *, uint8_t *buf, uint32_t len);
    1717        ADS_STATUS (*unwrap)(struct ads_struct *);
    1818        void (*disconnect)(struct ads_struct *);
     
    2727typedef struct ads_struct {
    2828        int is_mine;    /* do I own this structure's memory? */
    29        
     29
    3030        /* info needed to find the server */
    3131        struct {
     
    3333                char *workgroup;
    3434                char *ldap_server;
    35                 int foreign; /* set to 1 if connecting to a foreign
    36                               * realm */
    3735                bool gc;     /* Is this a global catalog server? */
    3836        } server;
     
    4644                unsigned flags;
    4745                int time_offset;
     46                char *ccache_name;
    4847                time_t tgt_expire;
    4948                time_t tgs_expire;
     
    5352        /* info derived from the servers config */
    5453        struct {
    55                 uint32 flags; /* cldap flags identifying the services. */
     54                uint32_t flags; /* cldap flags identifying the services. */
    5655                char *realm;
    5756                char *bind_path;
     
    8281                void *wrap_private_data;
    8382                struct {
    84                         uint32 ofs;
    85                         uint32 needed;
    86                         uint32 left;
     83                        uint32_t ofs;
     84                        uint32_t needed;
     85                        uint32_t left;
    8786#define        ADS_SASL_WRAPPING_IN_MAX_WRAPPED        0x0FFFFFFF
    88                         uint32 max_wrapped;
    89                         uint32 min_wrapped;
    90                         uint32 size;
    91                         uint8 *buf;
     87                        uint32_t max_wrapped;
     88                        uint32_t min_wrapped;
     89                        uint32_t size;
     90                        uint8_t *buf;
    9291                } in;
    9392                struct {
    94                         uint32 ofs;
    95                         uint32 left;
     93                        uint32_t ofs;
     94                        uint32_t left;
    9695#define        ADS_SASL_WRAPPING_OUT_MAX_WRAPPED       0x00A00000
    97                         uint32 max_unwrapped;
    98                         uint32 sig_size;
    99                         uint32 size;
    100                         uint8 *buf;
     96                        uint32_t max_unwrapped;
     97                        uint32_t sig_size;
     98                        uint32_t size;
     99                        uint8_t *buf;
    101100                } out;
    102101        } ldap;
     
    128127#define ADS_PINGS          0x0000FFFF  /* Ping response */
    129128
    130 /* ads auth control flags */
    131 #define ADS_AUTH_DISABLE_KERBEROS 0x0001
    132 #define ADS_AUTH_NO_BIND          0x0002
    133 #define ADS_AUTH_ANON_BIND        0x0004
    134 #define ADS_AUTH_SIMPLE_BIND      0x0008
    135 #define ADS_AUTH_ALLOW_NTLMSSP    0x0010
    136 #define ADS_AUTH_SASL_SIGN        0x0020
    137 #define ADS_AUTH_SASL_SEAL        0x0040
    138 #define ADS_AUTH_SASL_FORCE       0x0080
    139 #define ADS_AUTH_USER_CREDS       0x0100
    140 
    141129enum ads_extended_dn_flags {
    142130        ADS_EXTENDED_DN_HEX_STRING      = 0,
  • vendor/current/source3/include/adt_tree.h

    r740 r988  
    3333/* add a new path component */
    3434
    35 WERROR pathtree_add(struct sorted_tree *tree, const char *path, void *data_p );
     35bool pathtree_add(struct sorted_tree *tree, const char *path, void *data_p );
    3636
    3737/* search path */
  • vendor/current/source3/include/async_smb.h

    r740 r988  
    2323struct cli_state;
    2424
    25 /*
    26  * Fetch an error out of a NBT packet
    27  */
    28 
    29 NTSTATUS cli_pull_error(char *buf);
    30 
    31 /*
    32  * Compatibility helper for the sync APIs: Fake NTSTATUS in cli->inbuf
    33  */
    34 
    35 void cli_set_error(struct cli_state *cli, NTSTATUS status);
    36 
    3725struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
    38                                       struct event_context *ev,
     26                                      struct tevent_context *ev,
    3927                                      struct cli_state *cli,
    4028                                      uint8_t smb_command,
     
    4331                                      int iov_count,
    4432                                      struct iovec *bytes_iov);
    45 NTSTATUS cli_smb_req_send(struct tevent_req *req);
    46 size_t cli_smb_wct_ofs(struct tevent_req **reqs, int num_reqs);
    47 NTSTATUS cli_smb_chain_send(struct tevent_req **reqs, int num_reqs);
    48 uint8_t *cli_smb_inbuf(struct tevent_req *req);
    49 bool cli_has_async_calls(struct cli_state *cli);
    50 void cli_smb_req_unset_pending(struct tevent_req *req);
    51 bool cli_smb_req_set_pending(struct tevent_req *req);
    52 uint16_t cli_smb_req_mid(struct tevent_req *req);
    53 void cli_smb_req_set_mid(struct tevent_req *req, uint16_t mid);
    54 uint32_t cli_smb_req_seqnum(struct tevent_req *req);
    55 void cli_smb_req_set_seqnum(struct tevent_req *req, uint32_t seqnum);
    56 struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
     33struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
    5734                                struct cli_state *cli,
    5835                                uint8_t smb_command, uint8_t additional_flags,
     
    6542                      uint32_t *pnum_bytes, uint8_t **pbytes);
    6643
    67 struct tevent_req *cli_smb_oplock_break_waiter_send(TALLOC_CTX *mem_ctx,
    68                                                     struct event_context *ev,
    69                                                     struct cli_state *cli);
    70 NTSTATUS cli_smb_oplock_break_waiter_recv(struct tevent_req *req,
    71                                           uint16_t *pfnum,
    72                                           uint8_t *plevel);
    73 
    74 struct tevent_req *cli_session_request_send(TALLOC_CTX *mem_ctx,
    75                                             struct tevent_context *ev,
    76                                             int sock,
    77                                             const struct nmb_name *called,
    78                                             const struct nmb_name *calling);
    79 bool cli_session_request_recv(struct tevent_req *req, int *err, uint8_t *resp);
    80 
    8144#endif
  • vendor/current/source3/include/auth.h

    r740 r988  
    2222#include "../auth/common_auth.h"
    2323
     24struct gensec_security;
     25
    2426struct extra_auth_info {
    2527        struct dom_sid user_sid;
     
    3739        struct security_token *security_token;
    3840
    39         /* This is the final session key, as used by SMB signing, and
    40          * (truncated to 16 bytes) encryption on the SAMR and LSA pipes
    41          * when over ncacn_np.
    42          * It is calculated by NTLMSSP from the session key in the info3,
    43          * and is  set from the Kerberos session key using
    44          * krb5_auth_con_getremotesubkey().
    45          *
    46          * Bottom line, it is not the same as the session keys in info3.
     41        /* These are the intermediate session keys, as provided by a
     42         * NETLOGON server and used by NTLMSSP to negotiate key
     43         * exchange etc (which will provide the session_key in the
     44         * auth_session_info).  It is usually the same as the keys in
     45         * the info3, but is a variable length structure here to allow
     46         * it to be omitted if the auth module does not know it.
    4747         */
    4848
    49         DATA_BLOB user_session_key;
     49        DATA_BLOB session_key;
    5050        DATA_BLOB lm_session_key;
    5151
     
    6565
    6666        char *unix_name;
     67};
    6768
    68         /*
    69          * For performance reasons we keep an alpha_strcpy-sanitized version
    70          * of the username around as long as the global variable current_user
    71          * still exists. If we did not do keep this, we'd have to call
    72          * alpha_strcpy whenever we do a become_user(), potentially on every
    73          * smb request. See set_current_user_info.
    74          */
    75         char *sanitized_username;
    76 };
     69struct auth_context;
     70
     71typedef NTSTATUS (*prepare_gensec_fn)(const struct auth_context *auth_context,
     72                                      TALLOC_CTX *mem_ctx,
     73                                      struct gensec_security **gensec_context);
     74
     75typedef NTSTATUS (*make_auth4_context_fn)(const struct auth_context *auth_context,
     76                                          TALLOC_CTX *mem_ctx,
     77                                          struct auth4_context **auth4_context);
    7778
    7879struct auth_context {
     
    8283        const char *challenge_set_by;
    8384
    84         bool challenge_may_be_modified;
    85 
    86         struct auth_methods *challenge_set_method;
    8785        /* What order are the various methods in?   Try to stop it changing under us */
    8886        struct auth_methods *auth_method_list; 
    8987
    90         NTSTATUS (*get_ntlm_challenge)(struct auth_context *auth_context,
    91                                        uint8_t chal[8]);
    92         NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
    93                                         const struct auth_usersupplied_info *user_info,
    94                                         struct auth_serversupplied_info **server_info);
    95         NTSTATUS (*nt_status_squash)(NTSTATUS nt_status);
     88        prepare_gensec_fn prepare_gensec;
     89        make_auth4_context_fn make_auth4_context;
     90        const char *forced_samba4_methods;
    9691};
    9792
     
    107102                         struct auth_serversupplied_info **server_info);
    108103
    109         /* If you are using this interface, then you are probably
    110          * getting something wrong.  This interface is only for
    111          * security=server, and makes a number of compromises to allow
    112          * that.  It is not compatible with being a PDC.  */
    113         DATA_BLOB (*get_chal)(const struct auth_context *auth_context,
    114                               void **my_private_data,
    115                               TALLOC_CTX *mem_ctx);
    116 
     104        /* Optional methods allowing this module to provide a way to get a gensec context and an auth4_context */
     105        prepare_gensec_fn prepare_gensec;
     106        make_auth4_context_fn make_auth4_context;
    117107        /* Used to keep tabs on things like the cli for SMB server authentication */
    118108        void *private_data;
     109
     110        uint32_t flags;
    119111
    120112} auth_methods;
     
    131123};
    132124
    133 struct auth_ntlmssp_state;
     125extern const struct gensec_security_ops gensec_ntlmssp3_server_ops;
     126
     127/* Intent of use for session key. LSA and SAMR pipes use 16 bytes of session key when doing create/modify calls */
     128enum session_key_use_intent {
     129        KEY_USE_FULL = 0,
     130        KEY_USE_16BYTES
     131};
    134132
    135133/* Changed from 1 -> 2 to add the logon_parameters field. */
    136134/* Changed from 2 -> 3 when we reworked many auth structures to use IDL or be in common with Samba4 */
    137 #define AUTH_INTERFACE_VERSION 3
     135/* Changed from 3 -> 4 when we reworked added the flags */
     136#define AUTH_INTERFACE_VERSION 4
    138137
    139138#include "auth/proto.h"
  • vendor/current/source3/include/client.h

    r740 r988  
    2323#define _CLIENT_H
    2424
    25 /* the client asks for a smaller buffer to save ram and also to get more
    26    overlap on the wire. This size gives us a nice read/write size, which
    27    will be a multiple of the page size on almost any system */
    28 #define CLI_BUFFER_SIZE (0xFFFF)
    29 #define CLI_SAMBA_MAX_LARGE_READX_SIZE (127*1024) /* Works for Samba servers */
    30 #define CLI_SAMBA_MAX_LARGE_WRITEX_SIZE (127*1024) /* Works for Samba servers */
    31 #define CLI_WINDOWS_MAX_LARGE_READX_SIZE ((64*1024)-2) /* Windows servers are broken.... */
    32 #define CLI_WINDOWS_MAX_LARGE_WRITEX_SIZE ((64*1024)-2) /* Windows servers are broken.... */
    33 #define CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE (0xFFFF00) /* 24-bit len. */
    34 #define CLI_SAMBA_MAX_POSIX_LARGE_WRITEX_SIZE (0xFFFF00) /* 24-bit len. */
     25#define CLI_BUFFER_SIZE SMB_BUFFER_SIZE_MAX
     26
     27/* default client timeout to 20 seconds on most commands */
     28#define CLIENT_TIMEOUT (20 * 1000)
    3529
    3630/*
     
    3933
    4034struct print_job_info {
    41         uint16 id;
    42         uint16 priority;
     35        uint16_t id;
     36        uint16_t priority;
    4337        size_t size;
    4438        fstring user;
     
    4741};
    4842
    49 struct cli_state_seqnum {
    50         struct cli_state_seqnum *prev, *next;
    51         uint16_t mid;
    52         uint32_t seqnum;
    53         bool persistent;
    54 };
     43struct smbXcli_conn;
     44struct smbXcli_session;
    5545
    5646struct cli_state {
     
    5949         */
    6050        struct cli_state *prev, *next;
    61         int port;
    62         int fd;
    63         /* Last read or write error. */
    64         enum smb_read_errors smb_rw_error;
    65         uint16 cnum;
    66         uint16 pid;
    67         uint16 mid;
    68         uint16 vuid;
    69         int protocol;
    70         int sec_mode;
    7151        int rap_error;
    72         int privileges;
    73 
    74         char *desthost;
    75 
    76         /* The credentials used to open the cli_state connection. */
    77         char *domain;
    78         char *user_name;
    79         char *password; /* Can be null to force use of zero NTLMSSP session key. */
     52        NTSTATUS raw_status; /* maybe via NT_STATUS_DOS() */
     53        bool map_dos_errors;
    8054
    8155        /*
     
    9064        char *share;
    9165        char *dev;
    92         struct nmb_name called;
    93         struct nmb_name calling;
    94         struct sockaddr_storage dest_ss;
    9566
    96         DATA_BLOB secblob; /* cryptkey or negTokenInit */
    97         uint32 sesskey;
    98         int serverzone;
    99         uint32 servertime;
    100         int readbraw_supported;
    101         int writebraw_supported;
    10267        int timeout; /* in milliseconds. */
    103         size_t max_xmit;
    104         size_t max_mux;
    105         char *outbuf;
    106         struct cli_state_seqnum *seqnum;
    107         char *inbuf;
    108         unsigned int bufsize;
    10968        int initialised;
    11069        int win95;
    111         bool is_samba;
    112         bool is_guestlogin;
    113         uint32 capabilities;
    11470        /* What the server offered. */
    11571        uint32_t server_posix_capabilities;
    11672        /* What the client requested. */
    11773        uint32_t requested_posix_capabilities;
    118         bool dfsroot;
    119 
    120         struct smb_signing_state *signing_state;
    121 
    122         struct smb_trans_enc_state *trans_enc_state; /* Setup if we're encrypting SMB's. */
    123 
    124         /* the session key for this CLI, outside
    125            any per-pipe authenticaion */
    126         DATA_BLOB user_session_key;
     74        bool backup_intent;
    12775
    12876        /* The list of pipes currently open on this connection. */
     
    13179        bool use_kerberos;
    13280        bool fallback_after_kerberos;
    133         bool use_spnego;
    13481        bool use_ccache;
     82        bool pw_nt_hash;
    13583        bool got_kerberos_mechanism; /* Server supports krb5 in SPNEGO. */
    13684
    13785        bool use_oplocks; /* should we use oplocks? */
    138         bool use_level_II_oplocks; /* should we use level II oplocks? */
    139 
    140         /* a oplock break request handler */
    141         NTSTATUS (*oplock_handler)(struct cli_state *cli, uint16_t fnum, unsigned char level);
    142 
    143         bool force_dos_errors;
    144         bool case_sensitive; /* False by default. */
    14586
    14687        /* Where (if anywhere) this is mounted under DFS. */
    14788        char *dfs_mountpoint;
    14889
    149         struct tevent_queue *outgoing;
    150         struct tevent_req **pending;
     90        struct smbXcli_conn *conn;
     91        const char *remote_realm;
     92
     93        struct {
     94                uint16_t pid;
     95                uint16_t vc_num;
     96                struct smbXcli_session *session;
     97                struct smbXcli_tcon *tcon;
     98        } smb1;
     99
     100        struct {
     101                struct smbXcli_session *session;
     102                struct smbXcli_tcon *tcon;
     103                struct idr_context *open_handles;
     104        } smb2;
    151105};
    152106
    153107struct file_info {
    154108        uint64_t size;
    155         uint16 mode;
     109        uint16_t mode;
    156110        uid_t uid;
    157111        gid_t gid;
     
    161115        struct timespec ctime_ts;
    162116        char *name;
    163         char short_name[13*3]; /* the *3 is to cope with multi-byte */
     117        char *short_name;
    164118};
    165119
     
    171125#define CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS 0x0020
    172126#define CLI_FULL_CONNECTION_USE_CCACHE 0x0040
     127#define CLI_FULL_CONNECTION_FORCE_DOS_ERRORS 0x0080
     128#define CLI_FULL_CONNECTION_FORCE_ASCII 0x0100
     129#define CLI_FULL_CONNECTION_USE_NT_HASH 0x0200
    173130
    174131#endif /* _CLIENT_H */
  • vendor/current/source3/include/ctdbd_conn.h

    r740 r988  
    33   Samba3 ctdb connection handling
    44   Copyright (C) Volker Lendecke 2007
    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/>.
     
    2727struct messaging_rec;
    2828
    29 NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
    30                                     struct ctdbd_connection **pconn);
     29int ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
     30                               const char *sockname, int timeout,
     31                               struct ctdbd_connection **pconn);
    3132
    32 uint32 ctdbd_vnn(const struct ctdbd_connection *conn);
     33uint32_t ctdbd_vnn(const struct ctdbd_connection *conn);
    3334
    34 NTSTATUS ctdbd_register_msg_ctx(struct ctdbd_connection *conn,
    35                                 struct messaging_context *msg_ctx);
     35int ctdbd_register_msg_ctx(struct ctdbd_connection *conn,
     36                           struct messaging_context *msg_ctx,
     37                           struct tevent_context *ev);
    3638struct messaging_context *ctdb_conn_msg_ctx(struct ctdbd_connection *conn);
    3739
    3840int ctdbd_conn_get_fd(struct ctdbd_connection *conn);
    3941
    40 NTSTATUS ctdbd_messaging_send(struct ctdbd_connection *conn,
    41                               uint32 dst_vnn, uint64 dst_srvid,
    42                               struct messaging_rec *msg);
     42int ctdbd_messaging_send_iov(struct ctdbd_connection *conn,
     43                             uint32_t dst_vnn, uint64_t dst_srvid,
     44                             const struct iovec *iov, int iovlen);
    4345
    44 bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32 vnn,
     46bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn,
    4547                          pid_t pid);
     48bool ctdb_processes_exist(struct ctdbd_connection *conn,
     49                          const struct server_id *pids, int num_pids,
     50                          bool *results);
    4651
    4752char *ctdbd_dbpath(struct ctdbd_connection *conn,
    4853                   TALLOC_CTX *mem_ctx, uint32_t db_id);
    4954
    50 NTSTATUS ctdbd_db_attach(struct ctdbd_connection *conn, const char *name,
    51                         uint32_t *db_id, int tdb_flags);
     55int ctdbd_db_attach(struct ctdbd_connection *conn, const char *name,
     56                    uint32_t *db_id, int tdb_flags);
    5257
    53 NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32 db_id,
    54                        TDB_DATA key);
     58int ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key);
    5559
    56 NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32 db_id,
    57                      TDB_DATA key, TALLOC_CTX *mem_ctx, TDB_DATA *data);
     60int ctdbd_parse(struct ctdbd_connection *conn, uint32_t db_id,
     61                TDB_DATA key, bool local_copy,
     62                void (*parser)(TDB_DATA key, TDB_DATA data,
     63                               void *private_data),
     64                void *private_data);
    5865
    59 NTSTATUS ctdbd_traverse(uint32 db_id,
    60                         void (*fn)(TDB_DATA key, TDB_DATA data,
    61                                    void *private_data),
     66int ctdbd_traverse(struct ctdbd_connection *master, uint32_t db_id,
     67                   void (*fn)(TDB_DATA key, TDB_DATA data,
     68                              void *private_data),
     69                   void *private_data);
     70
     71int ctdbd_register_ips(struct ctdbd_connection *conn,
     72                       const struct sockaddr_storage *server,
     73                       const struct sockaddr_storage *client,
     74                       int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
     75                                 uint64_t dst_srvid,
     76                                 const uint8_t *msg, size_t msglen,
     77                                 void *private_data),
     78                       void *private_data);
     79
     80int ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
     81                        uint64_t srvid, uint32_t flags, TDB_DATA data,
     82                        TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
     83                        int *cstatus);
     84int ctdb_watch_us(struct ctdbd_connection *conn);
     85int ctdb_unwatch(struct ctdbd_connection *conn);
     86
     87struct ctdb_req_message_old;
     88
     89int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
     90                        int (*cb)(uint32_t src_vnn, uint32_t dst_vnn,
     91                                  uint64_t dst_srvid,
     92                                  const uint8_t *msg, size_t msglen,
     93                                  void *private_data),
    6294                        void *private_data);
    63 
    64 NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
    65                             const struct sockaddr_storage *server,
    66                             const struct sockaddr_storage *client,
    67                             void (*release_ip_handler)(const char *ip_addr,
    68                                                        void *private_data),
    69                             void *private_data);
    70 
    71 NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn);
    72 
    73 NTSTATUS ctdbd_control_local(struct ctdbd_connection *conn, uint32 opcode,
    74                              uint64_t srvid, uint32_t flags, TDB_DATA data,
    75                              TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
    76                              int *cstatus);
    77 NTSTATUS ctdb_watch_us(struct ctdbd_connection *conn);
    78 NTSTATUS ctdb_unwatch(struct ctdbd_connection *conn);
     95int ctdbd_probe(const char *sockname, int timeout);
    7996
    8097#endif /* _CTDBD_CONN_H */
  • vendor/current/source3/include/event.h

    r740 r988  
    33   event handling
    44   Copyright (C) Andrew Tridgell 1992-1998
    5    Copyright (C) Volker Lendecke 2005
     5   Copyright (C) Volker Lendecke 2005-2007
    66
    77   This program is free software; you can redistribute it and/or modify
     
    1919*/
    2020
    21 #define TEVENT_COMPAT_DEFINES
    2221#include <tevent.h>
    23 
    24 #undef event_context_init
    25 #define event_context_init(mem_ctx) s3_tevent_context_init(mem_ctx)
    2622
    2723/* The following definitions come from lib/events.c  */
    2824struct pollfd;
    29 struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
     25struct timeval *get_timed_events_timeout(struct tevent_context *event_ctx,
    3026                                         struct timeval *to_ret);
    31 void dump_event_list(struct event_context *event_ctx);
     27void dump_event_list(struct tevent_context *event_ctx);
    3228struct tevent_context *s3_tevent_context_init(TALLOC_CTX *mem_ctx);
    3329
     
    3733bool run_events_poll(struct tevent_context *ev, int pollrtn,
    3834                     struct pollfd *pfds, int num_pfds);
     35
     36struct idle_event *event_add_idle(struct tevent_context *event_ctx,
     37                                  TALLOC_CTX *mem_ctx,
     38                                  struct timeval interval,
     39                                  const char *name,
     40                                  bool (*handler)(const struct timeval *now,
     41                                                  void *private_data),
     42                                  void *private_data);
  • vendor/current/source3/include/fake_file.h

    r740 r988  
    4242enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname);
    4343NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
    44                                 uint16_t current_vuid,
     44                                uint64_t current_vuid,
    4545                                enum FAKE_FILE_TYPE fake_file_type,
    4646                                const struct smb_filename *smb_fname,
    47                                 uint32 access_mask,
     47                                uint32_t access_mask,
    4848                                files_struct **result);
    4949NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
  • vendor/current/source3/include/g_lock.h

    r740 r988  
    2121#define _G_LOCK_H_
    2222
    23 #include "dbwrap.h"
     23#include "dbwrap/dbwrap.h"
    2424
    2525struct g_lock_ctx;
     26struct messaging_context;
    2627
    2728enum g_lock_type {
     
    3031};
    3132
    32 /*
    33  * Or'ed with g_lock_type
    34  */
    35 #define G_LOCK_PENDING (2)
    36 
    3733struct g_lock_ctx *g_lock_ctx_init(TALLOC_CTX *mem_ctx,
    3834                                   struct messaging_context *msg);
    3935
     36struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx,
     37                                    struct tevent_context *ev,
     38                                    struct g_lock_ctx *ctx,
     39                                    const char *name,
     40                                    enum g_lock_type type);
     41NTSTATUS g_lock_lock_recv(struct tevent_req *req);
    4042NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
    4143                     enum g_lock_type lock_type, struct timeval timeout);
     
    4547
    4648NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
    47                    struct timeval timeout, struct server_id self,
     49                   struct timeval timeout,
    4850                   void (*fn)(void *private_data), void *private_data);
    4951
  • vendor/current/source3/include/includes.h

    r740 r988  
    2323#include "../replace/replace.h"
    2424
    25 #if _SAMBA_BUILD_ == 4
    26 # undef _SAMBA_BUILD_
    27 # define _SAMBA_BUILD_ 3
    28 #endif
    29 
    3025/* make sure we have included the correct config.h */
    3126#ifndef NO_CONFIG_H /* for some tests */
     
    143138#endif
    144139
    145 /* mutually exclusive (SuSE 8.2) */
    146 #if HAVE_ATTR_XATTR_H
    147 #include <attr/xattr.h>
    148 #elif HAVE_SYS_XATTR_H
    149 #include <sys/xattr.h>
    150 #endif
    151 
    152 #ifdef HAVE_SYS_EA_H
    153 #include <sys/ea.h>
    154 #endif
    155 
    156 #ifdef HAVE_SYS_EXTATTR_H
    157 #include <sys/extattr.h>
    158 #endif
    159 
    160140#ifdef HAVE_SYS_UIO_H
    161141#include <sys/uio.h>
     
    168148#if HAVE_NETGROUP_H
    169149#include <netgroup.h>
    170 #endif
    171 
    172 #if defined(HAVE_AIO_H) && defined(WITH_AIO)
    173 #include <aio.h>
    174150#endif
    175151
     
    202178
    203179/*
    204    Samba needs type definitions for int16, int32, uint16 and uint32.
    205 
    206    Normally these are signed and unsigned 16 and 32 bit integers, but
    207    they actually only need to be at least 16 and 32 bits
    208    respectively. Thus if your word size is 8 bytes just defining them
    209    as signed and unsigned int will work.
    210 */
    211 
    212 #ifndef uint8
    213 #define uint8 uint8_t
    214 #endif
    215 
    216 #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
    217 #  define int16 int16_t
    218    /* needed to work around compile issue on HP-UX 11.x */
    219 #  define _INT16        1
    220 #endif
    221 
    222 /*
    223  * Note we duplicate the size tests in the unsigned
    224  * case as int16 may be a typedef from rpc/rpc.h
    225  */
    226 
    227 
    228 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
    229 #  define uint16 uint16_t
    230 #endif
    231 
    232 #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
    233 #  define int32 int32_t
    234 #  ifndef _INT32
    235      /* needed to work around compile issue on HP-UX 11.x */
    236 #    define _INT32      1
    237 #  endif
    238 #endif
    239 
    240 /*
    241  * Note we duplicate the size tests in the unsigned
    242  * case as int32 may be a typedef from rpc/rpc.h
    243  */
    244 
    245 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
    246 #  define uint32 uint32_t
    247 #endif
    248 
    249 /*
    250  * check for 8 byte long long
    251  */
    252 
    253 #if !defined(uint64)
    254 #  define uint64 uint64_t
    255 #endif
    256 
    257 #if !defined(int64)
    258 #  define int64 int64_t
    259 #endif
    260 
    261 
    262 /*
    263180 * Types for devices, inodes and offsets.
    264181 */
    265182
    266183#ifndef SMB_DEV_T
    267 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)
    268 #    define SMB_DEV_T dev64_t
    269 #  else
    270 #    define SMB_DEV_T dev_t
    271 #  endif
     184# define SMB_DEV_T dev_t
    272185#endif
    273186
    274187#ifndef LARGE_SMB_DEV_T
    275 #  if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)) || (defined(SIZEOF_DEV_T) && (SIZEOF_DEV_T == 8))
     188#  if (defined(SIZEOF_DEV_T) && (SIZEOF_DEV_T == 8))
    276189#    define LARGE_SMB_DEV_T 1
    277190#  endif
     
    291204
    292205#ifndef SMB_INO_T
    293 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)
    294 #    define SMB_INO_T ino64_t
    295 #  else
    296206#    define SMB_INO_T ino_t
    297 #  endif
    298207#endif
    299208
    300209#ifndef LARGE_SMB_INO_T
    301 #  if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
     210#  if (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
    302211#    define LARGE_SMB_INO_T 1
    303212#  endif
     
    312221#endif
    313222
    314 #ifndef SMB_OFF_T
    315 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
    316 #    define SMB_OFF_T off64_t
    317 #  else
    318 #    define SMB_OFF_T off_t
    319 #  endif
    320 #endif
    321 
    322223/* TODO: remove this macros */
    323224#define SBIG_UINT(p, ofs, v) SBVAL(p, ofs, v)
     
    328229typedef uint64_t br_off;
    329230
    330 #define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
     231#define SMB_OFF_T_BITS (sizeof(off_t)*8)
    331232
    332233/*
     
    335236 */
    336237
    337 #ifndef LARGE_SMB_OFF_T
    338 #  if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
    339 #    define LARGE_SMB_OFF_T 1
    340 #  endif
    341 #endif
    342 
    343 #ifdef LARGE_SMB_OFF_T
    344238#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
    345239#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32))
    346 #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF) )))
    347 #else
    348 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
    349 #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0))
    350 #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF )))
    351 #endif
    352 
    353 #ifndef HAVE_BLKSIZE_T
    354 /* This is mainly for HP/UX which defines st_blksize as long */
    355 typedef long blksize_t;
    356 #endif
    357 
    358 #ifndef HAVE_BLKCNT_T
    359 /* This is mainly for HP/UX which doesn't have blkcnt_t */
    360 typedef long blkcnt_t;
    361 #endif
     240#define IVAL_TO_SMB_OFF_T(buf,off) ((off_t)(( ((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF) )))
    362241
    363242/*
     
    385264        uint32_t        st_ex_flags;
    386265        uint32_t        st_ex_mask;
    387 
    388         /*
    389          * Add space for VFS internal extensions. The initial user of this
    390          * would be the onefs modules, passing the snapid from the stat calls
    391          * to the file_id_create call. Maybe we'll have to expand this later,
    392          * but the core of Samba should never look at this field.
    393          */
    394         uint64_t vfs_private;
    395266};
    396267
    397268typedef struct stat_ex SMB_STRUCT_STAT;
    398 
    399 /*
    400  * Type for dirent structure.
    401  */
    402 
    403 #ifndef SMB_STRUCT_DIRENT
    404 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
    405 #    define SMB_STRUCT_DIRENT struct dirent64
    406 #  else
    407 #    define SMB_STRUCT_DIRENT struct dirent
    408 #  endif
    409 #endif
    410 
    411 /*
    412  * Type for DIR structure.
    413  */
    414 
    415 #ifndef SMB_STRUCT_DIR
    416 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIR64)
    417 #    define SMB_STRUCT_DIR DIR64
    418 #  else
    419 #    define SMB_STRUCT_DIR DIR
    420 #  endif
    421 #endif
    422 
    423 /*
    424  * Defines for 64 bit fcntl locks.
    425  */
    426 
    427 #ifndef SMB_STRUCT_FLOCK
    428 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
    429 #    define SMB_STRUCT_FLOCK struct flock64
    430 #  else
    431 #    define SMB_STRUCT_FLOCK struct flock
    432 #  endif
    433 #endif
    434 
    435 #ifndef SMB_F_SETLKW
    436 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
    437 #    define SMB_F_SETLKW F_SETLKW64
    438 #  else
    439 #    define SMB_F_SETLKW F_SETLKW
    440 #  endif
    441 #endif
    442 
    443 #ifndef SMB_F_SETLK
    444 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
    445 #    define SMB_F_SETLK F_SETLK64
    446 #  else
    447 #    define SMB_F_SETLK F_SETLK
    448 #  endif
    449 #endif
    450 
    451 #ifndef SMB_F_GETLK
    452 #  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
    453 #    define SMB_F_GETLK F_GETLK64
    454 #  else
    455 #    define SMB_F_GETLK F_GETLK
    456 #  endif
    457 #endif
    458 
    459 /*
    460  * Type for aiocb structure.
    461  */
    462 
    463 #ifndef SMB_STRUCT_AIOCB
    464 #  if defined(WITH_AIO)
    465 #    if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64)
    466 #      define SMB_STRUCT_AIOCB struct aiocb64
    467 #    else
    468 #      define SMB_STRUCT_AIOCB struct aiocb
    469 #    endif
    470 #  else
    471 #    define SMB_STRUCT_AIOCB int /* AIO not being used but we still need the define.... */
    472 #  endif
    473 #endif
    474269
    475270enum timestamp_set_resolution {
     
    503298#endif
    504299
     300/* debug.h need to be included before samba_util.h for the macro SMB_ASSERT */
     301#include "../lib/util/debug.h"
     302
    505303/* Lists, trees, caching, database... */
    506 #include "../lib/util/util.h"
     304#include "../lib/util/samba_util.h"
    507305#include "../lib/util/util_net.h"
    508306#include "../lib/util/xfile.h"
     
    518316#include "../lib/util/data_blob.h"
    519317#include "../lib/util/time.h"
    520 #include "../lib/util/debug.h"
    521318#include "../lib/util/debug_s3.h"
    522319
     
    524321#include "../libcli/util/error.h"
    525322#include "../lib/util/charset/charset.h"
    526 #include "dynconfig.h"
     323#include "dynconfig/dynconfig.h"
    527324#include "locking.h"
    528325#include "smb_perfcount.h"
     
    530327#include "../lib/util/byteorder.h"
    531328
    532 #include "module.h"
     329#include "../lib/util/samba_modules.h"
    533330#include "../lib/util/talloc_stack.h"
    534331#include "../lib/util/smb_threads.h"
    535332#include "../lib/util/smb_threads_internal.h"
    536333
     334/* samba_setXXid functions. */
     335#include "../lib/util/setid.h"
     336
    537337/***** prototypes *****/
    538338#ifndef NO_PROTO_H
     
    540340#endif
    541341
     342#include "lib/param/loadparm.h"
     343
    542344/* String routines */
    543345
     
    553355#endif
    554356
    555 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
    556 #define OSF1_ENH_SEC 1
    557 #endif
    558357
    559358#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
     
    580379
    581380#define MAX_SEC_CTX_DEPTH 8    /* Maximum number of security contexts */
    582 
    583 
    584 #ifdef GLIBC_HACK_FCNTL64
    585 /* this is a gross hack. 64 bit locking is completely screwed up on
    586    i386 Linux in glibc 2.1.95 (which ships with RedHat 7.0). This hack
    587    "fixes" the problem with the current 2.4.0test kernels
    588 */
    589 #define fcntl fcntl64
    590 #undef F_SETLKW
    591 #undef F_SETLK
    592 #define F_SETLK 13
    593 #define F_SETLKW 14
    594 #endif
    595381
    596382
     
    604390
    605391/* PRINTFLIKE2 */
    606 void sys_adminlog(int priority, const char *format_str, ...) PRINTF_ATTRIBUTE(2,3);
    607 
    608 /* PRINTFLIKE2 */
    609392int fstr_sprintf(fstring s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
    610 
    611 int d_vfprintf(FILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
    612393
    613394int smb_xvasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
     
    624405#endif
    625406
    626 #ifndef XATTR_CREATE
    627 #define XATTR_CREATE  0x1       /* set value, fail if attr already exists */
    628 #endif
    629 
    630 #ifndef XATTR_REPLACE
    631 #define XATTR_REPLACE 0x2       /* set value, fail if attr does not exist */
    632 #endif
    633 
    634407#ifdef TRUE
    635408#undef TRUE
     
    649422#endif
    650423
    651 #ifndef CONST_DISCARD
    652 #define CONST_DISCARD(type, ptr)      ((type) ((void *) (ptr)))
    653 #endif
    654 
    655 void smb_panic( const char *why ) _NORETURN_;
    656424void dump_core(void) _NORETURN_;
    657425void exit_server(const char *const reason) _NORETURN_;
    658426void exit_server_cleanly(const char *const reason) _NORETURN_;
    659 void exit_server_fault(void) _NORETURN_;
    660 
    661 /* samba3 doesn't use uwrap yet */
    662 #define uwrap_enabled() 0
    663427
    664428#define BASE_RID (0x000003E8L)
  • vendor/current/source3/include/libsmb_internal.h

    r740 r988  
    1 /* 
     1/*
    22   Unix SMB/Netbios implementation.
    33   SMB client library implementation
     
    55   Copyright (C) Richard Sharpe 2000, 2002
    66   Copyright (C) John Terpstra 2000
    7    Copyright (C) Tom Jansen (Ninja ISD) 2002 
     7   Copyright (C) Tom Jansen (Ninja ISD) 2002
    88   Copyright (C) Derrell Lipman 2003-2008
    99   Copyright (C) Jeremy Allison 2007, 2008
    10    
     10
    1111   This program is free software; you can redistribute it and/or modify
    1212   it under the terms of the GNU General Public License as published by
    1313   the Free Software Foundation; either version 3 of the License, or
    1414   (at your option) any later version.
    15    
     15
    1616   This program is distributed in the hope that it will be useful,
    1717   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1818   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1919   GNU General Public License for more details.
    20    
     20
    2121   You should have received a copy of the GNU General Public License
    2222   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    4141typedef struct DOS_ATTR_DESC {
    4242        int mode;
    43         SMB_OFF_T size;
     43        off_t size;
    4444        time_t create_time;
    4545        time_t access_time;
     
    4949} DOS_ATTR_DESC;
    5050
     51/*
     52 * Extension of libsmbclient.h's #defines
     53 */
     54#define SMB_CTX_FLAG_USE_NT_HASH (1 << 4)
    5155
    5256/*
     
    7579        bool no_pathinfo;
    7680        bool no_pathinfo2;
     81        bool no_pathinfo3;
    7782        bool no_nt_session;
    7883        struct policy_handle pol;
     84        time_t last_echo_time;
    7985
    8086        SMBCSRV *next, *prev;
    81        
    8287};
    8388
    84 /* 
    85  * Keep directory entries in a list 
     89/*
     90 * Keep directory entries in a list
    8691 */
    8792struct smbc_dir_list {
     
    9398/*
    9499 * Structure for open file management
    95  */ 
     100 */
    96101struct _SMBCFILE {
    97         int cli_fd;
     102        int cli_fd;
     103        /*
     104         * cache of cli_state we opened cli_fd on.
     105         * Due to DFS can be a subsidiary connection to srv->cli
     106         */
     107        struct cli_state *targetcli;
    98108        char *fname;
    99         SMB_OFF_T offset;
     109        off_t offset;
    100110        struct _SMBCSRV *srv;
    101111        bool file;
     
    133143         */
    134144        SMBCSRV *                               servers;
    135        
     145
    136146        /*
    137147         * open file/dir list
     
    167177
    168178        /*
    169          * Should we attempt UNIX smb encryption ? 
     179         * Should we attempt UNIX smb encryption ?
    170180         * Set to 0 if we should never attempt, set to 1 if
    171181         * encryption requested, set to 2 if encryption required.
     
    234244#endif
    235245
    236 #if 0 /* None available yet */
    237246        /* SMB high-level functions */
    238247        struct
    239248        {
     249                smbc_splice_fn                  splice_fn;
     250                smbc_notify_fn                  notify_fn;
    240251        }               smb;
    241252
    242 #endif
     253        uint16_t        port;
    243254};     
    244255
     
    248259                       SMBCSRV * newsrv,
    249260                       const char * server,
    250                        const char * share, 
     261                       const char * share,
    251262                       const char * workgroup,
    252263                       const char * username);
     
    254265SMBCSRV *
    255266SMBC_get_cached_server(SMBCCTX * context,
    256                        const char * server, 
     267                       const char * server,
    257268                       const char * share,
    258269                       const char * workgroup,
     
    331342int
    332343SMBC_rename_ctx(SMBCCTX *ocontext,
    333                 const char *oname, 
     344                const char *oname,
    334345                SMBCCTX *ncontext,
    335346                const char *nname);
     347
     348int
     349SMBC_notify_ctx(SMBCCTX *c, SMBCFILE *dir, smbc_bool recursive,
     350                uint32_t completion_filter, unsigned callback_timeout_ms,
     351                smbc_notify_callback_fn cb, void *private_data);
     352
    336353
    337354
     
    360377               size_t count);
    361378
     379off_t
     380SMBC_splice_ctx(SMBCCTX *context,
     381                SMBCFILE *srcfile,
     382                SMBCFILE *dstfile,
     383                off_t count,
     384                int (*splice_cb)(off_t n, void *priv),
     385                void *priv);
     386
    362387int
    363388SMBC_close_ctx(SMBCCTX *context,
     
    367392SMBC_getatr(SMBCCTX * context,
    368393            SMBCSRV *srv,
    369             char *path,
    370             uint16 *mode,
    371             SMB_OFF_T *size,
     394            const char *path,
     395            uint16_t *mode,
     396            off_t *size,
    372397            struct timespec *create_time_ts,
    373398            struct timespec *access_time_ts,
     
    377402
    378403bool
    379 SMBC_setatr(SMBCCTX * context, SMBCSRV *srv, char *path, 
     404SMBC_setatr(SMBCCTX * context, SMBCSRV *srv, char *path,
    380405            time_t create_time,
    381406            time_t access_time,
    382407            time_t write_time,
    383408            time_t change_time,
    384             uint16 mode);
     409            uint16_t mode);
    385410
    386411off_t
     
    412437                char **pp_workgroup,
    413438                char **pp_server,
     439                uint16_t *p_port,
    414440                char **pp_share,
    415441                char **pp_path,
     
    449475SMBC_remove_unused_server(SMBCCTX * context,
    450476                          SMBCSRV * srv);
    451 
    452 void
    453 SMBC_call_auth_fn(TALLOC_CTX *ctx,
    454                   SMBCCTX *context,
    455                   const char *server,
    456                   const char *share,
    457                   char **pp_workgroup,
    458                   char **pp_username,
    459                   char **pp_password);
    460477
    461478void
     
    479496            bool connect_if_not_found,
    480497            const char *server,
     498            uint16_t port,
    481499            const char *share,
    482500            char **pp_workgroup,
     
    488506                 SMBCCTX *context,
    489507                 const char *server,
     508                 uint16_t port,
    490509                 const char *share,
    491510                 char **pp_workgroup,
  • vendor/current/source3/include/libsmbclient.h

    r740 r988  
    55  Copyright (C) Richard Sharpe 2000
    66  Copyright (C) John Terpsra 2000
    7   Copyright (C) Tom Jansen (Ninja ISD) 2002 
     7  Copyright (C) Tom Jansen (Ninja ISD) 2002
    88  Copyright (C) Derrell Lipman 2003-2008
    99
    10    
     10
    1111  This program is free software; you can redistribute it and/or modify
    1212  it under the terms of the GNU General Public License as published by
    1313  the Free Software Foundation; either version 3 of the License, or
    1414  (at your option) any later version.
    15    
     15
    1616  This program is distributed in the hope that it will be useful,
    1717  but WITHOUT ANY WARRANTY; without even the implied warranty of
    1818  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1919  GNU General Public License for more details.
    20    
     20
    2121  You should have received a copy of the GNU General Public License
    2222  along with this program; if not, see <http://www.gnu.org/licenses/>.
     
    3838
    3939/*-------------------------------------------------------------------*/
    40 /* The following are special comments to instruct DOXYGEN (automated 
     40/* The following are special comments to instruct DOXYGEN (automated
    4141 * documentation tool:
    4242*/
     
    7171*   Functions that don't fit in to other categories
    7272*/
    73 /*-------------------------------------------------------------------*/   
     73/*-------------------------------------------------------------------*/
    7474
    7575/* Make sure we have the following includes for now ... */
     
    7777#include <sys/stat.h>
    7878#include <sys/statvfs.h>
     79#include <stdint.h>
    7980#include <fcntl.h>
    8081#include <utime.h>
     
    9697 *
    9798 */
    98 struct smbc_dirent 
     99struct smbc_dirent
    99100{
    100101        /** Type of entity.
    101102            SMBC_WORKGROUP=1,
    102             SMBC_SERVER=2, 
     103            SMBC_SERVER=2,
    103104            SMBC_FILE_SHARE=3,
    104105            SMBC_PRINTER_SHARE=4,
     
    107108            SMBC_DIR=7,
    108109            SMBC_FILE=8,
    109             SMBC_LINK=9,*/ 
    110         unsigned int smbc_type; 
     110            SMBC_LINK=9,*/
     111        unsigned int smbc_type;
    111112
    112113        /** Length of this smbc_dirent in bytes
     
    117118         */
    118119        unsigned int commentlen;
    119         /** Points to the null terminated comment string 
     120        /** Points to the null terminated comment string
    120121         */
    121122        char *comment;
     
    124125         */
    125126        unsigned int namelen;
    126         /** Points to the null terminated name string 
     127        /** Points to the null terminated name string
    127128         */
    128129        char name[1];
     
    207208 */
    208209#ifndef _CLIENT_H
    209 struct print_job_info 
     210struct print_job_info
    210211{
    211212        /** numeric ID of the print job
    212213         */
    213214        unsigned short id;
    214    
     215
    215216        /** represents print job priority (lower numbers mean higher priority)
    216217         */
    217218        unsigned short priority;
    218    
     219
    219220        /** Size of the print job
    220221         */
    221222        size_t size;
    222    
     223
    223224        /** Name of the user that owns the print job
    224225         */
    225226        char user[128];
    226  
     227
    227228        /** Name of the print job. This will have no name if an anonymous print
    228229         *  file was opened. Ie smb://server/printer
     
    238239
    239240/**@ingroup structure
    240  * Server handle 
     241 * Server handle
    241242 */
    242243typedef struct _SMBCSRV  SMBCSRV;
    243244
    244245/**@ingroup structure
    245  * File or directory handle 
     246 * File or directory handle
    246247 */
    247248typedef struct _SMBCFILE SMBCFILE;
    248249
    249250/**@ingroup structure
    250  * File or directory handle 
     251 * File or directory handle
    251252 */
    252253typedef struct _SMBCCTX SMBCCTX;
     
    276277/**@ingroup callback
    277278 * Authentication callback function type (traditional method)
    278  * 
     279 *
    279280 * Type for the the authentication function called by the library to
    280  * obtain authentication credentals
     281 * obtain authentication credentials
    281282 *
    282283 * For kerberos support the function should just be called without
     
    292293 *                  workgroup to be authenticated.  Should be filled in
    293294 *                  with the correct workgroup if the hint is wrong.
    294  * 
     295 *
    295296 * @param wglen     The size of the workgroup buffer in bytes
    296297 *
     
    299300 *                  filled in with the correct workgroup if the hint is
    300301 *                  wrong.
    301  * 
     302 *
    302303 * @param unlen     The size of the username buffer in bytes
    303304 *
    304  * @param pw        Pointer to buffer containing to which password 
     305 * @param pw        Pointer to buffer containing to which password
    305306 *                  copied
    306  * 
     307 *
    307308 * @param pwlen     The size of the password buffer in bytes
    308  *           
    309  */
    310 typedef void (*smbc_get_auth_data_fn)(const char *srv, 
     309 *
     310 */
     311typedef void (*smbc_get_auth_data_fn)(const char *srv,
    311312                                      const char *shr,
    312                                       char *wg, int wglen, 
     313                                      char *wg, int wglen,
    313314                                      char *un, int unlen,
    314315                                      char *pw, int pwlen);
    315316/**@ingroup callback
    316317 * Authentication callback function type (method that includes context)
    317  * 
     318 *
    318319 * Type for the the authentication function called by the library to
    319  * obtain authentication credentals
     320 * obtain authentication credentials
    320321 *
    321322 * For kerberos support the function should just be called without
     
    333334 *                  workgroup to be authenticated.  Should be filled in
    334335 *                  with the correct workgroup if the hint is wrong.
    335  * 
     336 *
    336337 * @param wglen     The size of the workgroup buffer in bytes
    337338 *
     
    340341 *                  filled in with the correct workgroup if the hint is
    341342 *                  wrong.
    342  * 
     343 *
    343344 * @param unlen     The size of the username buffer in bytes
    344345 *
    345  * @param pw        Pointer to buffer containing to which password 
     346 * @param pw        Pointer to buffer containing to which password
    346347 *                  copied
    347  * 
     348 *
    348349 * @param pwlen     The size of the password buffer in bytes
    349  *           
     350 *
    350351 */
    351352typedef void (*smbc_get_auth_data_with_context_fn)(SMBCCTX *c,
    352                                                    const char *srv, 
     353                                                   const char *srv,
    353354                                                   const char *shr,
    354                                                    char *wg, int wglen, 
     355                                                   char *wg, int wglen,
    355356                                                   char *un, int unlen,
    356357                                                   char *pw, int pwlen);
     
    362363 * @param i         pointer to print job information structure
    363364 *
    364  */ 
     365 */
    365366typedef void (*smbc_list_print_job_fn)(struct print_job_info *i);
    366                
     367
    367368
    368369/**@ingroup callback
     
    375376 * @return          0 when connection is good. 1 on error.
    376377 *
    377  */ 
     378 */
    378379typedef int (*smbc_check_server_fn)(SMBCCTX * c, SMBCSRV *srv);
    379380
     
    387388 * @return          0 on success. 1 on failure.
    388389 *
    389  */ 
     390 */
    390391typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv);
    391392
     
    398399 * @param srv       pointer to server to add
    399400 *
    400  * @param server    server name 
     401 * @param server    server name
    401402 *
    402403 * @param share     share name
     
    408409 * @return          0 on success. 1 on failure.
    409410 *
    410  */ 
    411 typedef int (*smbc_add_cached_srv_fn)   (SMBCCTX * c, SMBCSRV *srv, 
     411 */
     412typedef int (*smbc_add_cached_srv_fn)   (SMBCCTX * c, SMBCSRV *srv,
    412413                                    const char * server, const char * share,
    413414                                    const char * workgroup, const char * username);
     
    428429 * @return          pointer to SMBCSRV on success. NULL on failure.
    429430 *
    430  */ 
     431 */
    431432typedef SMBCSRV * (*smbc_get_cached_srv_fn)   (SMBCCTX * c, const char * server,
    432433                                               const char * share, const char * workgroup,
     
    442443 * @return          0 when found and removed. 1 on failure.
    443444 *
    444  */ 
     445 */
    445446typedef int (*smbc_remove_cached_srv_fn)(SMBCCTX * c, SMBCSRV *srv);
    446447
     
    453454 * @return          0 when found and removed. 1 on failure.
    454455 *
    455  */ 
     456 */
    456457typedef int (*smbc_purge_cached_fn)     (SMBCCTX * c);
    457458
     
    506507void
    507508smbc_setTimeout(SMBCCTX *c, int timeout);
     509
     510
     511/**
     512 * Get the TCP port used to connect (0 means default).
     513 */
     514uint16_t
     515smbc_getPort(SMBCCTX *c);
     516
     517/**
     518 * Set the TCP port used to connect (0 means default).
     519 */
     520void
     521smbc_setPort(SMBCCTX *c, uint16_t port);
    508522
    509523
     
    744758smbc_setOptionUseCCache(SMBCCTX *c, smbc_bool b);
    745759
     760/** Get indication that the password supplied is the NT hash */
     761smbc_bool
     762smbc_getOptionUseNTHash(SMBCCTX *c);
     763
     764/** Set indication that the password supplied is the NT hash */
     765void
     766smbc_setOptionUseNTHash(SMBCCTX *c, smbc_bool b);
     767
    746768
    747769
     
    851873void smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn);
    852874
     875typedef off_t (*smbc_splice_fn)(SMBCCTX *c,
     876                                SMBCFILE *srcfile,
     877                                SMBCFILE *dstfile,
     878                                off_t count,
     879                                int (*splice_cb)(off_t n, void *priv),
     880                                void *priv);
     881smbc_splice_fn smbc_getFunctionSplice(SMBCCTX *c);
     882void smbc_setFunctionSplice(SMBCCTX *c, smbc_splice_fn fn);
     883
    853884typedef int (*smbc_unlink_fn)(SMBCCTX *c,
    854885                              const char *fname);
     
    963994void smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn);
    964995
     996#define SMBC_NOTIFY_ACTION_ADDED                1
     997#define SMBC_NOTIFY_ACTION_REMOVED              2
     998#define SMBC_NOTIFY_ACTION_MODIFIED             3
     999#define SMBC_NOTIFY_ACTION_OLD_NAME             4
     1000#define SMBC_NOTIFY_ACTION_NEW_NAME             5
     1001#define SMBC_NOTIFY_ACTION_ADDED_STREAM 6
     1002#define SMBC_NOTIFY_ACTION_REMOVED_STREAM       7
     1003#define SMBC_NOTIFY_ACTION_MODIFIED_STREAM      8
     1004
     1005struct smbc_notify_callback_action {
     1006        uint32_t action;
     1007        const char *filename;
     1008};
     1009
     1010typedef int (*smbc_notify_callback_fn)(
     1011        const struct smbc_notify_callback_action *actions,
     1012        size_t num_actions, void *private_data);
     1013
     1014typedef int (*smbc_notify_fn)(SMBCCTX *c, SMBCFILE *dir, smbc_bool recursive,
     1015                              uint32_t completion_filter,
     1016                              unsigned callback_timeout_ms,
     1017                              smbc_notify_callback_fn cb, void *private_data);
     1018smbc_notify_fn smbc_getFunctionNotify(SMBCCTX *c);
     1019void smbc_setFunctionNotify(SMBCCTX *c, smbc_notify_fn fn);
    9651020
    9661021
     
    10741129 *
    10751130 * @return          Returns 0 on succes. Returns 1 on failure with errno set:
    1076  *                  - EBUSY Server connections are still used, Files are open or cache 
     1131 *                  - EBUSY Server connections are still used, Files are open or cache
    10771132 *                          could not be purged
    10781133 *                  - EBADF context == NULL
     
    11221177 *                  smbc_context_init() failure. Avoid this.
    11231178 *                  You'll have to call smbc_free_context() yourself
    1124  *                  on failure. 
     1179 *                  on failure.
    11251180 */
    11261181
     
    11311186 *
    11321187 * Must be called before using any of the smbclient API function
    1133  * 
    1134  * @param fn        The function that will be called to obtaion 
     1188 *
     1189 * @param fn        The function that will be called to obtaion
    11351190 *                  authentication credentials.
    11361191 *
     
    11381193 *                  changed in smb.conf file. Allows caller to set
    11391194 *                  debugging if no smb.conf.
    1140  *   
     1195 *
    11411196 * @return          0 on success, < 0 on error with errno set:
    11421197 *                  - ENOMEM Out of memory
     
    11741229 * Open a file on an SMB server.
    11751230 *
    1176  * @param furl      The smb url of the file to be opened. 
    1177  *
    1178  * @param flags     Is one of O_RDONLY, O_WRONLY or O_RDWR which 
     1231 * @param furl      The smb url of the file to be opened.
     1232 *
     1233 * @param flags     Is one of O_RDONLY, O_WRONLY or O_RDWR which
    11791234 *                  request opening  the  file  read-only,write-only
    11801235 *                  or read/write. flags may also be bitwise-or'd with
    1181  *                  one or  more of  the following: 
    1182  *                  O_CREAT - If the file does not exist it will be 
     1236 *                  one or  more of  the following:
     1237 *                  O_CREAT - If the file does not exist it will be
    11831238 *                  created.
    1184  *                  O_EXCL - When  used with O_CREAT, if the file 
    1185  *                  already exists it is an error and the open will 
    1186  *                  fail. 
     1239 *                  O_EXCL - When  used with O_CREAT, if the file
     1240 *                  already exists it is an error and the open will
     1241 *                  fail.
    11871242 *                  O_TRUNC - If the file already exists it will be
    11881243 *                  truncated.
    1189  *                  O_APPEND The  file  is  opened  in  append mode 
    1190  *
    1191  * @param mode      mode specifies the permissions to use if a new 
    1192  *                  file is created.  It  is  modified  by  the 
     1244 *                  O_APPEND The  file  is  opened  in  append mode
     1245 *
     1246 * @param mode      mode specifies the permissions to use if a new
     1247 *                  file is created.  It  is  modified  by  the
    11931248 *                  process's umask in the usual way: the permissions
    1194  *                  of the created file are (mode & ~umask) 
     1249 *                  of the created file are (mode & ~umask)
    11951250 *
    11961251 *                  Not currently use, but there for future use.
     
    12001255 * @return          Valid file handle, < 0 on error with errno set:
    12011256 *                  - ENOMEM  Out of memory
    1202  *                  - EINVAL if an invalid parameter passed, like no
    1203  *                  file, or smbc_init not called.
    1204  *                  - EEXIST  pathname already exists and O_CREAT and
    1205  *                  O_EXCL were used.
    1206  *                  - EISDIR  pathname  refers  to  a  directory  and 
    1207  *                  the access requested involved writing.
    1208  *                  - EACCES  The requested access to the file is not
    1209  *                  allowed
    1210  *                  - ENODEV The requested share does not exist
    1211  *                  - ENOTDIR A file on the path is not a directory
    1212  *                  - ENOENT  A directory component in pathname does
    1213  *                  not exist.
    1214  *
    1215  * @see             smbc_creat()
    1216  *
    1217  * @note            This call uses an underlying routine that may create
    1218  *                  a new connection to the server specified in the URL.
    1219  *                  If the credentials supplied in the URL, or via the
    1220  *                  auth_fn in the smbc_init call, fail, this call will
    1221  *                  try again with an empty username and password. This
    1222  *                  often gets mapped to the guest account on some machines.
    1223  */
    1224 
    1225 int smbc_open(const char *furl, int flags, mode_t mode);
    1226 
    1227 /**@ingroup file
    1228  * Create a file on an SMB server.
    1229  *
    1230  * Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC
    1231  *   
    1232  * @param furl      The smb url of the file to be created
    1233  * 
    1234  * @param mode      mode specifies the permissions to use if  a  new 
    1235  *                  file is created.  It  is  modified  by  the
    1236  *                  process's umask in the usual way: the permissions
    1237  *                  of the created file are (mode & ~umask)
    1238  *
    1239  *                  NOTE, the above is not true. We are dealing with
    1240  *                  an SMB server, which has no concept of a umask!
    1241  *     
    1242  * @return          Valid file handle, < 0 on error with errno set:
    1243  *                  - ENOMEM  Out of memory
    1244  *                  - EINVAL if an invalid parameter passed, like no
     1257 *                  - EINVAL if an invalid parameter passed, like no
    12451258 *                  file, or smbc_init not called.
    12461259 *                  - EEXIST  pathname already exists and O_CREAT and
     
    12491262 *                  the access requested involved writing.
    12501263 *                  - EACCES  The requested access to the file is not
    1251  *                  allowed
    1252  *                  - ENOENT  A directory component in pathname does
     1264 *                  allowed
     1265 *                  - ENODEV The requested share does not exist
     1266 *                  - ENOTDIR A file on the path is not a directory
     1267 *                  - ENOENT  A directory component in pathname does
     1268 *                  not exist.
     1269 *
     1270 * @see             smbc_creat()
     1271 *
     1272 * @note            This call uses an underlying routine that may create
     1273 *                  a new connection to the server specified in the URL.
     1274 *                  If the credentials supplied in the URL, or via the
     1275 *                  auth_fn in the smbc_init call, fail, this call will
     1276 *                  try again with an empty username and password. This
     1277 *                  often gets mapped to the guest account on some machines.
     1278 */
     1279
     1280int smbc_open(const char *furl, int flags, mode_t mode);
     1281
     1282/**@ingroup file
     1283 * Create a file on an SMB server.
     1284 *
     1285 * Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC
     1286 *
     1287 * @param furl      The smb url of the file to be created
     1288 *
     1289 * @param mode      mode specifies the permissions to use if  a  new
     1290 *                  file is created.  It  is  modified  by  the
     1291 *                  process's umask in the usual way: the permissions
     1292 *                  of the created file are (mode & ~umask)
     1293 *
     1294 *                  NOTE, the above is not true. We are dealing with
     1295 *                  an SMB server, which has no concept of a umask!
     1296 *
     1297 * @return          Valid file handle, < 0 on error with errno set:
     1298 *                  - ENOMEM  Out of memory
     1299 *                  - EINVAL if an invalid parameter passed, like no
     1300 *                  file, or smbc_init not called.
     1301 *                  - EEXIST  pathname already exists and O_CREAT and
     1302 *                  O_EXCL were used.
     1303 *                  - EISDIR  pathname  refers  to  a  directory  and
     1304 *                  the access requested involved writing.
     1305 *                  - EACCES  The requested access to the file is not
     1306 *                  allowed
     1307 *                  - ENOENT  A directory component in pathname does
    12531308 *                  not exist.
    12541309 *                  - ENODEV The requested share does not exist.
     
    12721327 *                  < 0 on error, with errno set:
    12731328 *                  - EISDIR fd refers to a directory
    1274  *                  - EBADF  fd  is  not  a valid file descriptor or 
     1329 *                  - EBADF  fd  is  not  a valid file descriptor or
    12751330 *                    is not open for reading.
    1276  *                  - EINVAL fd is attached to an object which is 
     1331 *                  - EINVAL fd is attached to an object which is
    12771332 *                    unsuitable for reading, or no buffer passed or
    12781333 *                    smbc_init not called.
     
    12951350 * @return          Number of bytes written, < 0 on error with errno set:
    12961351 *                  - EISDIR fd refers to a directory.
    1297  *                  - EBADF  fd  is  not  a valid file descriptor or 
     1352 *                  - EBADF  fd  is  not  a valid file descriptor or
    12981353 *                  is not open for reading.
    1299  *                  - EINVAL fd is attached to an object which is 
     1354 *                  - EINVAL fd is attached to an object which is
    13001355 *                  unsuitable for reading, or no buffer passed or
    13011356 *                  smbc_init not called.
     
    13111366 *
    13121367 * @param fd        Open file handle from smbc_open() or smbc_creat()
    1313  * 
     1368 *
    13141369 * @param offset    Offset in bytes from whence
    1315  * 
     1370 *
    13161371 * @param whence    A location in the file:
    13171372 *                  - SEEK_SET The offset is set to offset bytes from
    13181373 *                  the beginning of the file
    1319  *                  - SEEK_CUR The offset is set to current location 
     1374 *                  - SEEK_CUR The offset is set to current location
    13201375 *                  plus offset bytes.
    1321  *                  - SEEK_END The offset is set to the size of the 
     1376 *                  - SEEK_END The offset is set to the size of the
    13221377 *                  file plus offset bytes.
    13231378 *
    1324  * @return          Upon successful completion, lseek returns the 
    1325  *                  resulting offset location as measured in bytes 
     1379 * @return          Upon successful completion, lseek returns the
     1380 *                  resulting offset location as measured in bytes
    13261381 *                  from the beginning  of the file. Otherwise, a value
    1327  *                  of (off_t)-1 is returned and errno is set to 
     1382 *                  of (off_t)-1 is returned and errno is set to
    13281383 *                  indicate the error:
    13291384 *                  - EBADF  Fildes is not an open file descriptor.
     
    13321387 *
    13331388 * @todo Are all the whence values really supported?
    1334  * 
     1389 *
    13351390 * @todo Are errno values complete and correct?
    13361391 */
     
    13581413 *
    13591414 * @return          0 on success, < 0 on error with errno set:
    1360  *                  - EACCES or EPERM Write  access  to the directory 
    1361  *                  containing pathname is not allowed or one 
     1415 *                  - EACCES or EPERM Write  access  to the directory
     1416 *                  containing pathname is not allowed or one
    13621417 *                  of  the  directories in pathname did not allow
    13631418 *                  search (execute) permission
     
    13781433/**@ingroup directory
    13791434 * Rename or move a file or directory.
    1380  * 
    1381  * @param ourl      The original smb url (source url) of file or 
     1435 *
     1436 * @param ourl      The original smb url (source url) of file or
    13821437 *                  directory to be moved
    1383  * 
     1438 *
    13841439 * @param nurl      The new smb url (destination url) of the file
    13851440 *                  or directory after the move.  Currently nurl must
     
    13891444 *                  - EISDIR nurl is an existing directory, but ourl is
    13901445 *                  not a directory.
    1391  *                  - EEXIST nurl is  a  non-empty directory, 
     1446 *                  - EEXIST nurl is  a  non-empty directory,
    13921447 *                  i.e., contains entries other than "." and ".."
    1393  *                  - EINVAL The  new  url  contained  a path prefix 
     1448 *                  - EINVAL The  new  url  contained  a path prefix
    13941449 *                  of the old, or, more generally, an  attempt was
    13951450 *                  made  to make a directory a subdirectory of itself
    13961451 *                  or smbc_init not called.
    1397  *                  - ENOTDIR A component used as a directory in ourl 
    1398  *                  or nurl path is not, in fact, a directory.  Or, 
     1452 *                  - ENOTDIR A component used as a directory in ourl
     1453 *                  or nurl path is not, in fact, a directory.  Or,
    13991454 *                  ourl  is a directory, and newpath exists but is not
    14001455 *                  a directory.
    1401  *                  - EACCES or EPERM Write access to the directory 
    1402  *                  containing ourl or nurl is not allowed for the 
    1403  *                  process's effective uid,  or  one of the 
     1456 *                  - EACCES or EPERM Write access to the directory
     1457 *                  containing ourl or nurl is not allowed for the
     1458 *                  process's effective uid,  or  one of the
    14041459 *                  directories in ourl or nurl did not allow search
    14051460 *                  (execute) permission,  or ourl  was  a  directory
    14061461 *                  and did not allow write permission.
    1407  *                  - ENOENT A  directory component in ourl or nurl 
     1462 *                  - ENOENT A  directory component in ourl or nurl
    14081463 *                  does not exist.
    14091464 *                  - EXDEV Rename across shares not supported.
     
    14291484 *                  not parse, or was of incorrect form or smbc_init not
    14301485 *                  called.
    1431  *                  - ENOENT durl does not exist, or name is an 
    1432  *                  - ENOMEM Insufficient memory to complete the 
    1433  *                  operation.                             
     1486 *                  - ENOENT durl does not exist, or name is an
     1487 *                  - ENOMEM Insufficient memory to complete the
     1488 *                  operation.
    14341489 *                  - ENOTDIR name is not a directory.
    14351490 *                  - EPERM the workgroup could not be found.
     
    14581513 * Get multiple directory entries.
    14591514 *
    1460  * smbc_getdents() reads as many dirent structures from the an open 
     1515 * smbc_getdents() reads as many dirent structures from the an open
    14611516 * directory handle into a specified memory area as will fit.
    14621517 *
     
    14651520 * @param dirp      pointer to buffer that will receive the directory
    14661521 *                  entries.
    1467  * 
     1522 *
    14681523 * @param count     The size of the dirp buffer in bytes
    14691524 *
     
    15091564 * @return          The current location in the directory stream or -1
    15101565 *                  if an error occur.  The current location is not
    1511  *                  an offset. Becuase of the implementation, it is a 
     1566 *                  an offset. Becuase of the implementation, it is a
    15121567 *                  handle that allows the library to find the entry
    15131568 *                  later.
     
    15291584 *
    15301585 * @param fd        Valid directory as returned by smbc_opendir()
    1531  * 
     1586 *
    15321587 * @param offset    The offset (as returned by smbc_telldir). Can be
    15331588 *                  NULL, in which case we will rewind
     
    15521607 *
    15531608 * @param mode      Specifies  the  permissions to use. It is modified
    1554  *                  by the process's umask in the usual way: the 
     1609 *                  by the process's umask in the usual way: the
    15551610 *                  permissions of the created file are (mode & ~umask).
    1556  * 
     1611 *
    15571612 * @return          0 on success, < 0 on error with errno set:
    15581613 *                  - EEXIST directory url already exists
     
    15721627/**@ingroup directory
    15731628 * Remove a directory.
    1574  * 
     1629 *
    15751630 * @param durl      The smb url of the directory to remove
    15761631 *
     
    15841639 *                  - ENOMEM Insufficient kernel memory was available.
    15851640 *
    1586  * @see             smbc_mkdir(), smbc_unlink() 
     1641 * @see             smbc_mkdir(), smbc_unlink()
    15871642 *
    15881643 * @todo Are errno values complete and correct?
     
    15901645int smbc_rmdir(const char *durl);
    15911646
     1647/**@ingroup directory
     1648 * Request directory notifications
     1649 *
     1650 * @param dh                    Valid directory as returned by smbc_opendir()
     1651 *
     1652 * @param recursive             Are changes in subdirectories wanted?
     1653 *
     1654 * @param completion_filter     Bitwise-or of the SMBC_NOTIFY_CHANGE_*
     1655 *                              events that are interesting
     1656 *
     1657 * @param callback_timeout_ms   If set to non-zero, interval in milliseconds
     1658 *                              that "cb" will be called with 0 actions.
     1659 *                              This gives "cb" the chance to cancel the
     1660 *                              smbc_notify call.
     1661 *
     1662 * @param cb                    Callback functions taking events. If "cb"
     1663 *                              returns nonzero, smbc_notify will return.
     1664 *
     1665 * @param private_data          Pointer given to "cb"
     1666 *
     1667 * @return                      0 on success, -1 on error with errno set
     1668 *
     1669 * @see                         smbc_opendir(), smbc_closedir()
     1670 */
     1671
     1672#define SMBC_NOTIFY_CHANGE_FILE_NAME            0x001
     1673#define SMBC_NOTIFY_CHANGE_DIR_NAME             0x002
     1674#define SMBC_NOTIFY_CHANGE_ATTRIBUTES           0x004
     1675#define SMBC_NOTIFY_CHANGE_SIZE         0x008
     1676#define SMBC_NOTIFY_CHANGE_LAST_WRITE           0x010
     1677#define SMBC_NOTIFY_CHANGE_LAST_ACCESS          0x020
     1678#define SMBC_NOTIFY_CHANGE_CREATION             0x040
     1679#define SMBC_NOTIFY_CHANGE_EA                   0x080
     1680#define SMBC_NOTIFY_CHANGE_SECURITY             0x100
     1681#define SMBC_NOTIFY_CHANGE_STREAM_NAME          0x200
     1682#define SMBC_NOTIFY_CHANGE_STREAM_SIZE          0x400
     1683#define SMBC_NOTIFY_CHANGE_STREAM_WRITE 0x800
     1684
     1685int smbc_notify(int dh, smbc_bool recursive, uint32_t completion_filter,
     1686                unsigned callback_timeout_ms,
     1687                smbc_notify_callback_fn cb, void *private_data);
    15921688
    15931689/**@ingroup attribute
     
    15961692 * @param url       The smb url to get information for
    15971693 *
    1598  * @param st        pointer to a buffer that will be filled with 
     1694 * @param st        pointer to a buffer that will be filled with
    15991695 *                  standard Unix struct stat information.
    16001696 *
     
    16151711/**@ingroup attribute
    16161712 * Get file information via an file descriptor.
    1617  * 
     1713 *
    16181714 * @param fd        Open file handle from smbc_open() or smbc_creat()
    16191715 *
    1620  * @param st        pointer to a buffer that will be filled with 
     1716 * @param st        pointer to a buffer that will be filled with
    16211717 *                  standard Unix struct stat information.
    1622  * 
     1718 *
    16231719 * @return          0 on success, < 0 on error with errno set:
    16241720 *                  - EBADF  filedes is bad.
     
    16371733/**@ingroup attribute
    16381734 * Get file system information for a specified path.
    1639  * 
     1735 *
    16401736 * @param url       The smb url to get information for
    16411737 *
    1642  * @param st        pointer to a buffer that will be filled with 
     1738 * @param st        pointer to a buffer that will be filled with
    16431739 *                  standard Unix struct statvfs information.
    1644  * 
     1740 *
    16451741 * @return          0 on success, < 0 on error with errno set:
    16461742 *                  - EBADF  filedes is bad.
     
    16601756/**@ingroup attribute
    16611757 * Get file system information via an file descriptor.
    1662  * 
     1758 *
    16631759 * @param fd        Open file handle from smbc_open(), smbc_creat(),
    16641760 *                  or smbc_opendir()
    16651761 *
    1666  * @param st        pointer to a buffer that will be filled with 
     1762 * @param st        pointer to a buffer that will be filled with
    16671763 *                  standard Unix struct statvfs information.
    1668  * 
     1764 *
    16691765 * @return          0 on success, < 0 on error with errno set:
    16701766 *                  - EBADF  filedes is bad.
     
    16851781/**@ingroup attribute
    16861782 * Truncate a file given a file descriptor
    1687  * 
     1783 *
    16881784 * @param fd        Open file handle from smbc_open() or smbc_creat()
    16891785 *
    16901786 * @param size      size to truncate the file to
    1691  * 
     1787 *
    16921788 * @return          0 on success, < 0 on error with errno set:
    16931789 *                  - EBADF  filedes is bad.
     
    17091805 * @param url       The smb url of the file or directory to change
    17101806 *                  permissions of
    1711  * 
     1807 *
    17121808 * @param mode      The permissions to set:
    17131809 *                  - Put good explaination of permissions here!
     
    17711867 * @param url       The smb url of the file or directory to set extended
    17721868 *                  attributes for.
    1773  * 
     1869 *
    17741870 * @param name      The name of an attribute to be changed.  Names are of
    17751871 *                  one of the following forms:
     
    18811977 * @param url       The smb url of the file or directory to set extended
    18821978 *                  attributes for.
    1883  * 
     1979 *
    18841980 * @param name      The name of an attribute to be changed.  Names are of
    18851981 *                  one of the following forms:
     
    19882084 *                  previously returned by smbc_open(), to get extended
    19892085 *                  attributes for.
    1990  * 
     2086 *
    19912087 * @param name      The name of an attribute to be changed.  Names are of
    19922088 *                  one of the following forms:
     
    20932189 * @param url       The smb url of the file or directory to get extended
    20942190 *                  attributes for.
    2095  * 
     2191 *
    20962192 * @param name      The name of an attribute to be retrieved.  Names are of
    20972193 *                  one of the following forms:
     
    21292225 *                  required to hold the attribute value will be returned,
    21302226 *                  but nothing will be placed into the value buffer.
    2131  * 
     2227 *
    21322228 * @return          0 on success, < 0 on error with errno set:
    21332229 *                  - EINVAL  The client library is not properly initialized
     
    21582254 * @param url       The smb url of the file or directory to get extended
    21592255 *                  attributes for.
    2160  * 
     2256 *
    21612257 * @param name      The name of an attribute to be retrieved.  Names are of
    21622258 *                  one of the following forms:
     
    21942290 *                  required to hold the attribute value will be returned,
    21952291 *                  but nothing will be placed into the value buffer.
    2196  * 
     2292 *
    21972293 * @return          0 on success, < 0 on error with errno set:
    21982294 *                  - EINVAL  The client library is not properly initialized
     
    22212317 *                  previously returned by smbc_open(), to get extended
    22222318 *                  attributes for.
    2223  * 
     2319 *
    22242320 * @param name      The name of an attribute to be retrieved.  Names are of
    22252321 *                  one of the following forms:
     
    22572353 *                  required to hold the attribute value will be returned,
    22582354 *                  but nothing will be placed into the value buffer.
    2259  * 
     2355 *
    22602356 * @return          0 on success, < 0 on error with errno set:
    22612357 *                  - EINVAL  The client library is not properly initialized
     
    22842380 * @param url       The smb url of the file or directory to remove the extended
    22852381 *                  attributes for.
    2286  * 
     2382 *
    22872383 * @param name      The name of an attribute to be removed.  Names are of
    22882384 *                  one of the following forms:
     
    23342430 * @param url       The smb url of the file or directory to remove the extended
    23352431 *                  attributes for.
    2336  * 
     2432 *
    23372433 * @param name      The name of an attribute to be removed.  Names are of
    23382434 *                  one of the following forms:
     
    23822478 *                  previously returned by smbc_open(), to get extended
    23832479 *                  attributes for.
    2384  * 
     2480 *
    23852481 * @param name      The name of an attribute to be removed.  Names are of
    23862482 *                  one of the following forms:
     
    24372533 *                  required to hold all of the attribute names will be
    24382534 *                  returned, but nothing will be placed into the list buffer.
    2439  * 
     2535 *
    24402536 * @return          0 on success, < 0 on error with errno set:
    24412537 *                  - EINVAL The client library is not properly initialized
     
    24752571 *                  required to hold all of the attribute names will be
    24762572 *                  returned, but nothing will be placed into the list buffer.
    2477  * 
     2573 *
    24782574 * @return          0 on success, < 0 on error with errno set:
    24792575 *                  - EINVAL The client library is not properly initialized
     
    25012597 *                  previously returned by smbc_open(), to get extended
    25022598 *                  attributes for.
    2503  * 
     2599 *
    25042600 * @param list      A pointer to a buffer in which the list of attributes for
    25052601 *                  the specified file or directory will be placed (unless
     
    25102606 *                  required to hold all of the attribute names will be
    25112607 *                  returned, but nothing will be placed into the list buffer.
    2512  * 
     2608 *
    25132609 * @return          0 on success, < 0 on error with errno set:
    25142610 *                  - EINVAL The client library is not properly initialized
     
    25322628/**@ingroup print
    25332629 * Print a file given the name in fname. It would be a URL ...
    2534  * 
     2630 *
    25352631 * @param fname     The URL of a file on a remote SMB server that the
    25362632 *                  caller wants printed
     
    25382634 * @param printq    The URL of the print share to print the file to.
    25392635 *
    2540  * @return          0 on success, < 0 on error with errno set:         
     2636 * @return          0 on success, < 0 on error with errno set:
    25412637 *
    25422638 *                  - EINVAL fname or printq was NULL or smbc_init not
     
    25442640 *                  and errors returned by smbc_open
    25452641 *
    2546  */                                     
     2642 */
    25472643int smbc_print_file(const char *fname, const char *printq);
    25482644
     
    25632659
    25642660/**@ingroup print
    2565  * List the print jobs on a print share, for the moment, pass a callback 
     2661 * List the print jobs on a print share, for the moment, pass a callback
    25662662 *
    25672663 * @param purl      The url of the print share to list the jobs of
    2568  * 
     2664 *
    25692665 * @param fn        Callback function the receives printjob info
    2570  * 
    2571  * @return          0 on success, < 0 on error with errno set: 
     2666 *
     2667 * @return          0 on success, < 0 on error with errno set:
    25722668 *                  - EINVAL fname was NULL or smbc_init not called
    25732669 *                  - EACCES ???
     
    25762672
    25772673/**@ingroup print
    2578  * Delete a print job 
     2674 * Delete a print job
    25792675 *
    25802676 * @param purl      Url of the print share
     
    25822678 * @param id        The id of the job to delete
    25832679 *
    2584  * @return          0 on success, < 0 on error with errno set: 
     2680 * @return          0 on success, < 0 on error with errno set:
    25852681 *                  - EINVAL fname was NULL or smbc_init not called
    25862682 *
     
    26112707 *                  string should be placed.  This may be a pointer to the
    26122708 *                  same buffer as src_segment.
    2613  * 
     2709 *
    26142710 * @param src       A pointer to the buffer containing the URL to be decoded.
    26152711 *                  Any %xx sequences herein are converted to their single
     
    26192715 * @param max_dest_len
    26202716 *                  The size of the buffer pointed to by dest_segment.
    2621  * 
     2717 *
    26222718 * @return          The number of % sequences which could not be converted
    26232719 *                  due to lack of two following hexadecimal digits.
     
    26402736 *                  string should be placed.  Unlike smbc_urldecode(), this
    26412737 *                  must be a buffer unique from src.
    2642  * 
     2738 *
    26432739 * @param src       A pointer to the buffer containing the string to be encoded.
    26442740 *                  Any character not specifically allowed in a URL is converted
     
    26472743 * @param max_dest_len
    26482744 *                  The size of the buffer pointed to by dest_segment.
    2649  * 
     2745 *
    26502746 * @returns         The remaining buffer length.
    26512747 */
     
    27042800 * Wrapper around smbc_set_credentials.
    27052801 * Used to set correct credentials that will
    2706  * be used to connect to DFS target share 
     2802 * be used to connect to DFS target share
    27072803 * in libsmbclient
    27082804 */
     
    28072903                          int lock_type,
    28082904                          const char *location),
    2809    
     2905
    28102906        /* Thread local storage. */
    28112907        int (*create_tls)(const char *keyname,
     
    28252921/**
    28262922 * @ingroup structure
    2827  * Structure that contains a client context information 
     2923 * Structure that contains a client context information
    28282924 * This structure is known as SMBCCTX
    28292925 *
     
    28472943         */
    28482944        int     debug DEPRECATED_SMBC_INTERFACE;
    2849        
     2945
    28502946        /**
    28512947         * netbios name used for making connections
     
    28892985         * Use smbc_getFunction*() and smbc_setFunction*(), e.g.
    28902986         * smbc_getFunctionOpen(), smbc_setFunctionUnlink(), etc.
    2891          */ 
     2987         */
    28922988        smbc_open_fn                    open DEPRECATED_SMBC_INTERFACE;
    28932989        smbc_creat_fn                   creat DEPRECATED_SMBC_INTERFACE;
     
    29423038                 */
    29433039                smbc_get_auth_data_fn auth_fn DEPRECATED_SMBC_INTERFACE;
    2944                
     3040
    29453041                /**
    29463042                 * check if a server is still good
     
    29703066
    29713067                /**
    2972                  * server cache addition 
     3068                 * server cache addition
    29733069                 *
    29743070                 * DEPRECATED:
     
    29793075
    29803076                /**
    2981                  * server cache lookup 
     3077                 * server cache lookup
    29823078                 *
    29833079                 * DEPRECATED:
     
    29953091                 */
    29963092                smbc_remove_cached_srv_fn remove_cached_srv_fn DEPRECATED_SMBC_INTERFACE;
    2997                
     3093
    29983094                /**
    29993095                 * server cache purging, try to remove all cached servers
     
    30173113        /*
    30183114         * Very old configuration options.
    3019          * 
     3115         *
    30203116         * DEPRECATED:
    30213117         * Use one of the following functions instead:
     
    30283124         */
    30293125        int flags DEPRECATED_SMBC_INTERFACE;
    3030        
     3126
    30313127        /**
    30323128         * user options selections that apply to this session
     
    30433139                int one_share_per_server DEPRECATED_SMBC_INTERFACE;
    30443140        } options DEPRECATED_SMBC_INTERFACE;
    3045        
     3141
    30463142        /** INTERNAL DATA
    30473143         * do _NOT_ touch this from your program !
  • vendor/current/source3/include/local.h

    r746 r988  
    55#ifndef _LOCAL_H
    66#define _LOCAL_H
    7 
    8 /* The default workgroup - usually overridden in smb.conf */
    9 #ifndef WORKGROUP
    10 #define WORKGROUP "WORKGROUP"
    11 #endif
    12 
    13 /* This defines the section name in the configuration file that will contain */
    14 /* global parameters - that is, parameters relating to the whole server, not */
    15 /* just services. This name is then reserved, and may not be used as a       */
    16 /* a service name. It will default to "global" if not defined here.          */
    17 #define GLOBAL_NAME "global"
    18 #define GLOBAL_NAME2 "globals"
    19 
    20 /* This defines the section name in the configuration file that will
    21    refer to the special "homes" service */
    22 #define HOMES_NAME "homes"
    23 
    24 /* This defines the section name in the configuration file that will
    25    refer to the special "printers" service */
    26 #define PRINTERS_NAME "printers"
    277
    288/* Yves Gaige <yvesg@hptnodur.grenoble.hp.com> requested this set this       */
     
    4828
    4929#ifndef MAX_OPEN_FUDGEFACTOR
    50 #define MAX_OPEN_FUDGEFACTOR 20
     30#define MAX_OPEN_FUDGEFACTOR 40
    5131#endif
    5232
     
    10080   NT file manager window? */
    10181#define FSTYPE_STRING "NTFS"
    102 
    103 /* the default guest account - normally set in the Makefile or smb.conf */
    104 #ifndef GUEST_ACCOUNT
    105 #define GUEST_ACCOUNT "nobody"
    106 #endif
    10782
    10883/* user to test password server with as invalid in security=server mode. */
     
    172147#define USE_READ_PREDICTION 0
    173148
    174 /*
    175  * Default passwd chat script.
    176  */
    177 
    178 #define DEFAULT_PASSWD_CHAT "*new*password* %n\\n *new*password* %n\\n *changed*"
    179 
    180149/* Minimum length of allowed password when changing UNIX password. */
    181150#define MINPASSWDLENGTH 5
    182151
    183 /* maximum ID number used for session control. This cannot be larger
    184    than 62*62 for the current code */
    185 #define MAX_SESSION_ID 3000
    186 
    187 /* For the benifit of PAM and the 'session exec' scripts, we fake up a terminal
    188    name. This can be in one of two forms:  The first for systems not using
    189    utmp (and therefore not constrained as to length or the need for a number
    190    < 3000 or so) and the second for systems with this 'well behaved terminal
    191    like name' constraint.
    192 */
    193 
    194 #ifndef SESSION_TEMPLATE
    195 /* Paramaters are 'pid' and 'vuid' */
    196 #define SESSION_TEMPLATE "smb/%lu/%d"
    197 #endif
    198 
    199 #ifndef SESSION_UTMP_TEMPLATE
    200 #define SESSION_UTMP_TEMPLATE "smb/%d"
    201 #endif
    202 
    203152/* the maximum age in seconds of a password. Should be a lp_ parameter */
    204153#define MAX_PASSWORD_AGE (21*24*60*60)
     
    212161/* this enables the "rabbit pellet" fix for SMBwritebraw */
    213162#define RABBIT_PELLET_FIX 1
    214 
    215 /* Max number of jobs per print queue. */
    216 #define PRINT_MAX_JOBID 10000
    217163
    218164/* Max number of open RPC pipes. */
     
    248194
    249195/* Seconds between connection attempts to a remote server. */
    250 #define FAILED_CONNECTION_CACHE_TIMEOUT 30
     196#define FAILED_CONNECTION_CACHE_TIMEOUT (LONG_CONNECT_TIMEOUT * 2 / 1000)
    251197
    252198/* Default hash size for the winbindd cache. */
     
    259205#define MAX_RPC_DATA_SIZE (15*1024*1024)
    260206
    261 #define CLIENT_NDR_PADDING_SIZE 8
    262 #define SERVER_NDR_PADDING_SIZE 8
    263 
    264 #define DEFAULT_SMB2_MAX_READ (64*1024)
    265 #define DEFAULT_SMB2_MAX_WRITE (64*1024)
    266 #define DEFAULT_SMB2_MAX_TRANSACT (64*1024)
    267 #define DEFAULT_SMB2_MAX_CREDITS 8192
    268 
    269 #endif
     207/* A guestimate of how many domains winbindd will be contacting */
     208#ifndef WINBIND_MAX_DOMAINS_HINT
     209#define WINBIND_MAX_DOMAINS_HINT 10
     210#endif
     211#endif
  • vendor/current/source3/include/locking.h

    r740 r988  
    1 /* 
     1/*
    22   Unix SMB/CIFS implementation.
    33   SMB parameters and setup, plus a whole lot more.
    4    
     4
    55   Copyright (C) Jeremy Allison   2006
    6    
     6
    77   This program is free software; you can redistribute it and/or modify
    88   it under the terms of the GNU General Public License as published by
    99   the Free Software Foundation; either version 3 of the License, or
    1010   (at your option) any later version.
    11    
     11
    1212   This program is distributed in the hope that it will be useful,
    1313   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1414   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1515   GNU General Public License for more details.
    16    
     16
    1717   You should have received a copy of the GNU General Public License
    1818   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    4040struct lock_context {
    4141        uint64_t smblctx;
    42         uint16 tid;
     42        uint32_t tid;
    4343        struct server_id pid;
    4444};
     
    4646struct files_struct;
    4747
    48 #include "../librpc/gen_ndr/file_id.h"
     48#include "lib/file_id.h"
    4949
    50 struct byte_range_lock {
    51         struct files_struct *fsp;
    52         unsigned int num_locks;
    53         bool modified;
    54         bool read_only;
    55         struct file_id key;
    56         struct lock_struct *lock_data;
    57         struct db_record *record;
    58 };
     50struct byte_range_lock;
    5951
    60 /* Internal structure in brlock.tdb. 
     52/* Internal structure in brlock.tdb.
    6153   The data in brlock records is an unsorted linear array of these
    6254   records.  It is unnecessary to store the count as tdb provides the
     
    6759        br_off start;
    6860        br_off size;
    69         uint16 fnum;
     61        uint64_t fnum;
    7062        enum brl_type lock_type;
    7163        enum brl_flavour lock_flav;
     
    9991};
    10092
     93struct share_mode_lock {
     94        struct share_mode_data *data;
     95};
     96
    10197#endif /* _LOCKING_H_ */
  • vendor/current/source3/include/messages.h

    r740 r988  
    44   Copyright (C) Andrew Tridgell 2000
    55   Copyright (C) 2001, 2002 by Martin Pool
    6    
     6
    77   This program is free software; you can redistribute it and/or modify
    88   it under the terms of the GNU General Public License as published by
    99   the Free Software Foundation; either version 3 of the License, or
    1010   (at your option) any later version.
    11    
     11
    1212   This program is distributed in the hope that it will be useful,
    1313   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1414   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1515   GNU General Public License for more details.
    16    
     16
    1717   You should have received a copy of the GNU General Public License
    1818   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    4343#define FLAG_MSG_SMBD                   0x0002
    4444#define FLAG_MSG_NMBD                   0x0004
    45 #define FLAG_MSG_PRINT_NOTIFY           0x0008
     45#define FLAG_MSG_WINBIND                0x0008
    4646#define FLAG_MSG_PRINT_GENERAL          0x0010
    4747/* dbwrap messages 4001-4999 */
    4848#define FLAG_MSG_DBWRAP                 0x0020
    49 
    50 
    51 /*
    52  * Virtual Node Numbers are identifying a node within a cluster. Ctdbd sets
    53  * this, we retrieve our vnn from it.
    54  */
    55 
    56 #define NONCLUSTER_VNN (0xFFFFFFFF)
    5749
    5850/*
     
    6860
    6961#include "librpc/gen_ndr/server_id.h"
     62#include "lib/util/data_blob.h"
     63#include "system/network.h"
    7064
    71 #ifdef CLUSTER_SUPPORT
    7265#define MSG_BROADCAST_PID_STR   "0:0"
    73 #else
    74 #define MSG_BROADCAST_PID_STR   "0"
    75 #endif
    7666
    7767struct messaging_context;
    7868struct messaging_rec;
    7969
    80 /*
    81  * struct messaging_context belongs to messages.c, but because we still have
    82  * messaging_dispatch, we need it here. Once we get rid of signals for
    83  * notifying processes, this will go.
    84  */
    85 
    86 struct messaging_context {
    87         struct server_id id;
    88         struct event_context *event_ctx;
    89         struct messaging_callback *callbacks;
    90 
    91         struct messaging_backend *local;
    92         struct messaging_backend *remote;
    93 };
    94 
    9570struct messaging_backend {
    96         NTSTATUS (*send_fn)(struct messaging_context *msg_ctx,
    97                             struct server_id pid, int msg_type,
    98                             const DATA_BLOB *data,
    99                             struct messaging_backend *backend);
     71        int (*send_fn)(struct server_id src,
     72                       struct server_id pid, int msg_type,
     73                       const struct iovec *iov, int iovlen,
     74                       const int *fds, size_t num_fds,
     75                       struct messaging_backend *backend);
    10076        void *private_data;
    10177};
    10278
    103 NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
    104                             TALLOC_CTX *mem_ctx,
    105                             struct messaging_backend **presult);
    106 
    107 bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx);
    108 
    109 NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
    110                               TALLOC_CTX *mem_ctx,
    111                               struct messaging_backend **presult);
     79int messaging_ctdbd_init(struct messaging_context *msg_ctx,
     80                         TALLOC_CTX *mem_ctx,
     81                         struct messaging_backend **presult);
    11282struct ctdbd_connection *messaging_ctdbd_connection(void);
    11383
     
    11686                      const void *buf, size_t len,
    11787                      int *n_sent);
    118 struct event_context *messaging_event_context(struct messaging_context *msg_ctx);
    11988struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
    120                                          struct server_id server_id,
    121                                          struct event_context *ev);
     89                                         struct tevent_context *ev);
    12290
    12391struct server_id messaging_server_id(const struct messaging_context *msg_ctx);
     92struct tevent_context *messaging_tevent_context(
     93        struct messaging_context *msg_ctx);
     94struct server_id_db *messaging_names_db(struct messaging_context *msg_ctx);
    12495
    12596/*
    12697 * re-init after a fork
    12798 */
    128 NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
    129                           struct server_id id);
     99NTSTATUS messaging_reinit(struct messaging_context *msg_ctx);
    130100
    131101NTSTATUS messaging_register(struct messaging_context *msg_ctx,
     
    139109void messaging_deregister(struct messaging_context *ctx, uint32_t msg_type,
    140110                          void *private_data);
     111
     112/**
     113 * CAVEAT:
     114 *
     115 * While the messaging_send*() functions are synchronuous by API,
     116 * they trigger a tevent-based loop upon sending bigger messages.
     117 *
     118 * Hence callers should not use these in purely synchonous code,
     119 * but run a tevent_loop instead.
     120 */
    141121NTSTATUS messaging_send(struct messaging_context *msg_ctx,
    142122                        struct server_id server,
    143123                        uint32_t msg_type, const DATA_BLOB *data);
     124
    144125NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
    145126                            struct server_id server, uint32_t msg_type,
    146                             const uint8 *buf, size_t len);
    147 void messaging_dispatch_rec(struct messaging_context *msg_ctx,
    148                             struct messaging_rec *rec);
     127                            const uint8_t *buf, size_t len);
     128int messaging_send_iov_from(struct messaging_context *msg_ctx,
     129                            struct server_id src, struct server_id dst,
     130                            uint32_t msg_type,
     131                            const struct iovec *iov, int iovlen,
     132                            const int *fds, size_t num_fds);
     133NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
     134                            struct server_id server, uint32_t msg_type,
     135                            const struct iovec *iov, int iovlen,
     136                            const int *fds, size_t num_fds);
     137
     138struct tevent_req *messaging_filtered_read_send(
     139        TALLOC_CTX *mem_ctx, struct tevent_context *ev,
     140        struct messaging_context *msg_ctx,
     141        bool (*filter)(struct messaging_rec *rec, void *private_data),
     142        void *private_data);
     143int messaging_filtered_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
     144                                 struct messaging_rec **presult);
     145
     146struct tevent_req *messaging_read_send(TALLOC_CTX *mem_ctx,
     147                                       struct tevent_context *ev,
     148                                       struct messaging_context *msg,
     149                                       uint32_t msg_type);
     150int messaging_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
     151                        struct messaging_rec **presult);
     152
     153struct tevent_req *messaging_handler_send(
     154        TALLOC_CTX *mem_ctx, struct tevent_context *ev,
     155        struct messaging_context *msg_ctx, uint32_t msg_type,
     156        bool (*handler)(struct messaging_context *msg_ctx,
     157                        struct messaging_rec **rec, void *private_data),
     158        void *private_data);
     159int messaging_handler_recv(struct tevent_req *req);
     160
     161int messaging_cleanup(struct messaging_context *msg_ctx, pid_t pid);
     162
     163bool messaging_parent_dgm_cleanup_init(struct messaging_context *msg);
    149164
    150165#include "librpc/gen_ndr/ndr_messaging.h"
  • vendor/current/source3/include/msdfs.h

    r740 r988  
    3939
    4040struct client_dfs_referral {
    41         uint32 proximity;
    42         uint32 ttl;
     41        uint32_t proximity;
     42        uint32_t ttl;
    4343        char *dfspath;
    4444};
     
    4646struct referral {
    4747        char *alternate_path; /* contains the path referred */
    48         uint32 proximity;
    49         uint32 ttl; /* how long should client cache referral */
     48        uint32_t proximity;
     49        uint32_t ttl; /* how long should client cache referral */
    5050};
    5151
  • vendor/current/source3/include/nameserv.h

    r414 r988  
    200200
    201201struct nmb_data {
    202         uint16 nb_flags;         /* Netbios flags. */
     202        uint16_t nb_flags;       /* Netbios flags. */
    203203        int num_ips;             /* Number of ip entries. */
    204204        struct in_addr *ip;      /* The ip list for this name. */
     
    233233};
    234234
     235/* used for server information: client, nameserv and ipc */
     236struct server_info_struct {
     237        fstring name;
     238        uint32_t type;
     239        fstring comment;
     240        fstring domain; /* used ONLY in ipc.c NOT namework.c */
     241        bool server_added; /* used ONLY in ipc.c NOT namework.c */
     242};
     243
    235244/* This is used to hold the list of servers in my domain, and is
    236245   contained within lists of domains. */
     
    281290        bool    needelection;
    282291        int     ElectionCount;
    283         uint32  ElectionCriterion;
     292        uint32_t  ElectionCriterion;
    284293
    285294        /* Domain master browser info. Used for efficient syncs. */
     
    329338                                                struct userdata_struct *,
    330339                                                struct nmb_name *,
    331                                                 uint16,
     340                                                uint16_t,
    332341                                                int,
    333342                                                struct in_addr);
     
    347356                                               struct userdata_struct *,
    348357                                               struct nmb_name *,
    349                                                uint16,
     358                                               uint16_t,
    350359                                               int,
    351360                                               struct in_addr);
     
    378387        struct response_record *prev;
    379388
    380         uint16 response_id;
     389        uint16_t response_id;
    381390
    382391        /* Callbacks for packets received or not. */
  • vendor/current/source3/include/nt_printing.h

    r860 r988  
    6868
    6969/* Notify spoolss clients that something has changed.  The
    70    notification data is either stored in two uint32 values or a
     70   notification data is either stored in two uint32_t values or a
    7171   variable length array. */
    7272
     
    7575typedef struct spoolss_notify_msg {
    7676        fstring printer;        /* Name of printer notified */
    77         uint32 type;            /* Printer or job notify */
    78         uint32 field;           /* Notify field changed */
    79         uint32 id;              /* Job id */
    80         uint32 len;             /* Length of data, 0 for two uint32 value */
    81         uint32 flags;
     77        uint32_t type;          /* Printer or job notify */
     78        uint32_t field;         /* Notify field changed */
     79        uint32_t id;            /* Job id */
     80        uint32_t len;           /* Length of data, 0 for two uint32_t value */
     81        uint32_t flags;
    8282        union {
    83                 uint32 value[2];
     83                uint32_t value[2];
    8484                char *data;
    8585        } notify;
     
    8888typedef struct {
    8989        fstring                 printername;
    90         uint32                  num_msgs;
     90        uint32_t                num_msgs;
    9191        SPOOLSS_NOTIFY_MSG      *msgs;
    9292} SPOOLSS_NOTIFY_MSG_GROUP;
     
    9494typedef struct {
    9595        TALLOC_CTX                      *ctx;
    96         uint32                          num_groups;
     96        uint32_t                        num_groups;
    9797        SPOOLSS_NOTIFY_MSG_GROUP        *msg_groups;
    9898} SPOOLSS_NOTIFY_MSG_CTR;
     
    129129const char *get_short_archi(const char *long_archi);
    130130
    131 bool print_access_check(const struct auth_serversupplied_info *server_info,
    132                         struct messaging_context *msg_ctx, int snum,
    133                         int access_type);
     131WERROR print_access_check(const struct auth_session_info *server_info,
     132                          struct messaging_context *msg_ctx, int snum,
     133                          int access_type);
     134
     135WERROR nt_printer_guid_retrieve(TALLOC_CTX *mem_ctx, const char *printer,
     136                                struct GUID *pguid);
     137
     138WERROR nt_printer_guid_store(struct messaging_context *msg_ctx,
     139                             const char *printer, struct GUID guid);
    134140
    135141WERROR nt_printer_guid_get(TALLOC_CTX *mem_ctx,
    136                            const struct auth_serversupplied_info *server_info,
     142                           const struct auth_session_info *session_info,
    137143                           struct messaging_context *msg_ctx,
    138144                           const char *printer, struct GUID *guid);
    139145
    140146WERROR nt_printer_publish(TALLOC_CTX *mem_ctx,
    141                           const struct auth_serversupplied_info *server_info,
     147                          const struct auth_session_info *server_info,
    142148                          struct messaging_context *msg_ctx,
    143149                          struct spoolss_PrinterInfo2 *pinfo2,
     
    145151
    146152bool is_printer_published(TALLOC_CTX *mem_ctx,
    147                           const struct auth_serversupplied_info *server_info,
     153                          const struct auth_session_info *server_info,
    148154                          struct messaging_context *msg_ctx,
    149155                          const char *servername,
     
    153159WERROR check_published_printers(struct messaging_context *msg_ctx);
    154160
     161struct dcerpc_binding_handle;
     162
    155163bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
    156                            const struct auth_serversupplied_info *server_info,
    157                            struct messaging_context *msg_ctx,
     164                           struct dcerpc_binding_handle *b,
    158165                           const struct spoolss_DriverInfo8 *r);
    159166bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
    160                                  const struct auth_serversupplied_info *server_info,
    161                                  struct messaging_context *msg_ctx,
     167                                 struct dcerpc_binding_handle *b,
    162168                                 struct spoolss_DriverInfo8 *r);
    163 bool delete_driver_files(const struct auth_serversupplied_info *server_info,
     169bool delete_driver_files(const struct auth_session_info *server_info,
    164170                         const struct spoolss_DriverInfo8 *r);
    165171
    166 WERROR move_driver_to_download_area(struct auth_serversupplied_info *session_info,
     172WERROR move_driver_to_download_area(struct auth_session_info *session_info,
    167173                                    struct spoolss_AddDriverInfoCtr *r);
    168174
    169175WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
    170                               struct auth_serversupplied_info *session_info,
     176                              struct auth_session_info *session_info,
    171177                              struct spoolss_AddDriverInfoCtr *r);
    172178
     
    175181void map_job_permissions(struct security_descriptor *sd);
    176182
    177 bool print_time_access_check(const struct auth_serversupplied_info *server_info,
     183bool print_time_access_check(const struct auth_session_info *server_info,
    178184                             struct messaging_context *msg_ctx,
    179185                             const char *servicename);
    180186
    181187void nt_printer_remove(TALLOC_CTX *mem_ctx,
    182                         const struct auth_serversupplied_info *server_info,
     188                        const struct auth_session_info *server_info,
    183189                        struct messaging_context *msg_ctx,
    184190                        const char *printer);
    185191void nt_printer_add(TALLOC_CTX *mem_ctx,
    186                     const struct auth_serversupplied_info *server_info,
     192                    const struct auth_session_info *server_info,
    187193                    struct messaging_context *msg_ctx,
    188194                    const char *printer);
  • vendor/current/source3/include/ntdomain.h

    r919 r988  
    2222
    2323#ifndef _NT_DOMAIN_H /* _NT_DOMAIN_H */
    24 #define _NT_DOMAIN_H
    25 
    26 #include "librpc/rpc/dcerpc.h"
     24#define _NT_DOMAIN_H
    2725
    2826/*
     
    3129 */
    3230
    33 typedef struct _output_data {
    34         /*
    35          * Raw RPC output data. This does not include RPC headers or footers.
    36          */
    37         DATA_BLOB rdata;
    38 
    39         /* The amount of data sent from the current rdata struct. */
    40         uint32 data_sent_length;
    41 
    42         /*
    43          * The current fragment being returned. This inclues
    44          * headers, data and authentication footer.
    45          */
    46         DATA_BLOB frag;
    47 
    48         /* The amount of data sent from the current PDU. */
    49         uint32 current_pdu_sent;
    50 } output_data;
    51 
    52 typedef struct _input_data {
    53         /*
    54          * This is the current incoming pdu. The data here
    55          * is collected via multiple writes until a complete
    56          * pdu is seen, then the data is copied into the in_data
    57          * structure. The maximum size of this is 0x1630 (RPC_MAX_PDU_FRAG_LEN).
    58          * If length is zero, then we are at the start of a new
    59          * pdu.
    60          */
    61         DATA_BLOB pdu;
    62 
    63         /*
    64          * The amount of data needed to complete the in_pdu.
    65          * If this is zero, then we are at the start of a new
    66          * pdu.
    67          */
    68         uint32 pdu_needed_len;
    69 
    70         /*
    71          * This is the collection of input data with all
    72          * the rpc headers and auth footers removed.
    73          * The maximum length of this (1Mb) is strictly enforced.
    74          */
    75         DATA_BLOB data;
    76 
    77 } input_data;
    78 
    79 struct handle_list;
    80 
    81 typedef struct pipe_rpc_fns {
    82 
    83         struct pipe_rpc_fns *next, *prev;
    84 
    85         /* RPC function table associated with the current rpc_bind (associated by context) */
    86 
    87         const struct api_struct *cmds;
    88         int n_cmds;
    89         uint32 context_id;
    90         struct ndr_syntax_id syntax;
    91 
    92         /*
    93          * shall we allow "connect" auth level for this interface ?
    94          */
    95         bool allow_connect;
    96 } PIPE_RPC_FNS;
    97 
    98 /*
    99  * Different auth types we support.
    100  * Can't keep in sync with wire values as spnego wraps different auth methods.
    101  */
    102 
    10331struct gse_context;
    10432
    105 struct dcesrv_ep_entry_list;
    106 
    107 /*
    108  * DCE/RPC-specific samba-internal-specific handling of data on
    109  * NamedPipes.
    110  */
    111 
    112 struct pipes_struct {
    113         struct pipes_struct *next, *prev;
    114 
    115         struct client_address *client_id;
    116         struct client_address *server_id;
    117 
    118         enum dcerpc_transport_t transport;
    119 
    120         struct auth_serversupplied_info *session_info;
    121         struct messaging_context *msg_ctx;
    122 
    123         struct ndr_syntax_id syntax;
    124         struct dcesrv_ep_entry_list *ep_entries;
    125 
    126         /* linked list of rpc dispatch tables associated
    127            with the open rpc contexts */
    128 
    129         PIPE_RPC_FNS *contexts;
    130 
    131         struct pipe_auth_data auth;
    132 
    133         bool ncalrpc_as_system;
    134 
    135         /*
    136          * Set to true when an RPC bind has been done on this pipe.
    137          */
    138 
    139         bool pipe_bound;
    140 
    141         /*
    142          * States we can be in.
    143          */
    144         bool allow_alter;
    145         bool allow_bind;
    146         bool allow_auth3;
    147 
    148         /*
    149          * Set the DCERPC_FAULT to return.
    150          */
    151 
    152         int fault_state;
    153 
    154         /*
    155          * Set to RPC_BIG_ENDIAN when dealing with big-endian PDU's
    156          */
    157 
    158         bool endian;
    159 
    160         /*
    161          * Struct to deal with multiple pdu inputs.
    162          */
    163 
    164         input_data in_data;
    165 
    166         /*
    167          * Struct to deal with multiple pdu outputs.
    168          */
    169 
    170         output_data out_data;
    171 
    172         /* This context is used for PDU data and is freed between each pdu.
    173                 Don't use for pipe state storage. */
    174         TALLOC_CTX *mem_ctx;
    175 
    176         /* handle database to use on this pipe. */
    177         struct handle_list *pipe_handles;
    178 
    179         /* call id retrieved from the pdu header */
    180         uint32_t call_id;
    181 
    182         /* operation number retrieved from the rpc header */
    183         uint16_t opnum;
    184 
    185         /* private data for the interface implementation */
    186         void *private_data;
    187 
    188 };
    189 
    190 struct api_struct { 
    191         const char *name;
    192         uint8 opnum;
    193         bool (*fn) (struct pipes_struct *);
    194 };
    195 
    196 /* The following definitions come from rpc_server/rpc_handles.c  */
    197 
    198 size_t num_pipe_handles(struct pipes_struct *p);
    199 bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *syntax);
    200 bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
    201 bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
    202                         void **data_p);
    203 bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd);
    204 void close_policy_by_pipe(struct pipes_struct *p);
    205 bool pipe_access_check(struct pipes_struct *p);
    206 
    207 void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
    208                             uint32_t access_granted, size_t data_size,
    209                             const char *type, NTSTATUS *pstatus);
    210 #define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \
    211         (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \
    212                                        (_pstatus))
    213 
    214 void *_policy_handle_find(struct pipes_struct *p,
    215                           const struct policy_handle *hnd,
    216                           uint32_t access_required, uint32_t *paccess_granted,
    217                           const char *name, const char *location,
    218                           NTSTATUS *pstatus);
    219 #define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \
    220         (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \
    221                                      (_access_granted), #_type, __location__, (_pstatus))
     33#include "rpc_server/rpc_pipes.h"
    22234
    22335#include "rpc_server/srv_pipe_register.h"
  • vendor/current/source3/include/ntioctl.h

    r860 r988  
    33   NT ioctl code constants
    44   Copyright (C) Andrew Tridgell              2002
    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/>.
    18 */
    19 
    20 /*
    21   I'm guessing we will need to support a bunch of these eventually. For now
    22   we only need the sparse flag
    2318*/
    2419
     
    2621#define _NTIOCTL_H
    2722
    28 /* IOCTL information */
    29 /* List of ioctl function codes that look to be of interest to remote clients like this. */
    30 /* Need to do some experimentation to make sure they all work remotely.                  */
    31 /* Some of the following such as the encryption/compression ones would be                */
    32 /* invoked from tools via a specialized hook into the VFS rather than via the            */
    33 /* standard vfs entry points */
    34 #define FSCTL_LOCK_VOLUME            0x00090018
    35 #define FSCTL_UNLOCK_VOLUME          0x0009001C
    36 #define FSCTL_GET_COMPRESSION        0x0009003C
    37 #define FSCTL_SET_COMPRESSION        0x0009C040
    38 #define FSCTL_REQUEST_FILTER_OPLOCK  0x0009008C
    39 #define FSCTL_SET_ZERO_DATA          0x000900C8
    40 #define FSCTL_SET_ENCRYPTION         0x000900D7
    41 #define FSCTL_ENCRYPTION_FSCTL_IO    0x000900DB
    42 #define FSCTL_WRITE_RAW_ENCRYPTED    0x000900DF
    43 #define FSCTL_READ_RAW_ENCRYPTED     0x000900E3
    44 #define FSCTL_SIS_COPYFILE           0x00090100
    45 #define FSCTL_SIS_LINK_FILES         0x0009C104
    46 
    47 /* filesystem control codes */
    48 #define FSCTL_METHOD_BUFFERED   0x00000000
    49 #define FSCTL_METHOD_IN_DIRECT  0x00000001
    50 #define FSCTL_METHOD_OUT_DIRECT 0x00000002
    51 #define FSCTL_METHOD_NEITHER    0x00000003
    52 
    53 #define FSCTL_ACCESS_ANY        0x00000000
    54 #define FSCTL_ACCESS_READ       0x00004000
    55 #define FSCTL_ACCESS_WRITE      0x00008000
    56 
    57 #define FSCTL_DFS                       0x00060000
    58 #define FSCTL_DFS_GET_REFERRALS         (FSCTL_DFS | FSCTL_ACCESS_ANY | 0x0194 | FSCTL_METHOD_BUFFERED)
    59 #define FSCTL_DFS_GET_REFERRALS_EX      (FSCTL_DFS | FSCTL_ACCESS_ANY | 0x01B0 | FSCTL_METHOD_BUFFERED)
    60 
    61 #define FSCTL_FILESYSTEM                0x00090000
    62 #define FSCTL_REQUEST_OPLOCK_LEVEL_1    (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0000 | FSCTL_METHOD_BUFFERED)
    63 #define FSCTL_REQUEST_OPLOCK_LEVEL_2    (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0004 | FSCTL_METHOD_BUFFERED)
    64 #define FSCTL_REQUEST_BATCH_OPLOCK      (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0008 | FSCTL_METHOD_BUFFERED)
    65 #define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE  (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x000C | FSCTL_METHOD_BUFFERED)
    66 #define FSCTL_OPBATCH_ACK_CLOSE_PENDING (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0010 | FSCTL_METHOD_BUFFERED)
    67 #define FSCTL_OPLOCK_BREAK_NOTIFY       (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0014 | FSCTL_METHOD_BUFFERED)
    68 #define FSCTL_FILESYS_GET_STATISTICS    (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0060 | FSCTL_METHOD_BUFFERED)
    69 #define FSCTL_GET_NTFS_VOLUME_DATA      (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0064 | FSCTL_METHOD_BUFFERED)
    70 #define FSCTL_IS_VOLUME_DIRTY           (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0078 | FSCTL_METHOD_BUFFERED)
    71 #define FSCTL_FIND_FILES_BY_SID         (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x008C | FSCTL_METHOD_NEITHER)
    72 #define FSCTL_SET_OBJECT_ID             (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0098 | FSCTL_METHOD_BUFFERED)
    73 #define FSCTL_GET_OBJECT_ID             (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x009C | FSCTL_METHOD_BUFFERED)
    74 #define FSCTL_DELETE_OBJECT_ID          (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00A0 | FSCTL_METHOD_BUFFERED)
    75 #define FSCTL_SET_REPARSE_POINT         (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00A4 | FSCTL_METHOD_BUFFERED)
    76 #define FSCTL_GET_REPARSE_POINT         (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00A8 | FSCTL_METHOD_BUFFERED)
    77 #define FSCTL_DELETE_REPARSE_POINT      (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00AC | FSCTL_METHOD_BUFFERED)
    78 #define FSCTL_CREATE_OR_GET_OBJECT_ID   (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00C0 | FSCTL_METHOD_BUFFERED)
    79 #define FSCTL_SET_SPARSE                (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00C4 | FSCTL_METHOD_BUFFERED)
    80 #define FSCTL_QUERY_ALLOCATED_RANGES    (FSCTL_FILESYSTEM | FSCTL_ACCESS_READ | 0x00CC | FSCTL_METHOD_NEITHER)
    81 #define FSCTL_FILE_LEVEL_TRIM           (FSCTL_FILESYSTEM | FSCTL_ACCESS_WRITE | 0x0208 | FSCTL_METHOD_BUFFERED)
    82 #define FSCTL_OFFLOAD_READ              (FSCTL_FILESYSTEM | FSCTL_ACCESS_READ | 0x0264 | FSCTL_METHOD_BUFFERED)
    83 #define FSCTL_OFFLOAD_WRITE             (FSCTL_FILESYSTEM | FSCTL_ACCESS_WRITE | 0x0268 | FSCTL_METHOD_BUFFERED)
    84 
    85 #define FSCTL_NAMED_PIPE                0x00110000
    86 #define FSCTL_PIPE_PEEK                 (FSCTL_NAMED_PIPE | FSCTL_ACCESS_READ | 0x000C | FSCTL_METHOD_BUFFERED)
    87 #define FSCTL_NAMED_PIPE_READ_WRITE     (FSCTL_NAMED_PIPE | FSCTL_ACCESS_READ \
    88                                                           | FSCTL_ACCESS_WRITE | 0x0014 | FSCTL_METHOD_NEITHER)
    89 #define FSCTL_PIPE_TRANSCEIVE           FSCTL_NAMED_PIPE_READ_WRITE     /* SMB2 function name */
    90 #define FSCTL_PIPE_WAIT                 (FSCTL_NAMED_PIPE | FSCTL_ACCESS_ANY | 0x0018 | FSCTL_METHOD_BUFFERED)
    91 
    92 #define FSCTL_NETWORK_FILESYSTEM        0x00140000
    93 #define FSCTL_GET_SHADOW_COPY_DATA      (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_READ | 0x0064 | FSCTL_METHOD_BUFFERED)
    94 #define FSCTL_SRV_ENUM_SNAPS            FSCTL_GET_SHADOW_COPY_DATA      /* SMB2 function name */
    95 #define FSCTL_SRV_REQUEST_RESUME_KEY    (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0078 | FSCTL_METHOD_BUFFERED)
    96 #define FSCTL_SRV_COPYCHUNK             (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_READ | 0x00F0 | FSCTL_METHOD_OUT_DIRECT)
    97 #define FSCTL_SRV_COPYCHUNK_WRITE       (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_WRITE | 0x00F0 | FSCTL_METHOD_OUT_DIRECT)
    98 #define FSCTL_SRV_READ_HASH             (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_READ| 0x01B8 | FSCTL_METHOD_NEITHER)
    99 #define FSCTL_LMR_REQ_RESILIENCY        (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x01D4 | FSCTL_METHOD_BUFFERED)
    100 #define FSCTL_LMR_SET_LINK_TRACKING_INFORMATION \
    101         (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00EC | FSCTL_METHOD_BUFFERED)
    102 #define FSCTL_QUERY_NETWORK_INTERFACE_INFO \
    103         (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x01FC | FSCTL_METHOD_BUFFERED)
    104 
    105 /*
    106  * FSCTL_VALIDATE_NEGOTIATE_INFO_224 was used used in
    107  * Windows 8 server beta with SMB 2.24
    108  */
    109 #define FSCTL_VALIDATE_NEGOTIATE_INFO_224 \
    110         (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0200 | FSCTL_METHOD_BUFFERED)
    111 #define FSCTL_VALIDATE_NEGOTIATE_INFO   (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0204 | FSCTL_METHOD_BUFFERED)
    112 
    113 #if 0
    114 #define FSCTL_SECURITY_ID_CHECK
    115 #define FSCTL_DISMOUNT_VOLUME
    116 #define FSCTL_GET_NTFS_FILE_RECORD
    117 #define FSCTL_ALLOW_EXTENDED_DASD_IO
    118 #define FSCTL_RECALL_FILE
    119 
    120 #endif
     23#define IO_REPARSE_TAG_SYMLINK       0xA000000C
     24#define SYMLINK_FLAG_RELATIVE        0x00000001
    12125
    12226#define IO_REPARSE_TAG_MOUNT_POINT   0xA0000003
     
    13135struct shadow_copy_data {
    13236        /* Total number of shadow volumes currently mounted */
    133         uint32 num_volumes;
     37        uint32_t num_volumes;
    13438        /* Concatenated list of labels */
    13539        SHADOW_COPY_LABEL *labels;
  • vendor/current/source3/include/ntquotas.h

    r740 r988  
    6464        SMB_USER_QUOTA_TYPE = 2,
    6565        SMB_GROUP_FS_QUOTA_TYPE = 3,/* not used yet */
    66         SMB_GROUP_QUOTA_TYPE = 4 /* not in use yet, maybe for disk_free queries */
     66        SMB_GROUP_QUOTA_TYPE = 4 /* used by disk_free queries */
    6767};
    6868
     
    7272        uint64_t softlim;
    7373        uint64_t hardlim;
    74         uint32 qflags;
     74        uint32_t qflags;
    7575        struct dom_sid sid;
    7676} SMB_NTQUOTA_STRUCT;
  • vendor/current/source3/include/passdb.h

    r740 r988  
    2424#define _PASSDB_H
    2525
     26#ifndef NT_HASH_LEN
     27#define NT_HASH_LEN 16
     28#endif
     29
     30#ifndef LM_HASH_LEN
     31#define LM_HASH_LEN 16
     32#endif
     33
    2634#include "../librpc/gen_ndr/lsa.h"
    27 
    28 #include "mapping.h"
     35#include <tevent.h>
     36struct unixid;
     37struct cli_credentials;
     38
     39/* group mapping headers */
     40
     41#define ENUM_ONLY_MAPPED True
     42#define ENUM_ALL_MAPPED False
     43
     44typedef struct _GROUP_MAP {
     45        struct pdb_methods *methods;
     46        gid_t gid;
     47        struct dom_sid sid;
     48        enum lsa_SidType sid_name_use;
     49        char *nt_name;
     50        char *comment;
     51} GROUP_MAP;
     52
     53struct acct_info {
     54        char *acct_name; /* account name */
     55        char *acct_desc; /* account name */
     56        uint32_t rid; /* domain-relative RID */
     57};
     58
     59/* The following definitions come from groupdb/mapping.c  */
     60
     61NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
     62bool get_domain_group_from_sid(struct dom_sid sid, GROUP_MAP *map);
     63int smb_create_group(const char *unix_group, gid_t *new_gid);
     64int smb_delete_group(const char *unix_group);
     65int smb_set_primary_group(const char *unix_group, const char* unix_user);
     66int smb_add_user_group(const char *unix_group, const char *unix_user);
     67int smb_delete_user_group(const char *unix_group, const char *unix_user);
     68NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
     69                                 struct dom_sid sid);
     70NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
     71                                 gid_t gid);
     72NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
     73                                 const char *name);
     74NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
     75                                                GROUP_MAP *map);
     76NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
     77                                                   GROUP_MAP *map);
     78NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
     79                                                   struct dom_sid sid);
     80NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
     81                                        const struct dom_sid *sid,
     82                                        enum lsa_SidType sid_name_use,
     83                                        GROUP_MAP ***pp_rmap,
     84                                        size_t *p_num_entries,
     85                                        bool unix_only);
     86NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
     87                                  const char *name, uint32_t *rid);
     88NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
     89                                  const struct dom_sid *sid);
     90NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
     91                                   const struct dom_sid *sid,
     92                                   struct acct_info *info);
     93NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
     94                                   const struct dom_sid *sid,
     95                                   struct acct_info *info);
     96NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
     97                                  const struct dom_sid *alias, const struct dom_sid *member);
     98NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
     99                                  const struct dom_sid *alias, const struct dom_sid *member);
     100NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
     101                                   const struct dom_sid *alias, TALLOC_CTX *mem_ctx,
     102                                   struct dom_sid **pp_members,
     103                                   size_t *p_num_members);
     104NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
     105                                       TALLOC_CTX *mem_ctx,
     106                                       const struct dom_sid *domain_sid,
     107                                       const struct dom_sid *members,
     108                                       size_t num_members,
     109                                       uint32_t **pp_alias_rids,
     110                                       size_t *p_num_alias_rids);
     111NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
     112                                 struct dom_sid sid);
     113NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
     114                                 gid_t gid);
     115NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
     116                                 const char *name);
     117NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
     118                                                GROUP_MAP *map);
     119NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
     120                                                   GROUP_MAP *map);
     121NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
     122                                                   struct dom_sid sid);
     123NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
     124                                           enum lsa_SidType sid_name_use,
     125                                           GROUP_MAP **rmap, size_t *num_entries,
     126                                           bool unix_only);
     127NTSTATUS pdb_create_builtin_alias(uint32_t rid, gid_t gid);
     128
     129
     130/* passdb headers */
    29131
    30132/**********************************************************************
     
    84186        PDB_BAD_PASSWORD_TIME,
    85187        PDB_CANCHANGETIME,
    86         PDB_MUSTCHANGETIME,
    87188        PDB_PLAINTEXT_PW,
    88189        PDB_USERNAME,
     
    168269        time_t pass_last_set_time;    /* password last set time */
    169270        time_t pass_can_change_time;  /* password can change time */
    170         time_t pass_must_change_time; /* password must change time */
    171271
    172272        const char *username;     /* UNIX username string */
     
    218318};
    219319
    220 struct acct_info {
    221         fstring acct_name; /* account name */
    222         fstring acct_desc; /* account name */
    223         uint32_t rid; /* domain-relative RID */
    224 };
    225 
    226320struct samr_displayentry {
    227321        uint32_t idx;
     
    268362        uint32_t trust_type;
    269363        uint32_t trust_attributes;
     364        uint32_t *trust_posix_offset;
     365        uint32_t *supported_enc_type;
    270366        DATA_BLOB trust_forest_trust_info;
    271367};
     
    317413 * Changed to 18, pdb_rid_algorithm -> pdb_capabilities
    318414 * Changed to 19, removed uid_to_rid
     415 * Changed to 20, pdb_secret calls
     416 * Changed to 21, set/enum_upn_suffixes. AB.
     417 * Changed to 22, idmap control functions
     418 * Changed to 23, new idmap control functions
     419 * Changed to 24, removed uid_to_sid and gid_to_sid, replaced with id_to_sid
     420 * Leave at 24, add optional get_trusteddom_creds()
    319421 */
    320422
    321 #define PASSDB_INTERFACE_VERSION 19
     423#define PASSDB_INTERFACE_VERSION 24
    322424
    323425struct pdb_methods
     
    373475        NTSTATUS (*enum_group_mapping)(struct pdb_methods *methods,
    374476                                       const struct dom_sid *sid, enum lsa_SidType sid_name_use,
    375                                        GROUP_MAP **pp_rmap, size_t *p_num_entries,
     477                                       GROUP_MAP ***pp_rmap, size_t *p_num_entries,
    376478                                       bool unix_only);
    377479
     
    462564                               const struct dom_sid *sid);
    463565
    464         bool (*uid_to_sid)(struct pdb_methods *methods, uid_t uid,
    465                            struct dom_sid *sid);
    466         bool (*gid_to_sid)(struct pdb_methods *methods, gid_t gid,
    467                            struct dom_sid *sid);
     566        /*
     567         * Instead of passing down a gid or uid, this function sends down a pointer
     568         * to a unixid.
     569         *
     570         * This acts as an in-out variable so that the idmap functions can correctly
     571         * receive ID_TYPE_BOTH, filling in cache details correctly rather than forcing
     572         * the cache to store ID_TYPE_UID or ID_TYPE_GID.
     573         */
     574        bool (*id_to_sid)(struct pdb_methods *methods, struct unixid *id,
     575                          struct dom_sid *sid);
    468576        bool (*sid_to_id)(struct pdb_methods *methods, const struct dom_sid *sid,
    469                           union unid_t *id, enum lsa_SidType *type);
     577                          struct unixid *id);
    470578
    471579        uint32_t (*capabilities)(struct pdb_methods *methods);
     
    476584                                  const char *domain, char** pwd,
    477585                                  struct dom_sid *sid, time_t *pass_last_set_time);
     586        NTSTATUS (*get_trusteddom_creds)(struct pdb_methods *methods,
     587                                         const char *domain,
     588                                         TALLOC_CTX *mem_ctx,
     589                                         struct cli_credentials **creds);
    478590        bool (*set_trusteddom_pw)(struct pdb_methods *methods,
    479591                                  const char* domain, const char* pwd,
     
    484596                                     TALLOC_CTX *mem_ctx, uint32_t *num_domains,
    485597                                     struct trustdom_info ***domains);
    486 
    487598
    488599        NTSTATUS (*get_trusted_domain)(struct pdb_methods *methods,
     
    504615                                         struct pdb_trusted_domain ***domains);
    505616
     617        NTSTATUS (*get_secret)(struct pdb_methods *methods,
     618                               TALLOC_CTX *mem_ctx,
     619                               const char *secret_name,
     620                               DATA_BLOB *secret_current,
     621                               NTTIME *secret_current_lastchange,
     622                               DATA_BLOB *secret_old,
     623                               NTTIME *secret_old_lastchange,
     624                               struct security_descriptor **sd);
     625        NTSTATUS (*set_secret)(struct pdb_methods *methods,
     626                               const char *secret_name,
     627                               DATA_BLOB *secret_current,
     628                               DATA_BLOB *secret_old,
     629                               struct security_descriptor *sd);
     630        NTSTATUS (*delete_secret)(struct pdb_methods *methods,
     631                                  const char *secret_name);
     632
     633        NTSTATUS (*enum_upn_suffixes)(struct pdb_methods *methods,
     634                                      TALLOC_CTX *mem_ctx,
     635                                      uint32_t *num_suffixes,
     636                                      char ***suffixes);
     637
     638        NTSTATUS (*set_upn_suffixes)(struct pdb_methods *methods,
     639                                     uint32_t num_suffixes,
     640                                     const char **suffixes);
     641
     642        bool (*is_responsible_for_our_sam)(struct pdb_methods *methods);
     643        bool (*is_responsible_for_builtin)(struct pdb_methods *methods);
     644        bool (*is_responsible_for_wellknown)(struct pdb_methods *methods);
     645        bool (*is_responsible_for_unix_users)(struct pdb_methods *methods);
     646        bool (*is_responsible_for_unix_groups)(struct pdb_methods *methods);
     647        bool (*is_responsible_for_everything_else)(struct pdb_methods *methods);
     648
    506649        void *private_data;  /* Private data of some kind */
    507650
     
    520663};
    521664
    522 #include "passdb/proto.h"
     665/* The following definitions come from passdb/account_pol.c  */
     666
     667void account_policy_names_list(TALLOC_CTX *mem_ctx, const char ***names, int *num_names);
     668const char *decode_account_policy_name(enum pdb_policy_type type);
     669const char *get_account_policy_attr(enum pdb_policy_type type);
     670const char *account_policy_get_desc(enum pdb_policy_type type);
     671enum pdb_policy_type account_policy_name_to_typenum(const char *name);
     672bool account_policy_get_default(enum pdb_policy_type type, uint32_t *val);
     673bool init_account_policy(void);
     674bool account_policy_get(enum pdb_policy_type type, uint32_t *value);
     675bool account_policy_set(enum pdb_policy_type type, uint32_t value);
     676bool cache_account_policy_set(enum pdb_policy_type type, uint32_t value);
     677bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value);
     678struct db_context *get_account_pol_db( void );
     679
     680/* The following definitions come from passdb/login_cache.c  */
     681
     682bool login_cache_init(void);
     683bool login_cache_shutdown(void);
     684bool login_cache_read(struct samu *sampass, struct login_cache *entry);
     685bool login_cache_write(const struct samu *sampass,
     686                       const struct login_cache *entry);
     687bool login_cache_delentry(const struct samu *sampass);
     688
     689/* The following definitions come from passdb/passdb.c  */
     690
     691struct samu *samu_new( TALLOC_CTX *ctx );
     692NTSTATUS samu_set_unix(struct samu *user, const struct passwd *pwd);
     693NTSTATUS samu_alloc_rid_unix(struct pdb_methods *methods,
     694                             struct samu *user, const struct passwd *pwd);
     695char *pdb_encode_acct_ctrl(uint32_t acct_ctrl, size_t length);
     696uint32_t pdb_decode_acct_ctrl(const char *p);
     697void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32_t acct_ctrl);
     698bool pdb_gethexpwd(const char *p, unsigned char *pwd);
     699void pdb_sethexhours(char *p, const unsigned char *hours);
     700bool pdb_gethexhours(const char *p, unsigned char *hours);
     701int algorithmic_rid_base(void);
     702uid_t algorithmic_pdb_user_rid_to_uid(uint32_t user_rid);
     703uid_t max_algorithmic_uid(void);
     704uint32_t algorithmic_pdb_uid_to_user_rid(uid_t uid);
     705gid_t pdb_group_rid_to_gid(uint32_t group_rid);
     706gid_t max_algorithmic_gid(void);
     707uint32_t algorithmic_pdb_gid_to_group_rid(gid_t gid);
     708bool algorithmic_pdb_rid_is_user(uint32_t rid);
     709bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid,
     710                            enum lsa_SidType *type);
     711NTSTATUS local_password_change(const char *user_name,
     712                                int local_flags,
     713                                const char *new_passwd,
     714                                char **pp_err_str,
     715                                char **pp_msg_str);
     716bool init_samu_from_buffer(struct samu *sampass, uint32_t level,
     717                           uint8_t *buf, uint32_t buflen);
     718uint32_t init_buffer_from_samu (uint8_t **buf, struct samu *sampass, bool size_only);
     719bool pdb_copy_sam_account(struct samu *dst, struct samu *src );
     720bool pdb_update_bad_password_count(struct samu *sampass, bool *updated);
     721bool pdb_update_autolock_flag(struct samu *sampass, bool *updated);
     722bool pdb_increment_bad_password_count(struct samu *sampass);
     723bool is_dc_trusted_domain_situation(const char *domain_name);
     724bool get_trust_pw_clear(const char *domain, char **ret_pwd,
     725                        const char **account_name,
     726                        enum netr_SchannelType *channel);
     727bool get_trust_pw_hash(const char *domain, uint8_t ret_pwd[16],
     728                       const char **account_name,
     729                       enum netr_SchannelType *channel);
     730struct cli_credentials;
     731NTSTATUS pdb_get_trust_credentials(const char *netbios_domain,
     732                                   const char *dns_domain, /* optional */
     733                                   TALLOC_CTX *mem_ctx,
     734                                   struct cli_credentials **_creds);
     735
     736/* The following definitions come from passdb/pdb_compat.c  */
     737
     738uint32_t pdb_get_user_rid (const struct samu *sampass);
     739uint32_t pdb_get_group_rid (struct samu *sampass);
     740bool pdb_set_user_sid_from_rid (struct samu *sampass, uint32_t rid, enum pdb_value_state flag);
     741bool pdb_set_group_sid_from_rid (struct samu *sampass, uint32_t grid, enum pdb_value_state flag);
     742
     743/* The following definitions come from passdb/pdb_get_set.c  */
     744
     745bool pdb_is_password_change_time_max(time_t test_time);
     746uint32_t pdb_get_acct_ctrl(const struct samu *sampass);
     747time_t pdb_get_logon_time(const struct samu *sampass);
     748time_t pdb_get_logoff_time(const struct samu *sampass);
     749time_t pdb_get_kickoff_time(const struct samu *sampass);
     750time_t pdb_get_bad_password_time(const struct samu *sampass);
     751time_t pdb_get_pass_last_set_time(const struct samu *sampass);
     752time_t pdb_get_pass_can_change_time(const struct samu *sampass);
     753time_t pdb_get_pass_can_change_time_noncalc(const struct samu *sampass);
     754time_t pdb_get_pass_must_change_time(const struct samu *sampass);
     755bool pdb_get_pass_can_change(const struct samu *sampass);
     756uint16_t pdb_get_logon_divs(const struct samu *sampass);
     757uint32_t pdb_get_hours_len(const struct samu *sampass);
     758const uint8_t *pdb_get_hours(const struct samu *sampass);
     759const uint8_t *pdb_get_nt_passwd(const struct samu *sampass);
     760const uint8_t *pdb_get_lanman_passwd(const struct samu *sampass);
     761const uint8_t *pdb_get_pw_history(const struct samu *sampass, uint32_t *current_hist_len);
     762const char *pdb_get_plaintext_passwd(const struct samu *sampass);
     763const struct dom_sid *pdb_get_user_sid(const struct samu *sampass);
     764const struct dom_sid *pdb_get_group_sid(struct samu *sampass);
     765enum pdb_value_state pdb_get_init_flags(const struct samu *sampass, enum pdb_elements element);
     766const char *pdb_get_username(const struct samu *sampass);
     767const char *pdb_get_domain(const struct samu *sampass);
     768const char *pdb_get_nt_username(const struct samu *sampass);
     769const char *pdb_get_fullname(const struct samu *sampass);
     770const char *pdb_get_homedir(const struct samu *sampass);
     771const char *pdb_get_dir_drive(const struct samu *sampass);
     772const char *pdb_get_logon_script(const struct samu *sampass);
     773const char *pdb_get_profile_path(const struct samu *sampass);
     774const char *pdb_get_acct_desc(const struct samu *sampass);
     775const char *pdb_get_workstations(const struct samu *sampass);
     776const char *pdb_get_comment(const struct samu *sampass);
     777const char *pdb_get_munged_dial(const struct samu *sampass);
     778uint16_t pdb_get_bad_password_count(const struct samu *sampass);
     779uint16_t pdb_get_logon_count(const struct samu *sampass);
     780uint16_t pdb_get_country_code(const struct samu *sampass);
     781uint16_t pdb_get_code_page(const struct samu *sampass);
     782uint32_t pdb_get_unknown_6(const struct samu *sampass);
     783void *pdb_get_backend_private_data(const struct samu *sampass, const struct pdb_methods *my_methods);
     784bool pdb_set_acct_ctrl(struct samu *sampass, uint32_t acct_ctrl, enum pdb_value_state flag);
     785bool pdb_set_logon_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
     786bool pdb_set_logoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
     787bool pdb_set_kickoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
     788bool pdb_set_bad_password_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
     789bool pdb_set_pass_can_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
     790bool pdb_set_pass_last_set_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
     791bool pdb_set_hours_len(struct samu *sampass, uint32_t len, enum pdb_value_state flag);
     792bool pdb_set_logon_divs(struct samu *sampass, uint16_t hours, enum pdb_value_state flag);
     793bool pdb_set_init_flags(struct samu *sampass, enum pdb_elements element, enum pdb_value_state value_flag);
     794bool pdb_set_user_sid(struct samu *sampass, const struct dom_sid *u_sid, enum pdb_value_state flag);
     795bool pdb_set_user_sid_from_string(struct samu *sampass, const char *u_sid, enum pdb_value_state flag);
     796bool pdb_set_group_sid(struct samu *sampass, const struct dom_sid *g_sid, enum pdb_value_state flag);
     797bool pdb_set_username(struct samu *sampass, const char *username, enum pdb_value_state flag);
     798bool pdb_set_domain(struct samu *sampass, const char *domain, enum pdb_value_state flag);
     799bool pdb_set_nt_username(struct samu *sampass, const char *nt_username, enum pdb_value_state flag);
     800bool pdb_set_fullname(struct samu *sampass, const char *full_name, enum pdb_value_state flag);
     801bool pdb_set_logon_script(struct samu *sampass, const char *logon_script, enum pdb_value_state flag);
     802bool pdb_set_profile_path(struct samu *sampass, const char *profile_path, enum pdb_value_state flag);
     803bool pdb_set_dir_drive(struct samu *sampass, const char *dir_drive, enum pdb_value_state flag);
     804bool pdb_set_homedir(struct samu *sampass, const char *home_dir, enum pdb_value_state flag);
     805bool pdb_set_acct_desc(struct samu *sampass, const char *acct_desc, enum pdb_value_state flag);
     806bool pdb_set_workstations(struct samu *sampass, const char *workstations, enum pdb_value_state flag);
     807bool pdb_set_comment(struct samu *sampass, const char *comment, enum pdb_value_state flag);
     808bool pdb_set_munged_dial(struct samu *sampass, const char *munged_dial, enum pdb_value_state flag);
     809bool pdb_set_nt_passwd(struct samu *sampass, const uint8_t pwd[NT_HASH_LEN], enum pdb_value_state flag);
     810bool pdb_set_lanman_passwd(struct samu *sampass, const uint8_t pwd[LM_HASH_LEN], enum pdb_value_state flag);
     811bool pdb_set_pw_history(struct samu *sampass, const uint8_t *pwd, uint32_t historyLen, enum pdb_value_state flag);
     812bool pdb_set_plaintext_pw_only(struct samu *sampass, const char *password, enum pdb_value_state flag);
     813bool pdb_update_history(struct samu *sampass, const uint8_t new_nt[NT_HASH_LEN]);
     814bool pdb_set_bad_password_count(struct samu *sampass, uint16_t bad_password_count, enum pdb_value_state flag);
     815bool pdb_set_logon_count(struct samu *sampass, uint16_t logon_count, enum pdb_value_state flag);
     816bool pdb_set_country_code(struct samu *sampass, uint16_t country_code,
     817                          enum pdb_value_state flag);
     818bool pdb_set_code_page(struct samu *sampass, uint16_t code_page,
     819                       enum pdb_value_state flag);
     820bool pdb_set_unknown_6(struct samu *sampass, uint32_t unkn, enum pdb_value_state flag);
     821bool pdb_set_hours(struct samu *sampass, const uint8_t *hours, int hours_len,
     822                   enum pdb_value_state flag);
     823bool pdb_set_backend_private_data(struct samu *sampass, void *private_data,
     824                                   void (*free_fn)(void **),
     825                                   const struct pdb_methods *my_methods,
     826                                   enum pdb_value_state flag);
     827bool pdb_set_pass_can_change(struct samu *sampass, bool canchange);
     828bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext);
     829uint32_t pdb_build_fields_present(struct samu *sampass);
     830bool pdb_element_is_changed(const struct samu *sampass,
     831                            enum pdb_elements element);
     832bool pdb_element_is_set_or_changed(const struct samu *sampass,
     833                                   enum pdb_elements element);
     834
     835/* The following definitions come from passdb/pdb_interface.c  */
     836
     837NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function init) ;
     838struct pdb_init_function_entry *pdb_find_backend_entry(const char *name);
     839const struct pdb_init_function_entry *pdb_get_backends(void);
     840struct tevent_context *pdb_get_tevent_context(void);
     841NTSTATUS make_pdb_method_name(struct pdb_methods **methods, const char *selected);
     842struct pdb_domain_info *pdb_get_domain_info(TALLOC_CTX *mem_ctx);
     843bool pdb_getsampwnam(struct samu *sam_acct, const char *username) ;
     844bool pdb_getsampwsid(struct samu *sam_acct, const struct dom_sid *sid) ;
     845NTSTATUS pdb_create_user(TALLOC_CTX *mem_ctx, const char *name, uint32_t flags,
     846                         uint32_t *rid);
     847NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct);
     848NTSTATUS pdb_add_sam_account(struct samu *sam_acct) ;
     849NTSTATUS pdb_update_sam_account(struct samu *sam_acct) ;
     850NTSTATUS pdb_delete_sam_account(struct samu *sam_acct) ;
     851NTSTATUS pdb_rename_sam_account(struct samu *oldname, const char *newname);
     852NTSTATUS pdb_update_login_attempts(struct samu *sam_acct, bool success);
     853bool pdb_getgrsid(GROUP_MAP *map, struct dom_sid sid);
     854bool pdb_getgrgid(GROUP_MAP *map, gid_t gid);
     855bool pdb_getgrnam(GROUP_MAP *map, const char *name);
     856NTSTATUS pdb_create_dom_group(TALLOC_CTX *mem_ctx, const char *name,
     857                              uint32_t *rid);
     858NTSTATUS pdb_delete_dom_group(TALLOC_CTX *mem_ctx, uint32_t rid);
     859NTSTATUS pdb_add_group_mapping_entry(GROUP_MAP *map);
     860NTSTATUS pdb_update_group_mapping_entry(GROUP_MAP *map);
     861NTSTATUS pdb_delete_group_mapping_entry(struct dom_sid sid);
     862bool pdb_enum_group_mapping(const struct dom_sid *sid,
     863                            enum lsa_SidType sid_name_use,
     864                            GROUP_MAP ***pp_rmap,
     865                            size_t *p_num_entries,
     866                            bool unix_only);
     867NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx,
     868                                const struct dom_sid *sid,
     869                                uint32_t **pp_member_rids,
     870                                size_t *p_num_members);
     871NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user,
     872                                    struct dom_sid **pp_sids, gid_t **pp_gids,
     873                                    uint32_t *p_num_groups);
     874NTSTATUS pdb_set_unix_primary_group(TALLOC_CTX *mem_ctx, struct samu *user);
     875NTSTATUS pdb_add_groupmem(TALLOC_CTX *mem_ctx, uint32_t group_rid,
     876                          uint32_t member_rid);
     877NTSTATUS pdb_del_groupmem(TALLOC_CTX *mem_ctx, uint32_t group_rid,
     878                          uint32_t member_rid);
     879NTSTATUS pdb_create_alias(const char *name, uint32_t *rid);
     880NTSTATUS pdb_delete_alias(const struct dom_sid *sid);
     881NTSTATUS pdb_get_aliasinfo(const struct dom_sid *sid, struct acct_info *info);
     882NTSTATUS pdb_set_aliasinfo(const struct dom_sid *sid, struct acct_info *info);
     883NTSTATUS pdb_add_aliasmem(const struct dom_sid *alias, const struct dom_sid *member);
     884NTSTATUS pdb_del_aliasmem(const struct dom_sid *alias, const struct dom_sid *member);
     885NTSTATUS pdb_enum_aliasmem(const struct dom_sid *alias, TALLOC_CTX *mem_ctx,
     886                           struct dom_sid **pp_members, size_t *p_num_members);
     887NTSTATUS pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx,
     888                                    const struct dom_sid *domain_sid,
     889                                    const struct dom_sid *members, size_t num_members,
     890                                    uint32_t **pp_alias_rids,
     891                                    size_t *p_num_alias_rids);
     892NTSTATUS pdb_lookup_rids(const struct dom_sid *domain_sid,
     893                         int num_rids,
     894                         uint32_t *rids,
     895                         const char **names,
     896                         enum lsa_SidType *attrs);
     897NTSTATUS pdb_lookup_names(const struct dom_sid *domain_sid,
     898                          int num_names,
     899                          const char **names,
     900                          uint32_t *rids,
     901                          enum lsa_SidType *attrs);
     902bool pdb_get_account_policy(enum pdb_policy_type type, uint32_t *value);
     903bool pdb_set_account_policy(enum pdb_policy_type type, uint32_t value);
     904bool pdb_get_seq_num(time_t *seq_num);
     905/*
     906 * Instead of passing down a gid or uid, this function sends down a pointer
     907 * to a unixid.
     908 *
     909 * This acts as an in-out variable so that the idmap functions can correctly
     910 * receive ID_TYPE_BOTH, filling in cache details correctly rather than forcing
     911 * the cache to store ID_TYPE_UID or ID_TYPE_GID.
     912 */
     913bool pdb_id_to_sid(struct unixid *id, struct dom_sid *sid);
     914bool pdb_sid_to_id(const struct dom_sid *sid, struct unixid *id);
     915uint32_t pdb_capabilities(void);
     916bool pdb_new_rid(uint32_t *rid);
     917bool initialize_password_db(bool reload, struct tevent_context *tevent_ctx);
     918struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx,
     919                                   enum pdb_search_type type);
     920struct pdb_search *pdb_search_users(TALLOC_CTX *mem_ctx, uint32_t acct_flags);
     921struct pdb_search *pdb_search_groups(TALLOC_CTX *mem_ctx);
     922struct pdb_search *pdb_search_aliases(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
     923uint32_t pdb_search_entries(struct pdb_search *search,
     924                          uint32_t start_idx, uint32_t max_entries,
     925                          struct samr_displayentry **result);
     926bool pdb_get_trusteddom_pw(const char *domain, char** pwd, struct dom_sid *sid,
     927                           time_t *pass_last_set_time);
     928NTSTATUS pdb_get_trusteddom_creds(const char *domain, TALLOC_CTX *mem_ctx,
     929                                  struct cli_credentials **creds);
     930bool pdb_set_trusteddom_pw(const char* domain, const char* pwd,
     931                           const struct dom_sid *sid);
     932bool pdb_del_trusteddom_pw(const char *domain);
     933NTSTATUS pdb_enum_trusteddoms(TALLOC_CTX *mem_ctx, uint32_t *num_domains,
     934                              struct trustdom_info ***domains);
     935NTSTATUS pdb_get_trusted_domain(TALLOC_CTX *mem_ctx, const char *domain,
     936                                struct pdb_trusted_domain **td);
     937NTSTATUS pdb_get_trusted_domain_by_sid(TALLOC_CTX *mem_ctx, struct dom_sid *sid,
     938                                struct pdb_trusted_domain **td);
     939NTSTATUS pdb_set_trusted_domain(const char* domain,
     940                                const struct pdb_trusted_domain *td);
     941NTSTATUS pdb_del_trusted_domain(const char *domain);
     942NTSTATUS pdb_enum_trusted_domains(TALLOC_CTX *mem_ctx, uint32_t *num_domains,
     943                                  struct pdb_trusted_domain ***domains);
     944NTSTATUS make_pdb_method( struct pdb_methods **methods ) ;
     945NTSTATUS pdb_get_secret(TALLOC_CTX *mem_ctx,
     946                        const char *secret_name,
     947                        DATA_BLOB *secret_current,
     948                        NTTIME *secret_current_lastchange,
     949                        DATA_BLOB *secret_old,
     950                        NTTIME *secret_old_lastchange,
     951                        struct security_descriptor **sd);
     952NTSTATUS pdb_set_secret(const char *secret_name,
     953                        DATA_BLOB *secret_current,
     954                        DATA_BLOB *secret_old,
     955                        struct security_descriptor *sd);
     956NTSTATUS pdb_delete_secret(const char *secret_name);
     957bool pdb_sid_to_id_unix_users_and_groups(const struct dom_sid *sid,
     958                                         struct unixid *id);
     959
     960NTSTATUS pdb_enum_upn_suffixes(TALLOC_CTX *mem_ctx,
     961                               uint32_t *num_suffixes,
     962                               char ***suffixes);
     963
     964NTSTATUS pdb_set_upn_suffixes(uint32_t num_suffixes,
     965                              const char **suffixes);
     966bool pdb_is_responsible_for_our_sam(void);
     967bool pdb_is_responsible_for_builtin(void);
     968bool pdb_is_responsible_for_wellknown(void);
     969bool pdb_is_responsible_for_unix_users(void);
     970bool pdb_is_responsible_for_unix_groups(void);
     971bool pdb_is_responsible_for_everything_else(void);
     972
     973/* The following definitions come from passdb/pdb_util.c  */
     974
     975NTSTATUS pdb_create_builtin(uint32_t rid);
     976NTSTATUS create_builtin_users(const struct dom_sid *sid);
     977NTSTATUS create_builtin_administrators(const struct dom_sid *sid);
     978
    523979#include "passdb/machine_sid.h"
    524980#include "passdb/lookup_sid.h"
    525981
     982/* The following definitions come from passdb/pdb_unixid.c */
     983void unixid_from_uid(struct unixid *id, uint32_t some_uid);
     984void unixid_from_gid(struct unixid *id, uint32_t some_gid);
     985void unixid_from_both(struct unixid *id, uint32_t some_id);
     986
     987/* The following definitions come from passdb/pdb_secrets.c
     988 * and should be used by PDB modules if they need to store
     989 * sid/guid information for the domain in secrets database
     990 */
     991bool PDB_secrets_mark_domain_protected(const char *domain);
     992bool PDB_secrets_clear_domain_protection(const char *domain);
     993bool PDB_secrets_store_domain_sid(const char *domain, const struct dom_sid  *sid);
     994bool PDB_secrets_fetch_domain_sid(const char *domain, struct dom_sid  *sid);
     995bool PDB_secrets_store_domain_guid(const char *domain, struct GUID *guid);
     996bool PDB_secrets_fetch_domain_guid(const char *domain, struct GUID *guid);
     997
    526998#endif /* _PASSDB_H */
  • vendor/current/source3/include/popt_common.h

    r740 r988  
    2222
    2323#include <popt.h>
     24#include "auth_info.h"
    2425
    2526/* Common popt structures */
     
    4344#define POPT_COMMON_CREDENTIALS { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_credentials, 0, "Authentication options:", NULL },
    4445#define POPT_COMMON_DYNCONFIG { NULL, 0, POPT_ARG_INCLUDE_TABLE, \
    45     CONST_DISCARD(poptOption *, popt_common_dynconfig), 0, \
     46    discard_const_p(poptOption, popt_common_dynconfig), 0, \
    4647    "Build-time configuration overrides:", NULL },
    4748#define POPT_COMMON_DEBUGLEVEL { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debuglevel, 0, "Common samba debugging:", NULL },
    4849#define POPT_COMMON_OPTION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_option, 0, "Common samba commandline config:", NULL },
    4950
    50 struct user_auth_info {
    51         char *username;
    52         char *domain;
    53         char *password;
    54         bool got_pass;
    55         bool use_kerberos;
    56         int signing_state;
    57         bool smb_encrypt;
    58         bool use_machine_account;
    59         bool fallback_after_kerberos;
    60         bool use_ccache;
    61 };
    62 
    6351void popt_common_set_auth_info(struct user_auth_info *auth_info);
     52void popt_burn_cmdline_password(int argc, char *argv[]);
    6453
    6554#endif /* _POPT_COMMON_H */
  • vendor/current/source3/include/printing.h

    r746 r988  
    2525   SAMBA printing subsystem.
    2626*/
     27#include <tdb.h>
     28#include "lib/param/loadparm.h"
    2729
    2830/* Extra fields above "LPQ_PRINTING" are used to map extra NT status codes. */
     
    162164#define MAX_PRINT_DBS_OPEN 1
    163165
    164 struct TDB_DATA;
    165 struct tdb_context;
    166 
    167166struct tdb_print_db {
    168167        struct tdb_print_db *next, *prev;
     
    182181NTSTATUS print_spool_open(files_struct *fsp,
    183182                          const char *fname,
    184                           uint16_t current_vuid);
     183                          uint64_t current_vuid);
    185184
    186185int print_spool_write(files_struct *fsp, const char *data, uint32_t size,
    187                       SMB_OFF_T offset, uint32_t *written);
     186                      off_t offset, uint32_t *written);
    188187
    189188void print_spool_end(files_struct *fsp, enum file_close_type close_type);
     
    191190void print_spool_terminate(struct connection_struct *conn,
    192191                           struct print_file_data *print_file);
     192uint16_t print_spool_rap_jobid(struct print_file_data *print_file);
    193193
    194194/* The following definitions come from printing/printing.c  */
    195195
    196 uint32 sysjob_to_jobid(int unix_jobid);
     196uint32_t sysjob_to_jobid_pdb(struct tdb_print_db *pdb, int sysjob);
     197uint32_t sysjob_to_jobid(int unix_jobid);
     198int jobid_to_sysjob_pdb(struct tdb_print_db *pdb, uint32_t jobid);
    197199bool print_notify_register_pid(int snum);
    198200bool print_notify_deregister_pid(int snum);
    199 bool print_job_exists(const char* sharename, uint32 jobid);
     201bool print_job_exists(const char* sharename, uint32_t jobid);
    200202struct spoolss_DeviceMode *print_job_devmode(TALLOC_CTX *mem_ctx,
    201203                                             const char *sharename,
    202                                              uint32 jobid);
     204                                             uint32_t jobid);
    203205bool print_job_set_name(struct tevent_context *ev,
    204206                        struct messaging_context *msg_ctx,
    205                         const char *sharename, uint32 jobid, const char *name);
     207                        const char *sharename, uint32_t jobid, const char *name);
    206208bool print_job_get_name(TALLOC_CTX *mem_ctx, const char *sharename, uint32_t jobid, char **name);
    207 WERROR print_job_delete(const struct auth_serversupplied_info *server_info,
     209WERROR print_job_delete(const struct auth_session_info *server_info,
    208210                        struct messaging_context *msg_ctx,
    209211                        int snum, uint32_t jobid);
    210 WERROR print_job_pause(const struct auth_serversupplied_info *server_info,
     212WERROR print_job_pause(const struct auth_session_info *server_info,
    211213                     struct messaging_context *msg_ctx,
    212                      int snum, uint32 jobid);
    213 WERROR print_job_resume(const struct auth_serversupplied_info *server_info,
     214                     int snum, uint32_t jobid);
     215WERROR print_job_resume(const struct auth_session_info *server_info,
    214216                      struct messaging_context *msg_ctx,
    215                       int snum, uint32 jobid);
     217                      int snum, uint32_t jobid);
    216218ssize_t print_job_write(struct tevent_context *ev,
    217219                        struct messaging_context *msg_ctx,
    218                         int snum, uint32 jobid, const char *buf, size_t size);
     220                        int snum, uint32_t jobid, const char *buf, size_t size);
    219221int print_queue_length(struct messaging_context *msg_ctx, int snum,
    220222                       print_status_struct *pstatus);
    221 WERROR print_job_start(const struct auth_serversupplied_info *server_info,
     223WERROR print_job_start(const struct auth_session_info *server_info,
    222224                       struct messaging_context *msg_ctx,
    223225                       const char *clientmachine,
     
    225227                       struct spoolss_DeviceMode *devmode, uint32_t *_jobid);
    226228void print_job_endpage(struct messaging_context *msg_ctx,
    227                        int snum, uint32 jobid);
     229                       int snum, uint32_t jobid);
    228230NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum,
    229                        uint32 jobid, enum file_close_type close_type);
     231                       uint32_t jobid, enum file_close_type close_type);
    230232int print_queue_status(struct messaging_context *msg_ctx, int snum,
    231233                       print_queue_struct **ppqueue,
    232234                       print_status_struct *status);
    233 WERROR print_queue_pause(const struct auth_serversupplied_info *server_info,
     235WERROR print_queue_pause(const struct auth_session_info *server_info,
    234236                         struct messaging_context *msg_ctx, int snum);
    235 WERROR print_queue_resume(const struct auth_serversupplied_info *server_info,
     237WERROR print_queue_resume(const struct auth_session_info *server_info,
    236238                          struct messaging_context *msg_ctx, int snum);
    237 WERROR print_queue_purge(const struct auth_serversupplied_info *server_info,
     239WERROR print_queue_purge(const struct auth_session_info *server_info,
    238240                         struct messaging_context *msg_ctx, int snum);
    239 uint16 pjobid_to_rap(const char* sharename, uint32 jobid);
    240 bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid);
    241 void rap_jobid_delete(const char* sharename, uint32 jobid);
     241uint16_t pjobid_to_rap(const char* sharename, uint32_t jobid);
     242bool rap_to_pjobid(uint16_t rap_jobid, fstring sharename, uint32_t *pjobid);
     243void rap_jobid_delete(const char* sharename, uint32_t jobid);
    242244bool print_backend_init(struct messaging_context *msg_ctx);
    243 void start_background_queue(struct tevent_context *ev,
    244                             struct messaging_context *msg);
    245245void printing_end(void);
    246246
     
    256256void release_print_db( struct tdb_print_db *pdb);
    257257void close_all_print_db(void);
    258 struct TDB_DATA get_printer_notify_pid_list(struct tdb_context *tdb, const char *printer_name, bool cleanlist);
     258TDB_DATA get_printer_notify_pid_list(struct tdb_context *tdb, const char *printer_name, bool cleanlist);
    259259
    260260void print_queue_receive(struct messaging_context *msg,
  • vendor/current/source3/include/proto.h

    r919 r988  
    2424#define _PROTO_H_
    2525
     26#include <sys/types.h>
     27#include <regex.h>
     28
    2629/* The following definitions come from lib/access.c  */
    2730
     
    3639/* The following definitions come from lib/adt_tree.c  */
    3740
    38 
    39 /* The following definitions come from lib/afs.c  */
    40 
    41 char *afs_createtoken_str(const char *username, const char *cell);
    42 bool afs_login(connection_struct *conn);
    43 bool afs_login(connection_struct *conn);
    44 char *afs_createtoken_str(const char *username, const char *cell);
    45 
    46 /* The following definitions come from lib/afs_settoken.c  */
    47 
    48 int afs_syscall( int subcall,
    49           char * path,
    50           int cmd,
    51           char * cmarg,
    52           int follow);
    53 bool afs_settoken_str(const char *token_string);
    54 bool afs_settoken_str(const char *token_string);
    55 
    5641/* The following definitions come from lib/audit.c  */
    5742
    58 const char *audit_category_str(uint32 category);
    59 const char *audit_param_str(uint32 category);
    60 const char *audit_description_str(uint32 category);
    61 bool get_audit_category_from_param(const char *param, uint32 *audit_category);
    62 const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy);
     43const char *audit_category_str(uint32_t category);
     44const char *audit_param_str(uint32_t category);
     45const char *audit_description_str(uint32_t category);
     46bool get_audit_category_from_param(const char *param, uint32_t *audit_category);
     47const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32_t policy);
    6348
    6449/* The following definitions come from lib/charcnv.c  */
    6550
    66 char lp_failed_convert_char(void);
    67 void lazy_initialize_conv(void);
    6851void gfree_charcnv(void);
    69 void init_iconv(void);
    70 size_t convert_string(charset_t from, charset_t to,
    71                       void const *src, size_t srclen,
    72                       void *dest, size_t destlen, bool allow_bad_conv);
    73 size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen);
    74 char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s);
    75 char *strupper_talloc(TALLOC_CTX *ctx, const char *s);
    76 size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen);
    77 char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s);
    78 char *strlower_talloc(TALLOC_CTX *ctx, const char *s);
    7952size_t ucs2_align(const void *base_ptr, const void *p, int flags);
    8053size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags);
     
    8457size_t pull_ascii_fstring(char *dest, const void *src);
    8558size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src);
    86 size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags);
    87 size_t push_utf8_fstring(void *dest, const char *src);
    88 bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
    89                       size_t *converted_size);
    90 size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags);
    91 size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
     59size_t push_string_check_fn(void *dest, const char *src,
     60                            size_t dest_len, int flags);
     61size_t push_string_base(const char *base, uint16_t flags2,
     62                        void *dest, const char *src,
     63                        size_t dest_len, int flags);
     64size_t pull_string_talloc(TALLOC_CTX *ctx,
    9265                        const void *base_ptr,
     66                        uint16_t smb_flags2,
    9367                        char **ppdest,
    9468                        const void *src,
    9569                        size_t src_len,
    9670                        int flags);
    97 size_t pull_ucs2_fstring(char *dest, const void *src);
    98 bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src,
    99                       size_t *converted_size);
    100 bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
    101                       size_t *converted_size);
    102 bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src,
    103                       size_t *converted_size);
    104 bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src,
    105                        size_t *converted_size);
    106 size_t push_string_check_fn(const char *function, unsigned int line,
    107                             void *dest, const char *src,
    108                             size_t dest_len, int flags);
    109 size_t push_string_base(const char *function, unsigned int line,
    110                         const char *base, uint16 flags2,
    111                         void *dest, const char *src,
    112                         size_t dest_len, int flags);
    113 size_t pull_string_fn(const char *function,
    114                         unsigned int line,
    115                         const void *base_ptr,
    116                         uint16 smb_flags2,
    117                         char *dest,
    118                         const void *src,
    119                         size_t dest_len,
    120                         size_t src_len,
    121                         int flags);
    122 size_t pull_string_talloc_fn(const char *function,
    123                         unsigned int line,
    124                         TALLOC_CTX *ctx,
    125                         const void *base_ptr,
    126                         uint16 smb_flags2,
    127                         char **ppdest,
    128                         const void *src,
    129                         size_t src_len,
    130                         int flags);
    131 size_t align_string(const void *base_ptr, const char *p, int flags);
    132 
    133 /* The following definitions come from lib/clobber.c  */
    134 
    135 void clobber_region(const char *fn, unsigned int line, char *dest, size_t len);
    136 
    137 /* The following definitions come from lib/conn_tdb.c  */
    138 
    139 struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
    140                                           connection_struct *conn,
    141                                           const char *name);
    142 int connections_traverse(int (*fn)(struct db_record *rec,
    143                                    void *private_data),
    144                          void *private_data);
    145 int connections_forall(int (*fn)(struct db_record *rec,
    146                                  const struct connections_key *key,
    147                                  const struct connections_data *data,
    148                                  void *private_data),
    149                        void *private_data);
    150 int connections_forall_read(int (*fn)(const struct connections_key *key,
    151                                       const struct connections_data *data,
    152                                       void *private_data),
    153                             void *private_data);
    154 bool connections_init(bool rw);
     71size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
     72int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
    15573
    15674/* The following definitions come from lib/dmallocmsg.c  */
     
    16785int map_errno_from_nt_status(NTSTATUS status);
    16886
    169 /* The following definitions come from lib/fault.c  */
    170 void fault_setup(void (*fn)(void *));
    171 void dump_core_setup(const char *progname);
    172 
    17387/* The following definitions come from lib/file_id.c  */
    17488
    17589struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf);
    176 bool file_id_equal(const struct file_id *id1, const struct file_id *id2);
    177 const char *file_id_string_tos(const struct file_id *id);
    178 void push_file_id_16(char *buf, const struct file_id *id);
    179 void push_file_id_24(char *buf, const struct file_id *id);
    180 void pull_file_id_24(char *buf, struct file_id *id);
    181 
    182 /* The following definitions come from lib/gencache.c  */
    183 
    184 bool gencache_set(const char *keystr, const char *value, time_t timeout);
    185 bool gencache_del(const char *keystr);
    186 bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
    187 bool gencache_parse(const char *keystr,
    188                     void (*parser)(time_t timeout, DATA_BLOB blob,
    189                                    void *private_data),
    190                     void *private_data);
    191 bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
    192                             time_t *timeout, bool *was_expired);
    193 bool gencache_stabilize(void);
    194 bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
    195 void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
    196                                        time_t timeout, void *private_data),
    197                             void *private_data, const char *pattern);
    198 void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
    199                       void* data, const char* keystr_pattern);
     90
     91#include "lib/gencache.h"
    20092
    20193/* The following definitions come from lib/interface.c  */
     
    229121char *escape_rdn_val_string_alloc(const char *s);
    230122
    231 /* The following definitions come from lib/module.c  */
    232 
    233 NTSTATUS smb_load_module(const char *module_name);
    234 int smb_load_modules(const char **modules);
    235 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
    236 NTSTATUS smb_load_module(const char *module_name);
    237 int smb_load_modules(const char **modules);
    238 NTSTATUS smb_probe_module(const char *subsystem, const char *module);
    239 void init_modules(void);
    240 
    241123/* The following definitions come from lib/ms_fnmatch.c  */
    242124
    243125int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern,
    244126               bool is_case_sensitive);
    245 int gen_fnmatch(const char *pattern, const char *string);
    246 
    247 /* The following definitions come from lib/pidfile.c  */
    248 
    249 pid_t pidfile_pid(const char *name);
    250 void pidfile_create(const char *program_name);
    251 void pidfile_unlink(void);
    252127
    253128/* The following definitions come from lib/recvfile.c  */
     
    255130ssize_t sys_recvfile(int fromfd,
    256131                        int tofd,
    257                         SMB_OFF_T offset,
     132                        off_t offset,
    258133                        size_t count);
    259134ssize_t sys_recvfile(int fromfd,
    260135                        int tofd,
    261                         SMB_OFF_T offset,
     136                        off_t offset,
    262137                        size_t count);
    263138ssize_t drain_socket(int sockfd, size_t count);
    264139
    265 /* The following definitions come from lib/secdesc.c  */
    266 
    267 uint32_t get_sec_info(const struct security_descriptor *sd);
    268 struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
    269 struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
    270 struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
    271                         enum security_descriptor_revision revision,
    272                         uint16 type,
    273                         const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
    274                         struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
    275 struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
    276 NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
    277                            struct security_descriptor *secdesc,
    278                            uint8 **data, size_t *len);
    279 NTSTATUS marshall_sec_desc_buf(TALLOC_CTX *mem_ctx,
    280                                struct sec_desc_buf *secdesc_buf,
    281                                uint8_t **data, size_t *len);
    282 NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
    283                              struct security_descriptor **psecdesc);
    284 NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
    285                                  struct sec_desc_buf **psecdesc_buf);
    286 struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
    287                                  struct security_acl *dacl, size_t *sd_size);
    288 struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
    289 struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
    290 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32 mask, size_t *sd_size);
    291 NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32 mask);
    292 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
    293 bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
    294 NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
    295                                         struct security_descriptor **ppsd,
    296                                         size_t *psize,
    297                                         const struct security_descriptor *parent_ctr,
    298                                         const struct dom_sid *owner_sid,
    299                                         const struct dom_sid *group_sid,
    300                                         bool container);
    301 NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
    302                                         struct sec_desc_buf **ppsdb,
    303                                         const struct security_descriptor *parent_ctr,
    304                                         bool container);
    305 
    306140/* The following definitions come from lib/sendfile.c  */
    307141
    308 ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
     142ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count);
    309143
    310144/* The following definitions come from lib/server_mutex.c  */
     
    316150
    317151bool share_info_db_init(void);
    318 struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
     152struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32_t def_access);
    319153struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *servicename,
    320154                              size_t *psize);
     
    323157bool share_access_check(const struct security_token *token,
    324158                        const char *sharename,
    325                         uint32 desired_access,
     159                        uint32_t desired_access,
    326160                        uint32_t *pgranted);
    327161bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
     
    357191                        const char *input_string,
    358192                        const char *username,
     193                        const char *grpname,
    359194                        const char *domain,
    360195                        uid_t uid,
     
    369204                           const char *smb_name, const char *domain_name,
    370205                           char *str, size_t len);
    371 char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str);
    372 
    373 /* The following definitions come from lib/sysacls.c  */
    374 
    375 int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
    376 int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
    377 int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
    378 void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
    379 int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
    380 int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
    381 int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
    382 char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p);
    383 SMB_ACL_T sys_acl_init(int count);
    384 int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
    385 int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
    386 int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
    387 int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
    388 int sys_acl_free_text(char *text);
    389 int sys_acl_free_acl(SMB_ACL_T acl_d) ;
    390 int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
    391 int sys_acl_valid(SMB_ACL_T acl_d);
    392 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    393                            const char *path_p, SMB_ACL_TYPE_T type);
    394 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    395 int sys_acl_set_file(vfs_handle_struct *handle,
    396                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    397 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    398                    SMB_ACL_T acl_d);
    399 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    400                             const char *path);
    401 int no_acl_syscall_error(int err);
    402206
    403207/* The following definitions come from lib/sysquotas.c  */
     
    423227/* The following definitions come from lib/system.c  */
    424228
    425 void *sys_memalign( size_t align, size_t size );
    426 int sys_usleep(long usecs);
    427 ssize_t sys_read(int fd, void *buf, size_t count);
    428 ssize_t sys_write(int fd, const void *buf, size_t count);
    429 ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt);
    430 ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off);
    431 ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off);
    432229ssize_t sys_send(int s, const void *msg, size_t len, int flags);
    433 ssize_t sys_sendto(int s,  const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
    434 ssize_t sys_recv(int fd, void *buf, size_t count, int flags);
    435230ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
    436231int sys_fcntl_ptr(int fd, int cmd, void *arg);
     
    444239int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf,
    445240              bool fake_dir_create_times);
    446 int sys_ftruncate(int fd, SMB_OFF_T offset);
    447 int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
    448 int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
    449 SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
    450 int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
    451 SMB_OFF_T sys_ftell(FILE *fp);
    452 int sys_creat(const char *path, mode_t mode);
    453 int sys_open(const char *path, int oflag, mode_t mode);
    454 FILE *sys_fopen(const char *path, const char *type);
    455 void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
    456 SMB_STRUCT_DIR *sys_opendir(const char *name);
    457 SMB_STRUCT_DIR *sys_fdopendir(int fd);
    458 SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
    459 void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
    460 long sys_telldir(SMB_STRUCT_DIR *dirp);
    461 void sys_rewinddir(SMB_STRUCT_DIR *dirp);
    462 int sys_closedir(SMB_STRUCT_DIR *dirp);
     241int sys_posix_fallocate(int fd, off_t offset, off_t len);
     242int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len);
     243void kernel_flock(int fd, uint32_t share_mode, uint32_t access_mask);
     244DIR *sys_fdopendir(int fd);
    463245int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
    464246int sys_waitpid(pid_t pid,int *status,int options);
    465 char *sys_getwd(char *s);
     247char *sys_getwd(void);
    466248void set_effective_capability(enum smbd_capability capability);
    467249void drop_effective_capability(enum smbd_capability capability);
     
    474256int sys_pclose(int fd);
    475257ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
    476 ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
    477258ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
    478259ssize_t sys_listxattr (const char *path, char *list, size_t size);
    479 ssize_t sys_llistxattr (const char *path, char *list, size_t size);
    480260ssize_t sys_flistxattr (int filedes, char *list, size_t size);
    481261int sys_removexattr (const char *path, const char *name);
    482 int sys_lremovexattr (const char *path, const char *name);
    483262int sys_fremovexattr (int filedes, const char *name);
    484263int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
    485 int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags);
    486264int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
    487 uint32 unix_dev_major(SMB_DEV_T dev);
    488 uint32 unix_dev_minor(SMB_DEV_T dev);
    489 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
    490 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
    491 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
    492 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
    493 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
    494 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
    495 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
    496 int sys_aio_read(SMB_STRUCT_AIOCB *aiocb);
    497 int sys_aio_write(SMB_STRUCT_AIOCB *aiocb);
    498 ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb);
    499 int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb);
    500 int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb);
    501 int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
    502 int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
     265uint32_t unix_dev_major(SMB_DEV_T dev);
     266uint32_t unix_dev_minor(SMB_DEV_T dev);
     267#if 0
     268int sys_get_number_of_cores(void);
     269#endif
     270
     271struct stat;
     272void init_stat_ex_from_stat (struct stat_ex *dst,
     273                            const struct stat *src,
     274                            bool fake_dir_create_times);
     275
    503276/* The following definitions come from lib/system_smbd.c  */
    504277
     
    537310time_t srv_make_unix_date2(const void *date_ptr);
    538311time_t srv_make_unix_date3(const void *date_ptr);
    539 struct timespec convert_time_t_to_timespec(time_t t);
    540 struct timespec convert_timeval_to_timespec(const struct timeval tv);
    541 struct timeval convert_timespec_to_timeval(const struct timespec ts);
    542 struct timespec timespec_current(void);
    543 struct timespec timespec_min(const struct timespec *ts1,
    544                            const struct timespec *ts2);
    545 int timespec_compare(const struct timespec *ts1, const struct timespec *ts2);
    546 void round_timespec_to_sec(struct timespec *ts);
    547 void round_timespec_to_usec(struct timespec *ts);
    548312struct timespec interpret_long_date(const char *p);
    549313void TimeInit(void);
     
    552316time_t nt_time_to_unix_abs(const NTTIME *nt);
    553317time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
    554 void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
    555318void unix_to_nt_time_abs(NTTIME *nt, time_t t);
    556319const char *time_to_asc(const time_t t);
     
    565328
    566329/* The following definitions come from lib/util_names.c  */
    567 void gfree_netbios_names(void);
    568 bool set_global_myname(const char *myname);
    569 const char *global_myname(void);
    570 bool set_global_myworkgroup(const char *myworkgroup);
    571 const char *lp_workgroup(void);
    572330const char *get_global_sam_name(void);
     331const char *my_sam_name(void);
    573332
    574333/* The following definitions come from lib/util.c  */
     
    577336void set_Protocol(enum protocol_types  p);
    578337bool all_zero(const uint8_t *ptr, size_t size);
    579 bool set_global_scope(const char *scope);
    580 const char *global_scope(void);
    581338void gfree_names(void);
    582339void gfree_all( void );
     
    588345bool socket_exist(const char *fname);
    589346uint64_t get_file_size_stat(const SMB_STRUCT_STAT *sbuf);
    590 SMB_OFF_T get_file_size(char *file_name);
    591 char *attrib_string(uint16 mode);
    592 void show_msg(char *buf);
    593 void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num);
    594 void smb_setlen(char *buf,int len);
     347bool check_same_dev_ino(const SMB_STRUCT_STAT *sbuf1,
     348                        const SMB_STRUCT_STAT *sbuf2);
     349bool check_same_stat(const SMB_STRUCT_STAT *sbuf1,
     350                        const SMB_STRUCT_STAT *sbuf2);
     351void show_msg(const char *buf);
    595352int set_message_bcc(char *buf,int num_bytes);
    596 ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob);
     353ssize_t message_push_blob(uint8_t **outbuf, DATA_BLOB blob);
    597354char *unix_clean_name(TALLOC_CTX *ctx, const char *s);
    598355char *clean_name(TALLOC_CTX *ctx, const char *s);
    599 ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
     356ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, off_t pos);
    600357int set_blocking(int fd, bool set);
     358NTSTATUS init_before_fork(void);
    601359NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
    602                            struct event_context *ev_ctx,
    603                            struct server_id id,
    604                            bool parent_longlived);
     360                           struct tevent_context *ev_ctx,
     361                           bool parent_longlived,
     362                           const char *comment);
     363NTSTATUS smbd_reinit_after_fork(struct messaging_context *msg_ctx,
     364                                struct tevent_context *ev_ctx,
     365                                bool parent_longlived,
     366                                const char *comment);
    605367void *malloc_(size_t size);
    606 void *memalign_array(size_t el_size, size_t align, unsigned int count);
    607 void *calloc_array(size_t size, size_t nmemb);
    608368void *Realloc(void *p, size_t size, bool free_old_on_error);
    609369void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
    610                         void *element, void *_array, uint32 *num_elements,
     370                        void *element, void *_array, uint32_t *num_elements,
    611371                        ssize_t *array_size);
    612372char *get_myname(TALLOC_CTX *ctx);
    613373char *get_mydnsdomname(TALLOC_CTX *ctx);
    614 int interpret_protocol(const char *str,int def);
    615374char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
    616375char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
    617376bool process_exists(const struct server_id pid);
     377bool processes_exist(const struct server_id *pids, int num_pids,
     378                     bool *results);
    618379const char *uidtoname(uid_t uid);
    619380char *gidtoname(gid_t gid);
    620381uid_t nametouid(const char *name);
    621382gid_t nametogid(const char *name);
    622 void smb_panic(const char *const why);
     383void smb_panic_s3(const char *why);
    623384void log_stack_trace(void);
    624 const char *readdirname(SMB_STRUCT_DIR *p);
     385const char *readdirname(DIR *p);
    625386bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive);
    626387void set_namearray(name_compare_entry **ppname_array, const char *namelist);
    627388void free_namearray(name_compare_entry *name_array);
    628 bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
    629 bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
     389bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type);
     390bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
    630391bool is_myname(const char *s);
    631 bool is_myworkgroup(const char *s);
    632392void ra_lanman_string( const char *native_lanman );
    633393const char *get_remote_arch_str(void);
     
    641401void *smb_xmalloc_array(size_t size, unsigned int count);
    642402char *myhostname(void);
    643 char *lock_path(const char *name);
    644 char *pid_path(const char *name);
    645 char *lib_path(const char *name);
    646 char *modules_path(const char *name);
    647 char *data_path(const char *name);
    648 char *state_path(const char *name);
    649 char *cache_path(const char *name);
    650 const char *shlib_ext(void);
     403char *myhostname_upper(void);
     404#include "lib/util_path.h"
    651405bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent,
    652406                    const char **name);
     
    658412bool unix_wild_match(const char *pattern, const char *string);
    659413bool name_to_fqdn(fstring fqdn, const char *name);
    660 void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob);
    661 uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options);
    662 pid_t procid_to_pid(const struct server_id *proc);
    663 void set_my_vnn(uint32 vnn);
    664 uint32 get_my_vnn(void);
    665 void set_my_unique_id(uint64_t unique_id);
    666 struct server_id pid_to_procid(pid_t pid);
    667 struct server_id procid_self(void);
    668 bool procid_equal(const struct server_id *p1, const struct server_id *p2);
    669 bool cluster_id_equal(const struct server_id *id1,
    670                       const struct server_id *id2);
    671 bool procid_is_me(const struct server_id *pid);
     414uint32_t map_share_mode_to_deny_mode(uint32_t share_access, uint32_t private_options);
     415
     416#include "lib/util_procid.h"
     417
     418#define serverid_equal(p1, p2) server_id_equal(p1,p2)
    672419struct server_id interpret_pid(const char *pid_string);
    673 char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid);
    674 char *procid_str_static(const struct server_id *pid);
    675 bool procid_valid(const struct server_id *pid);
    676 bool procid_is_local(const struct server_id *pid);
    677 bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
    678420bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
    679421char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
     
    685427                       char **domain,
    686428                       char **user);
    687 void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name);
    688 void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name);
    689 void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
    690 void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
    691 void *talloc_zeronull(const void *context, size_t size, const char *name);
    692429const char *strip_hostname(const char *s);
    693 bool tevent_req_poll_ntstatus(struct tevent_req *req,
    694                               struct tevent_context *ev,
    695                               NTSTATUS *status);
    696430bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
    697431int timeval_to_msec(struct timeval t);
     
    700434bool map_open_params_to_ntcreate(const char *smb_base_fname,
    701435                                 int deny_mode, int open_func,
    702                                  uint32 *paccess_mask,
    703                                  uint32 *pshare_mode,
    704                                  uint32 *pcreate_disposition,
    705                                  uint32 *pcreate_options,
     436                                 uint32_t *paccess_mask,
     437                                 uint32_t *pshare_mode,
     438                                 uint32_t *pcreate_disposition,
     439                                 uint32_t *pcreate_options,
    706440                                 uint32_t *pprivate_flags);
    707 
    708 /* The following definitions come from lib/util_cmdline.c  */
    709 
    710 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
    711 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
    712 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
    713                                     const char *username);
    714 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
    715 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
    716                                   const char *domain);
    717 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
    718                                     const char *password);
    719 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
    720 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
    721                                          const char *arg);
    722 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
    723 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
    724                                       bool b);
    725 bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
    726 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
    727                                         bool b);
    728 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
    729 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
    730                                         bool b);
    731 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
    732 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
    733 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
    734 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
    735 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
    736 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
    737 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
    738 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
    739                                                  const struct user_auth_info *info);
    740 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
    741 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
     441struct security_unix_token *copy_unix_token(TALLOC_CTX *ctx, const struct security_unix_token *tok);
     442bool dir_check_ftype(uint32_t mode, uint32_t dirtype);
     443void init_modules(void);
    742444
    743445/* The following definitions come from lib/util_builtin.c  */
    744446
    745 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
    746 bool lookup_builtin_name(const char *name, uint32 *rid);
     447bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32_t rid, const char **name);
     448bool lookup_builtin_name(const char *name, uint32_t *rid);
    747449const char *builtin_domain_name(void);
    748450bool sid_check_is_builtin(const struct dom_sid *sid);
    749451bool sid_check_is_in_builtin(const struct dom_sid *sid);
     452bool sid_check_is_wellknown_builtin(const struct dom_sid *sid);
    750453
    751454/* The following definitions come from lib/util_file.c  */
     
    773476uid_t sec_initial_uid(void);
    774477gid_t sec_initial_gid(void);
     478bool root_mode(void);
    775479bool non_root_mode(void);
    776480void gain_root_privilege(void);
     
    785489int set_re_uid(void);
    786490void become_user_permanently(uid_t uid, gid_t gid);
     491int set_thread_credentials(uid_t uid,
     492                        gid_t gid,
     493                        size_t setlen,
     494                        const gid_t *gidset);
    787495bool is_setuid_root(void) ;
    788496
     
    793501char *sid_string_dbg(const struct dom_sid *sid);
    794502char *sid_string_tos(const struct dom_sid *sid);
    795 bool sid_linearize(char *outbuf, size_t len, const struct dom_sid *sid);
     503bool sid_linearize(uint8_t *outbuf, size_t len, const struct dom_sid *sid);
    796504bool non_mappable_sid(struct dom_sid *sid);
    797 char *sid_binstring_hex(const struct dom_sid *sid);
     505char *sid_binstring_hex_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
    798506struct netr_SamInfo3;
    799507NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
     
    824532char *print_canonical_sockaddr(TALLOC_CTX *ctx,
    825533                        const struct sockaddr_storage *pss);
    826 const char *client_name(int fd);
    827534int get_socket_port(int fd);
    828535const char *client_addr(int fd, char *addr, size_t addrlen);
    829536const char *client_socket_addr(int fd, char *addr, size_t addr_len);
    830537int client_socket_port(int fd);
    831 void set_smb_read_error(enum smb_read_errors *pre,
    832                         enum smb_read_errors newerr);
    833 void cond_set_smb_read_error(enum smb_read_errors *pre,
    834                         enum smb_read_errors newerr);
    835538bool is_a_socket(int fd);
    836539void set_socket_options(int fd, const char *options);
     
    843546                                  unsigned int time_out,
    844547                                  size_t *size_ret);
    845 NTSTATUS read_data(int fd, char *buffer, size_t N);
    846 ssize_t write_data(int fd, const char *buffer, size_t N);
    847 ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt);
     548NTSTATUS read_data_ntstatus(int fd, char *buffer, size_t N);
     549
    848550bool send_keepalive(int client);
    849551NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf,
     
    864566                         int timeout, int *pfd);
    865567struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
    866                                         struct event_context *ev,
     568                                        struct tevent_context *ev,
    867569                                        const struct sockaddr_storage *pss,
    868570                                        uint16_t port,
     
    870572NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
    871573struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
    872                                               struct event_context *ev,
     574                                              struct tevent_context *ev,
    873575                                              struct timeval wait_time,
    874576                                              const struct sockaddr_storage *pss,
     
    877579NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
    878580int open_udp_socket(const char *host, int port);
    879 const char *get_peer_name(int fd, bool force_lookup);
    880581const char *get_peer_addr(int fd, char *addr, size_t addr_len);
     582
     583struct tsocket_address;
     584
     585int get_remote_hostname(const struct tsocket_address *remote_address,
     586                        char **name,
     587                        TALLOC_CTX *mem_ctx);
     588
    881589int create_pipe_sock(const char *socket_dir,
    882590                     const char *socket_name,
    883591                     mode_t dir_perms);
     592int create_tcpip_socket(const struct sockaddr_storage *ifss, uint16_t *port);
    884593const char *get_mydnsfullname(void);
    885594bool is_myname_or_ipaddr(const char *s);
     
    893602int poll_one_fd(int fd, int events, int timeout, int *revents);
    894603int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
    895 struct tstream_context;
    896 struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
    897                                             struct tevent_context *ev,
    898                                             struct tstream_context *stream,
    899                                             size_t initial,
    900                                             ssize_t (*more)(uint8_t *buf,
    901                                                             size_t buflen,
    902                                                             void *private_data),
    903                                             void *private_data);
    904 ssize_t tstream_read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
    905                                  uint8_t **pbuf, int *perrno);
    906604
    907605/* The following definitions come from lib/util_str.c  */
    908606
    909607bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
    910 int StrCaseCmp(const char *s, const char *t);
    911 int StrnCaseCmp(const char *s, const char *t, size_t len);
    912608bool strnequal(const char *s1,const char *s2,size_t n);
    913609bool strcsequal(const char *s1,const char *s2);
    914 void strnorm(char *s, int case_default);
    915 bool strisnormal(const char *s, int case_default);
     610bool strnorm(char *s, int case_default);
    916611char *push_skip_string(char *buf);
    917612char *skip_string(const char *base, size_t len, char *buf);
    918613size_t str_charnum(const char *s);
    919 size_t str_ascii_charnum(const char *s);
    920614bool trim_char(char *s,char cfront,char cback);
    921615bool strhasupper(const char *s);
    922616bool strhaslower(const char *s);
    923 char *safe_strcpy_fn(const char *fn,
    924                 int line,
    925                 char *dest,
    926                 const char *src,
    927                 size_t maxlength);
    928 char *safe_strcat_fn(const char *fn,
    929                 int line,
    930                 char *dest,
    931                 const char *src,
    932                 size_t maxlength);
    933 char *alpha_strcpy_fn(const char *fn,
    934                 int line,
    935                 char *dest,
    936                 const char *src,
    937                 const char *other_safe_chars,
    938                 size_t maxlength);
    939 char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n);
     617char *StrnCpy(char *dest,const char *src,size_t n);
    940618bool in_list(const char *s, const char *list, bool casesensitive);
    941 void string_free(char **s);
    942 bool string_set(char **dest,const char *src);
    943 void string_sub2(char *s,const char *pattern, const char *insert, size_t len,
    944                  bool remove_unsafe_characters, bool replace_once,
    945                  bool allow_trailing_dollar);
    946 void string_sub_once(char *s, const char *pattern,
    947                 const char *insert, size_t len);
    948 void string_sub(char *s,const char *pattern, const char *insert, size_t len);
    949619void fstring_sub(char *s,const char *pattern,const char *insert);
    950620char *realloc_string_sub2(char *string,
     
    977647char *strnrchr_m(const char *s, char c, unsigned int n);
    978648char *strstr_m(const char *src, const char *findstr);
    979 void strlower_m(char *s);
    980 void strupper_m(char *s);
     649bool strlower_m(char *s);
     650bool strupper_m(char *s);
    981651size_t strlen_m(const char *s);
    982652size_t strlen_m_term(const char *s);
     
    992662int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
    993663void ipstr_list_free(char* ipstr_list);
    994 DATA_BLOB base64_decode_data_blob(const char *s);
    995 void base64_decode_inplace(char *s);
    996 char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
    997664uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
    998 SMB_OFF_T conv_str_size(const char * str);
    999 void string_append(char **left, const char *right);
    1000 bool add_string_to_array(TALLOC_CTX *mem_ctx,
    1001                          const char *str, const char ***strings,
    1002                          int *num);
     665uint64_t conv_str_size(const char * str);
    1003666void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
    1004667                    size_t *bufsize, const char *fmt, ...);
     
    1006669char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...);
    1007670char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...);
    1008 char *sstring_sub(const char *src, char front, char back);
    1009671bool validate_net_name( const char *name,
    1010672                const char *invalid_chars,
    1011673                int max_len);
    1012674char *escape_shell_string(const char *src);
    1013 char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
    1014 char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
    1015 
    1016 /* The following definitions come from lib/util_unistr.c  */
    1017 
    1018 void gfree_case_tables(void);
    1019 void load_case_tables(void);
    1020 size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
    1021 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
    1022 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
    1023 bool isvalid83_w(smb_ucs2_t c);
    1024 size_t strlen_w(const smb_ucs2_t *src);
    1025 size_t strnlen_w(const smb_ucs2_t *src, size_t max);
    1026 smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
    1027 smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c);
    1028 smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c);
    1029 smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n);
    1030 smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins);
    1031 bool strlower_w(smb_ucs2_t *s);
    1032 bool strupper_w(smb_ucs2_t *s);
    1033 void strnorm_w(smb_ucs2_t *s, int case_default);
    1034 int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
    1035 int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
    1036 int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b);
    1037 int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len);
    1038 bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2);
    1039 bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n);
    1040 smb_ucs2_t *strdup_w(const smb_ucs2_t *src);
    1041 smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len);
    1042 smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
    1043 smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max);
    1044 smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src);
    1045 void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc);
    1046 bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front,
    1047                                   const smb_ucs2_t *back);
    1048 int strcmp_wa(const smb_ucs2_t *a, const char *b);
    1049 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
    1050 smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
    1051 smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
    1052 smb_ucs2_t toupper_w(smb_ucs2_t v);
    1053 bool isupper_w(smb_ucs2_t v);
    1054 smb_ucs2_t tolower_w(smb_ucs2_t v);
    1055 bool islower_w(smb_ucs2_t v);
     675ssize_t full_path_tos(const char *dir, const char *name,
     676                      char *tmpbuf, size_t tmpbuf_len,
     677                      char **pdst, char **to_free);
    1056678
    1057679/* The following definitions come from lib/version.c  */
     
    1068690void wins_srv_tags_free(char **list);
    1069691struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip);
     692bool wins_server_tag_ips(const char *tag, TALLOC_CTX *mem_ctx,
     693                         struct in_addr **pservers, int *pnum_servers);
    1070694unsigned wins_srv_count_tag(const char *tag);
    1071 
    1072 /* The following definitions come from libsmb/clispnego.c  */
    1073 
    1074 DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
    1075                                   const char *OIDs[],
    1076                                   DATA_BLOB *psecblob,
    1077                                   const char *principal);
    1078695
    1079696#ifndef ASN1_MAX_OIDS
     
    1085702                               char **principal,
    1086703                               DATA_BLOB *secblob);
    1087 DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8 tok_id[2]);
    1088 bool spnego_parse_krb5_wrap(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
    1089 int spnego_gen_krb5_negTokenInit(TALLOC_CTX *ctx,
    1090                             const char *principal, int time_offset,
    1091                             DATA_BLOB *targ,
    1092                             DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
    1093                             time_t *expire_time);
    1094 bool spnego_parse_challenge(TALLOC_CTX *ctx, const DATA_BLOB blob,
    1095                             DATA_BLOB *chal1, DATA_BLOB *chal2);
    1096 DATA_BLOB spnego_gen_auth(TALLOC_CTX *ctx, DATA_BLOB blob);
    1097 bool spnego_parse_auth(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *auth);
    1098 DATA_BLOB spnego_gen_auth_response(TALLOC_CTX *ctx, DATA_BLOB *reply, NTSTATUS nt_status,
    1099                                    const char *mechOID);
    1100 bool spnego_parse_auth_response(TALLOC_CTX *ctx,
    1101                                 DATA_BLOB blob, NTSTATUS nt_status,
    1102                                 const char *mechOID,
    1103                                 DATA_BLOB *auth);
    1104 
    1105 bool spnego_parse_auth_and_mic(TALLOC_CTX *ctx, DATA_BLOB blob,
    1106                                 DATA_BLOB *auth, DATA_BLOB *signature);
    1107 DATA_BLOB spnego_gen_auth_response_and_mic(TALLOC_CTX *ctx,
    1108                                            NTSTATUS nt_status,
    1109                                            const char *mechOID,
    1110                                            DATA_BLOB *reply,
    1111                                            DATA_BLOB *mechlistMIC);
    1112 bool spnego_mech_list_blob(TALLOC_CTX *mem_ctx,
    1113                            char **oid_list, DATA_BLOB *data);
     704DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8_t tok_id[2]);
    1114705
    1115706/* The following definitions come from libsmb/conncache.c  */
     
    1123714struct netr_DsRGetDCNameInfo;
    1124715
    1125 void debug_dsdcinfo_flags(int lvl, uint32_t flags);
    1126716NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
    1127717                     struct messaging_context *msg_ctx,
     
    1134724/* The following definitions come from libsmb/errormap.c  */
    1135725
    1136 NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode);
    1137 void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode);
    1138 NTSTATUS werror_to_ntstatus(WERROR error);
    1139 WERROR ntstatus_to_werror(NTSTATUS error);
    1140 NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
     726NTSTATUS dos_to_ntstatus(uint8_t eclass, uint32_t ecode);
    1141727
    1142728/* The following definitions come from libsmb/namecache.c  */
     
    1166752bool saf_join_store( const char *domain, const char *servername );
    1167753bool saf_delete( const char *domain );
    1168 char *saf_fetch( const char *domain );
     754char *saf_fetch(TALLOC_CTX *mem_ctx, const char *domain );
    1169755struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
    1170756                                          struct tevent_context *ev,
     
    1185771                        const struct sockaddr_storage *to_ss,
    1186772                        fstring name);
    1187 int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
     773int remove_duplicate_addrs2(struct ip_service *iplist, int count );
    1188774struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
    1189775                                   struct tevent_context *ev,
     
    1200786                    struct sockaddr_storage **addrs,
    1201787                    int *num_addrs, uint8_t *flags);
     788struct tevent_req *name_resolve_bcast_send(TALLOC_CTX *mem_ctx,
     789                                           struct tevent_context *ev,
     790                                           const char *name,
     791                                           int name_type);
     792NTSTATUS name_resolve_bcast_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
     793                                 struct sockaddr_storage **addrs,
     794                                 int *num_addrs);
    1202795NTSTATUS name_resolve_bcast(const char *name,
    1203796                        int name_type,
     
    1205798                        struct sockaddr_storage **return_iplist,
    1206799                        int *return_count);
     800struct tevent_req *resolve_wins_send(TALLOC_CTX *mem_ctx,
     801                                     struct tevent_context *ev,
     802                                     const char *name,
     803                                     int name_type);
     804NTSTATUS resolve_wins_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
     805                           struct sockaddr_storage **addrs,
     806                           int *num_addrs, uint8_t *flags);
    1207807NTSTATUS resolve_wins(const char *name,
    1208808                int name_type,
    1209                 struct ip_service **return_iplist,
     809                TALLOC_CTX *mem_ctx,
     810                struct sockaddr_storage **return_iplist,
    1210811                int *return_count);
    1211812NTSTATUS internal_resolve_name(const char *name,
     
    1214815                                struct ip_service **return_iplist,
    1215816                                int *return_count,
    1216                                 const char *resolve_order);
     817                                const char **resolve_order);
    1217818bool resolve_name(const char *name,
    1218819                struct sockaddr_storage *return_ss,
     
    1243844                struct sockaddr_storage *ss_out);
    1244845
    1245 /* The following definitions come from libsmb/nterr.c  */
    1246 
    1247 const char *nt_errstr(NTSTATUS nt_code);
    1248 const char *get_friendly_nt_error_msg(NTSTATUS nt_code);
    1249 const char *get_nt_error_c_code(NTSTATUS nt_code);
    1250 NTSTATUS nt_status_string_to_code(const char *nt_status_str);
    1251 NTSTATUS nt_status_squash(NTSTATUS nt_status);
    1252 
    1253 /* The following definitions come from libsmb/ntlmssp.c  */
    1254 struct ntlmssp_state;
    1255 NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
    1256 NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
    1257                             const uint8_t lm_hash[16],
    1258                             const uint8_t nt_hash[16]) ;
    1259 NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
    1260 NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
    1261 void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
    1262 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
    1263 bool ntlmssp_have_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
    1264 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
    1265                         const DATA_BLOB in, DATA_BLOB *out) ;
    1266 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
    1267                               bool is_standalone,
    1268                               const char *netbios_name,
    1269                               const char *netbios_domain,
    1270                               const char *dns_name,
    1271                               const char *dns_domain,
    1272                               struct ntlmssp_state **ntlmssp_state);
    1273 NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
    1274                               const char *netbios_name,
    1275                               const char *netbios_domain,
    1276                               bool use_ntlmv2,
    1277                               struct ntlmssp_state **_ntlmssp_state);
    1278 
    1279846/* The following definitions come from libsmb/passchange.c  */
    1280847
     
    1294861/* The following definitions come from libsmb/smberr.c  */
    1295862
    1296 const char *smb_dos_err_name(uint8 e_class, uint16 num);
     863const char *smb_dos_err_name(uint8_t e_class, uint16_t num);
    1297864const char *get_dos_error_msg(WERROR result);
    1298 const char *smb_dos_err_class(uint8 e_class);
    1299 char *smb_dos_errstr(char *inbuf);
     865const char *smb_dos_err_class(uint8_t e_class);
    1300866WERROR map_werror_from_unix(int error);
    1301867
     
    1304870bool trustdom_cache_enable(void);
    1305871bool trustdom_cache_shutdown(void);
    1306 bool trustdom_cache_store(char* name, char* alt_name, const struct dom_sid *sid,
    1307                           time_t timeout);
     872bool trustdom_cache_store(const char *name, const char *alt_name,
     873                          const struct dom_sid *sid, time_t timeout);
    1308874bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
    1309 uint32 trustdom_cache_fetch_timestamp( void );
    1310 bool trustdom_cache_store_timestamp( uint32 t, time_t timeout );
     875uint32_t trustdom_cache_fetch_timestamp( void );
     876bool trustdom_cache_store_timestamp( uint32_t t, time_t timeout );
    1311877void trustdom_cache_flush(void);
    1312878void update_trustdom_cache( void );
     
    1314880/* The following definitions come from libsmb/trusts_util.c  */
    1315881
    1316 NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
    1317                                       const char *domain,
    1318                                       const char *account_name,
    1319                                       unsigned char orig_trust_passwd_hash[16],
    1320                                       enum netr_SchannelType sec_channel_type);
    1321 NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli,
    1322                                            TALLOC_CTX *mem_ctx,
    1323                                            const char *domain) ;
    1324 bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
    1325                                      char ***domain_names, uint32 *num_domains,
    1326                                      struct dom_sid **sids );
    1327 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
     882struct netlogon_creds_cli_context;
     883struct messaging_context;
     884struct dcerpc_binding_handle;
     885NTSTATUS trust_pw_change(struct netlogon_creds_cli_context *context,
     886                         struct messaging_context *msg_ctx,
     887                         struct dcerpc_binding_handle *b,
     888                         const char *domain,
     889                         bool force);
    1328890
    1329891/* The following definitions come from param/loadparm.c  */
    1330892
    1331 char *lp_smb_ports(void);
    1332 const char *lp_dos_charset(void);
    1333 const char *lp_unix_charset(void);
    1334 const char *lp_display_charset(void);
    1335 char *lp_logfile(void);
    1336 char *lp_configfile(void);
    1337 char *lp_smb_passwd_file(void);
    1338 char *lp_private_dir(void);
    1339 char *lp_serverstring(void);
    1340 int lp_printcap_cache_time(void);
    1341 char *lp_addport_cmd(void);
    1342 char *lp_enumports_cmd(void);
    1343 char *lp_addprinter_cmd(void);
    1344 char *lp_deleteprinter_cmd(void);
    1345 char *lp_os2_driver_map(void);
    1346 char *lp_lockdir(void);
    1347 char *lp_statedir(void);
    1348 char *lp_cachedir(void);
    1349 char *lp_piddir(void);
    1350 char *lp_mangling_method(void);
    1351 int lp_mangle_prefix(void);
    1352 char *lp_utmpdir(void);
    1353 char *lp_wtmpdir(void);
    1354 bool lp_utmp(void);
    1355 char *lp_rootdir(void);
    1356 char *lp_defaultservice(void);
    1357 char *lp_msg_command(void);
    1358 char *lp_get_quota_command(void);
    1359 char *lp_set_quota_command(void);
    1360 char *lp_auto_services(void);
    1361 char *lp_passwd_program(void);
    1362 char *lp_passwd_chat(void);
    1363 char *lp_passwordserver(void);
    1364 char *lp_name_resolve_order(void);
    1365 char *lp_realm(void);
    1366 const char *lp_afs_username_map(void);
    1367 int lp_afs_token_lifetime(void);
    1368 char *lp_log_nt_token_command(void);
    1369 char *lp_username_map(void);
    1370 const char *lp_logon_script(void);
    1371 const char *lp_logon_path(void);
    1372 const char *lp_logon_drive(void);
    1373 const char *lp_logon_home(void);
    1374 char *lp_remote_announce(void);
    1375 char *lp_remote_browse_sync(void);
    1376 bool lp_nmbd_bind_explicit_broadcast(void);
    1377 const char **lp_wins_server_list(void);
    1378 const char **lp_interfaces(void);
    1379 const char *lp_socket_address(void);
    1380 char *lp_nis_home_map_name(void);
    1381 const char **lp_netbios_aliases(void);
    1382 const char *lp_passdb_backend(void);
    1383 const char **lp_preload_modules(void);
    1384 char *lp_panic_action(void);
    1385 char *lp_adduser_script(void);
    1386 char *lp_renameuser_script(void);
    1387 char *lp_deluser_script(void);
    1388 const char *lp_guestaccount(void);
    1389 char *lp_addgroup_script(void);
    1390 char *lp_delgroup_script(void);
    1391 char *lp_addusertogroup_script(void);
    1392 char *lp_deluserfromgroup_script(void);
    1393 char *lp_setprimarygroup_script(void);
    1394 char *lp_addmachine_script(void);
    1395 char *lp_shutdown_script(void);
    1396 char *lp_abort_shutdown_script(void);
    1397 char *lp_username_map_script(void);
    1398 int lp_username_map_cache_time(void);
    1399 char *lp_check_password_script(void);
    1400 char *lp_wins_hook(void);
    1401 const char *lp_template_homedir(void);
    1402 const char *lp_template_shell(void);
    1403 const char *lp_winbind_separator(void);
    1404 int lp_acl_compatibility(void);
    1405 bool lp_winbind_enum_users(void);
    1406 bool lp_winbind_enum_groups(void);
    1407 bool lp_winbind_use_default_domain(void);
    1408 bool lp_winbind_trusted_domains_only(void);
    1409 bool lp_winbind_nested_groups(void);
    1410 int lp_winbind_expand_groups(void);
    1411 bool lp_winbind_refresh_tickets(void);
    1412 bool lp_winbind_offline_logon(void);
    1413 bool lp_winbind_normalize_names(void);
    1414 bool lp_winbind_rpc_only(void);
    1415 bool lp_create_krb5_conf(void);
     893#include "source3/param/param_proto.h"
     894
     895char *lp_servicename(TALLOC_CTX *ctx, int);
     896const char *lp_const_servicename(int);
     897bool lp_autoloaded(int);
     898const char *lp_dnsdomain(void);
    1416899int lp_winbind_max_domain_connections(void);
    1417 const char *lp_idmap_backend(void);
    1418 int lp_idmap_cache_time(void);
    1419 int lp_idmap_negative_cache_time(void);
    1420 int lp_keepalive(void);
    1421 bool lp_passdb_expand_explicit(void);
    1422 char *lp_ldap_suffix(void);
    1423 char *lp_ldap_admin_dn(void);
    1424 int lp_ldap_ssl(void);
    1425 bool lp_ldap_ssl_ads(void);
    1426 int lp_ldap_deref(void);
    1427 int lp_ldap_follow_referral(void);
    1428 int lp_ldap_passwd_sync(void);
    1429 bool lp_ldap_delete_dn(void);
    1430 int lp_ldap_replication_sleep(void);
    1431 int lp_ldap_timeout(void);
    1432 int lp_ldap_connection_timeout(void);
    1433 int lp_ldap_page_size(void);
    1434 int lp_ldap_debug_level(void);
    1435 int lp_ldap_debug_threshold(void);
    1436 char *lp_add_share_cmd(void);
    1437 char *lp_change_share_cmd(void);
    1438 char *lp_delete_share_cmd(void);
    1439 char *lp_usershare_path(void);
    1440 const char **lp_usershare_prefix_allow_list(void);
    1441 const char **lp_usershare_prefix_deny_list(void);
    1442 const char **lp_eventlog_list(void);
    1443 bool lp_registry_shares(void);
    1444 bool lp_usershare_allow_guests(void);
    1445 bool lp_usershare_owner_only(void);
    1446 bool lp_disable_netbios(void);
    1447 bool lp_reset_on_zero_vc(void);
    1448 bool lp_log_writeable_files_on_exit(void);
    1449 bool lp_ms_add_printer_wizard(void);
    1450 bool lp_dns_proxy(void);
    1451 bool lp_wins_support(void);
    1452 bool lp_we_are_a_wins_server(void);
    1453 bool lp_wins_proxy(void);
    1454 bool lp_local_master(void);
    1455 bool lp_domain_logons(void);
    1456 const char **lp_init_logon_delayed_hosts(void);
    1457 int lp_init_logon_delay(void);
    1458 bool lp_load_printers(void);
    1459 bool lp_readraw(void);
    1460 bool _lp_readraw(void);
    1461 bool lp_large_readwrite(void);
    1462 bool lp_writeraw(void);
    1463 bool _lp_writeraw(void);
    1464 bool lp_null_passwords(void);
    1465 bool lp_obey_pam_restrictions(void);
    1466 bool lp_encrypted_passwords(void);
    1467 int lp_client_schannel(void);
    1468 int lp_server_schannel(void);
    1469 bool lp_syslog_only(void);
    1470 bool lp_timestamp_logs(void);
    1471 bool lp_debug_prefix_timestamp(void);
    1472 bool lp_debug_hires_timestamp(void);
    1473 bool lp_debug_pid(void);
    1474 bool lp_debug_uid(void);
    1475 bool lp_debug_class(void);
    1476 bool lp_enable_core_files(void);
    1477 bool lp_browse_list(void);
    1478 bool lp_nis_home_map(void);
    1479 bool lp_bind_interfaces_only(void);
    1480 bool lp_pam_password_change(void);
    1481 bool lp_unix_password_sync(void);
    1482 bool lp_passwd_chat_debug(void);
    1483 int lp_passwd_chat_timeout(void);
    1484 bool lp_nt_pipe_support(void);
    1485 bool lp_nt_status_support(void);
    1486 bool lp_stat_cache(void);
    1487 int lp_max_stat_cache_size(void);
    1488 bool lp_allow_trusted_domains(void);
    1489 bool lp_map_untrusted_to_domain(void);
    1490 int lp_restrict_anonymous(void);
    1491 bool lp_lanman_auth(void);
    1492 bool lp_ntlm_auth(void);
    1493 bool lp_raw_ntlmv2_auth(void);
    1494 bool lp_client_plaintext_auth(void);
    1495 bool lp_client_lanman_auth(void);
    1496 bool lp_client_ntlmv2_auth(void);
    1497 bool lp_host_msdfs(void);
    1498 bool lp_kernel_oplocks(void);
    1499 bool lp_enhanced_browsing(void);
    1500 bool lp_use_mmap(void);
    1501 bool lp_unix_extensions(void);
    1502 bool lp_use_spnego(void);
    1503 bool lp_client_use_spnego(void);
    1504 bool lp_client_use_spnego_principal(void);
    1505 bool lp_send_spnego_principal(void);
    1506 bool lp_hostname_lookups(void);
    1507 bool lp_change_notify(const struct share_params *p );
    1508 bool lp_kernel_change_notify(const struct share_params *p );
    1509 char * lp_dedicated_keytab_file(void);
    1510 int lp_kerberos_method(void);
    1511 bool lp_defer_sharing_violations(void);
    1512 bool lp_enable_privileges(void);
    1513 bool lp_enable_asu_support(void);
    1514 int lp_os_level(void);
    1515 int lp_max_ttl(void);
    1516 int lp_max_wins_ttl(void);
    1517 int lp_min_wins_ttl(void);
    1518 int lp_max_log_size(void);
    1519 int lp_max_open_files(void);
    1520 int lp_open_files_db_hash_size(void);
    1521 int lp_maxxmit(void);
    1522 int lp_maxmux(void);
    1523 int lp_passwordlevel(void);
    1524 int lp_usernamelevel(void);
    1525 int lp_deadtime(void);
    1526 bool lp_getwd_cache(void);
    1527 int lp_maxprotocol(void);
    1528 int lp_minprotocol(void);
     900bool lp_idmap_range(const char *domain_name, uint32_t *low, uint32_t *high);
     901bool lp_idmap_default_range(uint32_t *low, uint32_t *high);
     902const char *lp_idmap_backend(const char *domain_name);
     903const char *lp_idmap_default_backend (void);
    1529904int lp_security(void);
    1530 const char **lp_auth_methods(void);
    1531 bool lp_paranoid_server_security(void);
    1532 int lp_maxdisksize(void);
    1533 int lp_lpqcachetime(void);
    1534 int lp_max_smbd_processes(void);
    1535 bool _lp_disable_spoolss(void);
    1536 int lp_syslog(void);
    1537 int lp_lm_announce(void);
    1538 int lp_lm_interval(void);
    1539 int lp_machine_password_timeout(void);
    1540 int lp_map_to_guest(void);
    1541 int lp_oplock_break_wait_time(void);
    1542 int lp_lock_spin_time(void);
    1543 int lp_usershare_max_shares(void);
    1544 const char *lp_socket_options(void);
    1545 int lp_config_backend(void);
    1546 int lp_smb2_max_read(void);
    1547 int lp_smb2_max_write(void);
    1548 int lp_smb2_max_trans(void);
     905int lp_client_max_protocol(void);
     906int lp_client_ipc_min_protocol(void);
     907int lp_client_ipc_max_protocol(void);
     908int lp_client_ipc_signing(void);
    1549909int lp_smb2_max_credits(void);
    1550 char *lp_preexec(int );
    1551 char *lp_postexec(int );
    1552 char *lp_rootpreexec(int );
    1553 char *lp_rootpostexec(int );
    1554 char *lp_servicename(int );
    1555 const char *lp_const_servicename(int );
    1556 char *lp_pathname(int );
    1557 char *lp_dontdescend(int );
    1558 char *lp_username(int );
    1559 const char **lp_invalid_users(int );
    1560 const char **lp_valid_users(int );
    1561 const char **lp_admin_users(int );
    1562 const char **lp_svcctl_list(void);
    1563 char *lp_cups_options(int );
    1564 char *lp_cups_server(void);
    1565910int lp_cups_encrypt(void);
    1566 char *lp_iprint_server(void);
    1567 int lp_cups_connection_timeout(void);
    1568 const char *lp_ctdbd_socket(void);
    1569 const char **lp_cluster_addresses(void);
    1570 bool lp_clustering(void);
    1571 int lp_ctdb_timeout(void);
    1572 int lp_ctdb_locktime_warn_threshold(void);
    1573 char *lp_printcommand(int );
    1574 char *lp_lpqcommand(int );
    1575 char *lp_lprmcommand(int );
    1576 char *lp_lppausecommand(int );
    1577 char *lp_lpresumecommand(int );
    1578 char *lp_queuepausecommand(int );
    1579 char *lp_queueresumecommand(int );
    1580 const char *lp_printjob_username(int );
    1581 const char **lp_hostsallow(int );
    1582 const char **lp_hostsdeny(int );
    1583 char *lp_magicscript(int );
    1584 char *lp_magicoutput(int );
    1585 char *lp_comment(int );
    1586 char *lp_force_user(int );
    1587 char *lp_force_group(int );
    1588 const char **lp_readlist(int );
    1589 const char **lp_writelist(int );
    1590 const char **lp_printer_admin(int );
    1591 char *lp_fstype(int );
    1592 const char **lp_vfs_objects(int );
    1593 char *lp_msdfs_proxy(int );
    1594 char *lp_veto_files(int );
    1595 char *lp_hide_files(int );
    1596 char *lp_veto_oplocks(int );
    1597 bool lp_msdfs_root(int );
    1598 char *lp_aio_write_behind(int );
    1599 char *lp_dfree_command(int );
    1600 bool lp_autoloaded(int );
    1601 bool lp_preexec_close(int );
    1602 bool lp_rootpreexec_close(int );
    1603 int lp_casesensitive(int );
    1604 bool lp_preservecase(int );
    1605 bool lp_shortpreservecase(int );
    1606 bool lp_hide_dot_files(int );
    1607 bool lp_hide_special_files(int );
    1608 bool lp_hideunreadable(int );
    1609 bool lp_hideunwriteable_files(int );
    1610 bool lp_browseable(int );
    1611 bool lp_access_based_share_enum(int );
    1612 bool lp_readonly(int );
    1613 bool lp_no_set_dir(int );
    1614 bool lp_guest_ok(int );
    1615 bool lp_guest_only(int );
    1616 bool lp_administrative_share(int );
    1617 bool lp_print_ok(int );
    1618 bool lp_print_notify_backchannel(int );
    1619 bool lp_map_hidden(int );
    1620 bool lp_map_archive(int );
    1621 bool lp_store_dos_attributes(int );
    1622 bool lp_dmapi_support(int );
    1623 bool lp_locking(const struct share_params *p );
    1624 int lp_strict_locking(const struct share_params *p );
    1625 bool lp_posix_locking(const struct share_params *p );
    1626 bool lp_share_modes(int );
    1627 bool lp_oplocks(int );
    1628 bool lp_level2_oplocks(int );
    1629 bool lp_onlyuser(int );
    1630 bool lp_manglednames(const struct share_params *p );
    1631 bool lp_allow_insecure_widelinks(void);
    1632911bool lp_widelinks(int );
    1633 bool lp_symlinks(int );
    1634 bool lp_syncalways(int );
    1635 bool lp_strict_allocate(int );
    1636 bool lp_strict_sync(int );
    1637 bool lp_map_system(int );
    1638 bool lp_delete_readonly(int );
    1639 bool lp_fake_oplocks(int );
    1640 bool lp_recursive_veto_delete(int );
    1641 bool lp_dos_filemode(int );
    1642 bool lp_dos_filetimes(int );
    1643 bool lp_dos_filetime_resolution(int );
    1644 bool lp_fake_dir_create_times(int);
    1645 bool lp_async_smb_echo_handler(void);
    1646 bool lp_multicast_dns_register(void);
    1647 bool lp_blocking_locks(int );
    1648 bool lp_inherit_perms(int );
    1649 bool lp_inherit_acls(int );
    1650 bool lp_inherit_owner(int );
    1651 bool lp_use_client_driver(int );
    1652 bool lp_default_devmode(int );
    1653 bool lp_force_printername(int );
    1654 bool lp_nt_acl_support(int );
    1655 bool lp_force_unknown_acl_user(int );
    1656 bool lp_ea_support(int );
    1657 bool _lp_use_sendfile(int );
    1658 bool lp_profile_acls(int );
    1659 bool lp_map_acl_inherit(int );
    1660 bool lp_afs_share(int );
    1661 bool lp_acl_check_permissions(int );
    1662 bool lp_acl_group_control(int );
    1663 bool lp_acl_map_full_control(int );
    1664 int lp_create_mask(int );
    1665 int lp_force_create_mode(int );
    1666 int lp_security_mask(int );
    1667 int lp_force_security_mode(int );
    1668 int lp_dir_mask(int );
    1669 int lp_force_dir_mode(int );
    1670 int lp_dir_security_mask(int );
    1671 int lp_force_dir_security_mode(int );
    1672 int lp_max_connections(int );
    1673 int lp_defaultcase(int );
    1674 int lp_minprintspace(int );
    1675 int lp_printing(int );
    1676 int lp_max_reported_jobs(int );
    1677 int lp_oplock_contention_limit(int );
    1678 int lp_csc_policy(int );
    1679 int lp_write_cache_size(int );
    1680 int lp_block_size(int );
    1681 int lp_dfree_cache_time(int );
    1682 int lp_allocation_roundup_size(int );
    1683 int lp_aio_read_size(int );
    1684 int lp_aio_write_size(int );
    1685 int lp_map_readonly(int );
    1686 int lp_directory_name_cache_size(int );
    1687 int lp_smb_encrypt(int );
    1688 char lp_magicchar(const struct share_params *p );
    1689 int lp_winbind_cache_time(void);
    1690 int lp_winbind_reconnect_delay(void);
    1691 int lp_winbind_max_clients(void);
    1692 const char **lp_winbind_nss_info(void);
    1693 bool lp_winbind_sealed_pipes(void);
    1694 int lp_algorithmic_rid_base(void);
    1695 int lp_name_cache_timeout(void);
    1696 int lp_client_signing(void);
    1697 int lp_client_ipc_signing(void);
    1698 int lp_server_signing(void);
    1699 int lp_client_ldap_sasl_wrapping(void);
    1700 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def);
     912
     913int lp_wi_scan_global_parametrics(
     914        const char *regex, size_t max_matches,
     915        bool (*cb)(const char *string, regmatch_t matches[],
     916                   void *private_data),
     917        void *private_data);
     918
     919char *lp_parm_talloc_string(TALLOC_CTX *ctx, int snum, const char *type, const char *option, const char *def);
    1701920const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def);
     921struct loadparm_service;
     922const char *lp_parm_const_string_service(struct loadparm_service *service, const char *type,
     923                                         const char *option, const char *def);
    1702924const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def);
    1703925int lp_parm_int(int snum, const char *type, const char *option, int def);
    1704926unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def);
     927unsigned long long lp_parm_ulonglong(int snum, const char *type,
     928                                     const char *option,
     929                                     unsigned long long def);
    1705930bool lp_parm_bool(int snum, const char *type, const char *option, bool def);
     931struct enum_list;
    1706932int lp_parm_enum(int snum, const char *type, const char *option,
    1707933                 const struct enum_list *_enum, int def);
     
    1713939bool lp_parameter_is_valid(const char *pszParmName);
    1714940bool lp_parameter_is_global(const char *pszParmName);
    1715 bool lp_parameter_is_canonical(const char *parm_name);
    1716941bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
    1717942                               bool *inverse);
     
    1721946                                          const char **canon_val);
    1722947void show_parameter_list(void);
    1723 bool lp_string_is_valid_boolean(const char *parm_value);
    1724948bool lp_invert_boolean(const char *str, const char **inverse_str);
    1725949bool lp_canonicalize_boolean(const char *str, const char**canon_str);
    1726 bool service_ok(int iService);
    1727950bool process_registry_service(const char *service_name);
    1728951bool process_registry_shares(void);
     
    1730953bool lp_config_backend_is_file(void);
    1731954bool lp_file_list_changed(void);
    1732 bool lp_idmap_uid(uid_t *low, uid_t *high);
    1733 bool lp_idmap_gid(gid_t *low, gid_t *high);
    1734 const char *lp_ldap_machine_suffix(void);
    1735 const char *lp_ldap_user_suffix(void);
    1736 const char *lp_ldap_group_suffix(void);
    1737 const char *lp_ldap_idmap_suffix(void);
    1738 void *lp_local_ptr_by_snum(int snum, void *ptr);
     955const char *lp_ldap_machine_suffix(TALLOC_CTX *ctx);
     956const char *lp_ldap_user_suffix(TALLOC_CTX *ctx);
     957const char *lp_ldap_group_suffix(TALLOC_CTX *ctx);
     958const char *lp_ldap_idmap_suffix(TALLOC_CTX *ctx);
     959struct parm_struct;
     960/* Return a pointer to a service by name.  */
     961struct loadparm_service *lp_service(const char *pszServiceName);
     962struct loadparm_service *lp_servicebynum(int snum);
     963struct loadparm_service *lp_default_loadparm_service(void);
     964void *lp_parm_ptr(struct loadparm_service *service, struct parm_struct *parm);
     965void *lp_local_ptr_by_snum(int snum, struct parm_struct *parm);
    1739966bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
    1740967bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
    1741 bool lp_set_option(const char *option);
    1742 void init_locals(void);
    1743 bool lp_is_default(int snum, struct parm_struct *parm);
    1744968bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal);
    1745 struct parm_struct *lp_get_parameter(const char *param_name);
    1746 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
    1747969bool lp_snum_ok(int iService);
    1748970void lp_add_one_printer(const char *name, const char *comment,
    1749971                        const char *location, void *pdata);
    1750972bool lp_loaded(void);
    1751 void lp_killunused(bool (*snumused) (int));
     973void lp_killunused(struct smbd_server_connection *sconn,
     974                   bool (*snumused) (struct smbd_server_connection *, int));
    1752975void lp_kill_all_services(void);
    1753976void lp_killservice(int iServiceIn);
    1754 const char* server_role_str(uint32 role);
     977const char* server_role_str(uint32_t role);
    1755978enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
    1756979                        SMB_STRUCT_STAT *psbuf,
     
    1765988                        bool *pallow_guest);
    1766989int load_usershare_service(const char *servicename);
    1767 int load_usershare_shares(void);
     990int load_usershare_shares(struct smbd_server_connection *sconn,
     991                          bool (*snumused) (struct smbd_server_connection *, int));
    1768992void gfree_loadparm(void);
    1769 void lp_set_in_client(bool b);
    1770 bool lp_is_in_client(void);
    1771 bool lp_load(const char *pszFname,
    1772              bool global_only,
    1773              bool save_defaults,
    1774              bool add_ipc,
    1775              bool initialize_globals);
    1776993bool lp_load_initial_only(const char *pszFname);
    1777 bool lp_load_with_registry_shares(const char *pszFname,
    1778                                   bool global_only,
    1779                                   bool save_defaults,
    1780                                   bool add_ipc,
    1781                                   bool initialize_globals);
     994bool lp_load_global(const char *file_name);
     995bool lp_load_with_shares(const char *file_name);
     996bool lp_load_client(const char *file_name);
     997bool lp_load_global_no_reinit(const char *file_name);
     998bool lp_load_no_reinit(const char *file_name);
     999bool lp_load_client_no_reinit(const char *file_name);
     1000bool lp_load_with_registry_shares(const char *pszFname);
    17821001int lp_numservices(void);
    17831002void lp_dump(FILE *f, bool show_defaults, int maxtoprint);
    17841003void lp_dump_one(FILE * f, bool show_defaults, int snum);
    17851004int lp_servicenumber(const char *pszServiceName);
    1786 bool share_defined(const char *service_name);
    1787 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
    1788                                       const char *sharename);
    1789 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx);
    1790 struct share_params *next_share(struct share_iterator *list);
    1791 struct share_params *next_printer(struct share_iterator *list);
    1792 struct share_params *snum2params_static(int snum);
    1793 const char *volume_label(int snum);
     1005const char *volume_label(TALLOC_CTX *ctx, int snum);
    17941006bool lp_domain_master(void);
    1795 bool lp_domain_master_true_or_auto(void);
    17961007bool lp_preferred_master(void);
    17971008void lp_remove_service(int snum);
    17981009void lp_copy_service(int snum, const char *new_name);
    17991010int lp_default_server_announce(void);
    1800 int lp_major_announce_version(void);
    1801 int lp_minor_announce_version(void);
    1802 void lp_set_name_resolve_order(const char *new_order);
    1803 const char *lp_printername(int snum);
     1011const char *lp_printername(TALLOC_CTX *ctx, int snum);
    18041012void lp_set_logfile(const char *name);
    18051013int lp_maxprintjobs(int snum);
    18061014const char *lp_printcapname(void);
    18071015bool lp_disable_spoolss( void );
    1808 void lp_set_spoolss_state( uint32 state );
    1809 uint32 lp_get_spoolss_state( void );
     1016void lp_set_spoolss_state( uint32_t state );
     1017uint32_t lp_get_spoolss_state( void );
    18101018struct smb_signing_state;
    18111019bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state);
    18121020void set_use_sendfile(int snum, bool val);
    1813 void set_store_dos_attributes(int snum, bool val);
    18141021void lp_set_mangling_method(const char *new_method);
    18151022bool lp_posix_pathnames(void);
     
    18181025void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val);
    18191026int lp_min_receive_file_size(void);
    1820 char* lp_perfcount_module(void);
    1821 void lp_set_passdb_backend(const char *backend);
     1027char* lp_perfcount_module(TALLOC_CTX *ctx);
    18221028void widelinks_warning(int snum);
    1823 char *lp_ncalrpc_dir(void);
    1824 bool lp_allow_dcerpc_auth_level_connect(void);
     1029const char *lp_ncalrpc_dir(void);
     1030void _lp_set_server_role(int server_role);
     1031
     1032/* The following definitions come from param/loadparm_ctx.c  */
     1033
     1034const struct loadparm_s3_helpers *loadparm_s3_helpers(void);
    18251035
    18261036/* The following definitions come from param/loadparm_server_role.c  */
     
    18311041/* The following definitions come from param/util.c  */
    18321042
    1833 uint32 get_int_param( const char* param );
     1043uint32_t get_int_param( const char* param );
    18341044char* get_string_param( const char* param );
    18351045
     
    18421052/* The following definitions come from lib/sessionid_tdb.c  */
    18431053struct sessionid;
    1844 bool sessionid_init(void);
    1845 bool sessionid_init_readonly(void);
    1846 struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
    1847 int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
    1848                                  struct sessionid *session,
    1849                                  void *private_data),
    1850                        void *private_data);
    1851 int sessionid_traverse_read(int (*fn)(const char *key,
    1852                                       struct sessionid *session,
    1853                                       void *private_data),
    1854                             void *private_data);
     1054NTSTATUS sessionid_traverse_read(int (*fn)(const char *key,
     1055                                           struct sessionid *session,
     1056                                           void *private_data),
     1057                                 void *private_data);
    18551058
    18561059/* The following definitions come from utils/passwd_util.c  */
     
    19341137bool lookup_unix_group_name(const char *name, struct dom_sid *sid);
    19351138
     1139/* The following definitions come from lib/util_specialsids.c  */
     1140bool sid_check_is_asserted_identity(const struct dom_sid *sid);
     1141bool sid_check_is_in_asserted_identity(const struct dom_sid *sid);
     1142const char *asserted_identity_domain_name(void);
     1143
    19361144/* The following definitions come from lib/filename_util.c */
    19371145
    19381146NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
    19391147                              char **full_name);
    1940 NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
    1941                                     const char *stream_name,
    1942                                     const SMB_STRUCT_STAT *psbuf,
    1943                                     struct smb_filename **smb_fname_out);
    1944 NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
    1945                                           const char *fname,
    1946                                           const SMB_STRUCT_STAT *psbuf,
    1947                                           struct smb_filename **smb_fname_out);
     1148struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
     1149                                         const char *base_name,
     1150                                         const char *stream_name,
     1151                                         const SMB_STRUCT_STAT *psbuf);
     1152struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX *ctx,
     1153                                               const char *fname,
     1154                                               const SMB_STRUCT_STAT *psbuf);
    19481155const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
    19491156const char *fsp_str_dbg(const struct files_struct *fsp);
    1950 NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
    1951                            const struct smb_filename *smb_fname_in,
    1952                            struct smb_filename **smb_fname_out);
     1157const char *fsp_fnum_dbg(const struct files_struct *fsp);
     1158struct smb_filename *cp_smb_filename(TALLOC_CTX *mem_ctx,
     1159                                     const struct smb_filename *in);
    19531160bool is_ntfs_stream_smb_fname(const struct smb_filename *smb_fname);
    19541161bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
     1162bool is_invalid_windows_ea_name(const char *name);
     1163bool ea_list_has_invalid_name(struct ea_list *ea_list);
    19551164
    19561165/* The following definitions come from lib/dummyroot.c */
     
    19591168void unbecome_root(void);
    19601169
    1961 /* The following definitions come from lib/dummysmbd.c */
     1170/* The following definitions come from lib/smbd_shim.c */
    19621171
    19631172int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out);
    1964 bool conn_snum_used(int snum);
    19651173void cancel_pending_lock_requests_by_fid(files_struct *fsp,
    19661174                        struct byte_range_lock *br_lck,
     
    19701178NTSTATUS can_delete_directory_fsp(files_struct *fsp);
    19711179bool change_to_root_user(void);
    1972 struct event_context *smbd_event_context(void);
     1180bool become_authenticated_pipe_user(struct auth_session_info *session_info);
     1181bool unbecome_authenticated_pipe_user(void);
     1182
    19731183void contend_level2_oplocks_begin(files_struct *fsp,
    19741184                                  enum level2_contention_type type);
  • vendor/current/source3/include/registry.h

    r740 r988  
    4646        bool    (*store_subkeys)( const char *key, struct regsubkey_ctr *subkeys );
    4747        WERROR  (*create_subkey)(const char *key, const char *subkey);
    48         WERROR  (*delete_subkey)(const char *key, const char *subkey);
     48        WERROR  (*delete_subkey)(const char *key, const char *subkey, bool lazy);
    4949        bool    (*store_values)( const char *key, struct regval_ctr *val );
    50         bool    (*reg_access_check)( const char *keyname, uint32 requested,
    51                                      uint32 *granted,
     50        bool    (*reg_access_check)( const char *keyname, uint32_t requested,
     51                                     uint32_t *granted,
    5252                                     const struct security_token *token );
    5353        WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key,
     
    6262
    6363struct registry_key_handle {
    64         uint32          type;
     64        uint32_t        type;
    6565        char            *name;          /* full name of registry key */
    66         uint32          access_granted;
     66        uint32_t        access_granted;
    6767        struct registry_ops     *ops;
    6868};
  • vendor/current/source3/include/rpc_misc.h

    r740 r988  
    2929
    3030#define OUR_HANDLE(hnd) (((hnd)==NULL) ? "NULL" :\
    31         ( IVAL((hnd)->uuid.node,2) == (uint32)sys_getpid() ? "OURS" : \
     31        ( IVAL((hnd)->uuid.node,2) == (uint32_t)getpid() ? "OURS" : \
    3232                "OTHER")), ((unsigned int)IVAL((hnd)->uuid.node,2)),\
    33                 ((unsigned int)sys_getpid() )
     33                ((unsigned int)getpid() )
    3434
    3535#endif /* _RPC_MISC_H */
  • vendor/current/source3/include/safe_string.h

    r740 r988  
    6363#endif /* !_SPLINT_ */
    6464
    65 #ifdef DEVELOPER
    66 #define SAFE_STRING_FUNCTION_NAME __FUNCTION__
    67 #define SAFE_STRING_LINE __LINE__
    68 #else
    69 #define SAFE_STRING_FUNCTION_NAME ("")
    70 #define SAFE_STRING_LINE (0)
    71 #endif
    72 
    73 /* We need a number of different prototypes for our
    74    non-existant fuctions */
    75 char * __unsafe_string_function_usage_here__(void);
    76 
    77 size_t __unsafe_string_function_usage_here_size_t__(void);
    78 
    79 size_t __unsafe_string_function_usage_here_char__(void);
    80 
    81 #ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS
    82 
    83 /* if the compiler will optimize out function calls, then use this to tell if we are
    84    have the correct types (this works only where sizeof() returns the size of the buffer, not
    85    the size of the pointer). */
    86 
    87 #define CHECK_STRING_SIZE(d, len) (sizeof(d) != (len) && sizeof(d) != sizeof(char *))
    88 
    89 #else /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */
    90 
    91 #endif /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */
    92 
    93 #define safe_strcpy_base(dest, src, base, size) \
    94     safe_strcpy(dest, src, size-PTR_DIFF(dest,base)-1)
    95 
    96 /* String copy functions - macro hell below adds 'type checking' (limited,
    97    but the best we can do in C) and may tag with function name/number to
    98    record the last 'clobber region' on that string */
    99 
    100 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
    101 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
    102 #define nstrcpy(d,s) safe_strcpy((d), (s),sizeof(nstring)-1)
    103 #define unstrcpy(d,s) safe_strcpy((d), (s),sizeof(unstring)-1)
    104 
    105 /* the addition of the DEVELOPER checks in safe_strcpy means we must
    106  * update a lot of code. To make this a little easier here are some
    107  * functions that provide the lengths with less pain */
    108 
    109 /* Inside the _fn variants of these is a call to clobber_region(), -
    110  * which might destroy the stack on a buggy function.  We help the
    111  * debugging process by putting the function and line who last caused
    112  * a clobbering into a static buffer.  If the program crashes at
    113  * address 0xf1f1f1f1 then this function is probably, but not
    114  * necessarily, to blame. */
    115 
    116 /* overmalloc_safe_strcpy: DEPRECATED!  Used when you know the
    117  * destination buffer is longer than maxlength, but you don't know how
    118  * long.  This is not a good situation, because we can't do the normal
    119  * sanity checks. Don't use in new code! */
    120 
    121 #define overmalloc_safe_strcpy(dest,src,maxlength) \
    122         safe_strcpy_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    123                         dest,src,maxlength)
    124 
    125 #define safe_strcpy(dest,src,maxlength) \
    126         safe_strcpy_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    127                         dest,src,maxlength)
    128 
    129 #define safe_strcat(dest,src,maxlength) \
    130         safe_strcat_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    131                         dest,src,maxlength)
    132 
    133 #define push_string_check(dest, src, dest_len, flags) \
    134         push_string_check_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    135                         dest, src, dest_len, flags)
    136 
    137 #define pull_string_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \
    138         pull_string_talloc_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    139                         ctx, base_ptr, smb_flags2, dest, src, src_len, flags)
    140 
    141 #define clistr_push(cli, dest, src, dest_len, flags) \
    142         clistr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    143                         cli, dest, src, dest_len, flags)
    144 
    145 #define clistr_pull(inbuf, dest, src, dest_len, src_len, flags) \
    146         clistr_pull_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    147                         inbuf, dest, src, dest_len, src_len, flags)
    148 
    149 #define clistr_pull_talloc(ctx, base, flags2, pp_dest, src, src_len, flags) \
    150         clistr_pull_talloc_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    151                               ctx, base, flags2, pp_dest, src, src_len, flags)
    152 
    153 #define srvstr_push(base_ptr, smb_flags2, dest, src, dest_len, flags) \
    154         srvstr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    155                         base_ptr, smb_flags2, dest, src, dest_len, flags)
    156 
    157 #define alpha_strcpy(dest,src,other_safe_chars,maxlength) \
    158         alpha_strcpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE, \
    159                         dest,src,other_safe_chars,maxlength)
    160 
    161 #define StrnCpy(dest,src,n) \
    162         StrnCpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE, \
    163                         dest,src,n)
    164 
    165 #ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS
    166 
    167 /* if the compiler will optimize out function calls, then use this to tell if we are
    168    have the correct types (this works only where sizeof() returns the size of the buffer, not
    169    the size of the pointer). */
    170 
    171 #define safe_strcpy_fn2(fn_name, fn_line, d, s, max_len) \
    172     (CHECK_STRING_SIZE(d, max_len+1) \
    173     ? __unsafe_string_function_usage_here__() \
    174     : safe_strcpy_fn(fn_name, fn_line, (d), (s), (max_len)))
    175 
    176 #define safe_strcat_fn2(fn_name, fn_line, d, s, max_len) \
    177     (CHECK_STRING_SIZE(d, max_len+1) \
    178     ? __unsafe_string_function_usage_here__() \
    179     : safe_strcat_fn(fn_name, fn_line, (d), (s), (max_len)))
    180 
    181 #define push_string_check_fn2(fn_name, fn_line, dest, src, dest_len, flags) \
    182     (CHECK_STRING_SIZE(dest, dest_len) \
    183     ? __unsafe_string_function_usage_here_size_t__() \
    184     : push_string_check_fn(fn_name, fn_line, dest, src, dest_len, flags))
    185 
    186 #define pull_string_talloc_fn2(fn_name, fn_line, ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \
    187     pull_string_talloc_fn(fn_name, fn_line, ctx, base_ptr, smb_flags2, dest, src, src_len, flags)
    188 
    189 #define clistr_push_fn2(fn_name, fn_line, cli, dest, src, dest_len, flags) \
    190     (CHECK_STRING_SIZE(dest, dest_len) \
    191     ? __unsafe_string_function_usage_here_size_t__() \
    192     : clistr_push_fn(fn_name, fn_line, cli, dest, src, dest_len, flags))
    193 
    194 #define clistr_pull_fn2(fn_name, fn_line, inbuf, dest, src, dest_len, srclen, flags) \
    195     (CHECK_STRING_SIZE(dest, dest_len) \
    196     ? __unsafe_string_function_usage_here_size_t__() \
    197     : clistr_pull_fn(fn_name, fn_line, inbuf, dest, src, dest_len, srclen, flags))
    198 
    199 #define srvstr_push_fn2(fn_name, fn_line, base_ptr, smb_flags2, dest, src, dest_len, flags) \
    200     (CHECK_STRING_SIZE(dest, dest_len) \
    201     ? __unsafe_string_function_usage_here_size_t__() \
    202     : srvstr_push_fn(fn_name, fn_line, base_ptr, smb_flags2, dest, src, dest_len, flags))
    203 
    204 #else
    205 
    206 #define safe_strcpy_fn2 safe_strcpy_fn
    207 #define safe_strcat_fn2 safe_strcat_fn
    208 #define push_string_check_fn2 push_string_check_fn
    209 #define pull_string_talloc_fn2 pull_string_talloc_fn
    210 #define clistr_push_fn2 clistr_push_fn
    211 #define clistr_pull_fn2 clistr_pull_fn
    212 #define srvstr_push_fn2 srvstr_push_fn
     65#include "../libcli/util/ntstatus.h"
     66#include "lib/util/string_wrappers.h"
    21367
    21468#endif
    215 
    216 #endif
  • vendor/current/source3/include/samba_linux_quota.h

    r414 r988  
    228228#endif
    229229
    230 long quotactl __P((int, const char *, qid_t, caddr_t));
     230long quotactl(int, const char *, qid_t, caddr_t);
    231231
    232232#endif /* _QUOTA_LINUX */
  • vendor/current/source3/include/secrets.h

    r740 r988  
    4040#define SECRETS_DOMAIN_SID    "SECRETS/SID"
    4141#define SECRETS_SAM_SID       "SAM/SID"
     42#define SECRETS_PROTECT_IDS   "SECRETS/PROTECT/IDS"
    4243
    4344/* The domain GUID and server GUID (NOT the same) are also not secret */
     
    5859   (ie. when samba server is member of a domain */
    5960struct machine_acct_pass {
    60         uint8 hash[16];
     61        uint8_t hash[16];
    6162        time_t mod_time;
    6263};
     
    6970
    7071struct afs_key {
    71         uint32 kvno;
     72        uint32_t kvno;
    7273        char key[8];
    7374};
    7475
    7576struct afs_keyfile {
    76         uint32 nkeys;
     77        uint32_t nkeys;
    7778        struct afs_key entry[SECRETS_AFS_MAXKEYS];
    7879};
     
    8283/* The following definitions come from passdb/secrets.c  */
    8384
     85bool secrets_init_path(const char *private_dir);
    8486bool secrets_init(void);
    8587struct db_context *secrets_db_ctx(void);
     
    8890bool secrets_store(const char *key, const void *data, size_t size);
    8991bool secrets_delete(const char *key);
     92
     93/* The following definitions come from passdb/machine_account_secrets.c */
     94bool secrets_mark_domain_protected(const char *domain);
     95bool secrets_clear_domain_protection(const char *domain);
    9096bool secrets_store_domain_sid(const char *domain, const struct dom_sid  *sid);
    9197bool secrets_fetch_domain_sid(const char *domain, struct dom_sid  *sid);
    9298bool secrets_store_domain_guid(const char *domain, struct GUID *guid);
    9399bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid);
    94 void *secrets_get_trust_account_lock(TALLOC_CTX *mem_ctx, const char *domain);
    95100enum netr_SchannelType get_default_sec_channel(void);
    96101bool secrets_fetch_trust_account_password_legacy(const char *domain,
    97                                                  uint8 ret_pwd[16],
     102                                                 uint8_t ret_pwd[16],
    98103                                                 time_t *pass_last_set_time,
    99104                                                 enum netr_SchannelType *channel);
    100 bool secrets_fetch_trust_account_password(const char *domain, uint8 ret_pwd[16],
     105bool secrets_fetch_trust_account_password(const char *domain, uint8_t ret_pwd[16],
    101106                                          time_t *pass_last_set_time,
    102107                                          enum netr_SchannelType *channel);
     
    105110bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
    106111                                           const struct dom_sid  *sid);
    107 bool secrets_delete_machine_password(const char *domain);
    108112bool secrets_delete_machine_password_ex(const char *domain);
    109113bool secrets_delete_domain_sid(const char *domain);
    110114bool secrets_store_machine_password(const char *pass, const char *domain, enum netr_SchannelType sec_channel);
    111115char *secrets_fetch_prev_machine_password(const char *domain);
     116time_t secrets_fetch_pass_last_set_time(const char *domain);
    112117char *secrets_fetch_machine_password(const char *domain,
    113118                                     time_t *pass_last_set_time,
     
    116121bool secrets_store_ldap_pw(const char* dn, char* pw);
    117122bool fetch_ldap_pw(char **dn, char** pw);
    118 struct trustdom_info;
    119 NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
    120                                  struct trustdom_info ***domains);
    121123bool secrets_store_afs_keyfile(const char *cell, const struct afs_keyfile *keyfile);
    122124bool secrets_fetch_afs_key(const char *cell, struct afs_key *result);
     
    124126bool secrets_store_generic(const char *owner, const char *key, const char *secret);
    125127char *secrets_fetch_generic(const char *owner, const char *key);
    126 bool secrets_delete_generic(const char *owner, const char *key);
     128
     129bool secrets_store_machine_pw_sync(const char *pass, const char *oldpass, const char *domain,
     130                                   const char *realm,
     131                                   const char *salting_principal, uint32_t supported_enc_types,
     132                                   const struct dom_sid *domain_sid, uint32_t last_change_time,
     133                                   uint32_t secure_channel,
     134                                   bool delete_join);
     135
     136/* The following definitions come from passdb/secrets_lsa.c  */
     137NTSTATUS lsa_secret_get(TALLOC_CTX *mem_ctx,
     138                        const char *secret_name,
     139                        DATA_BLOB *secret_current,
     140                        NTTIME *secret_current_lastchange,
     141                        DATA_BLOB *secret_old,
     142                        NTTIME *secret_old_lastchange,
     143                        struct security_descriptor **sd);
     144NTSTATUS lsa_secret_set(const char *secret_name,
     145                        DATA_BLOB *secret_current,
     146                        DATA_BLOB *secret_old,
     147                        struct security_descriptor *sd);
     148NTSTATUS lsa_secret_delete(const char *secret_name);
    127149
    128150#endif /* _SECRETS_H */
  • vendor/current/source3/include/serverid.h

    r860 r988  
    2121#define __SERVERID_H__
    2222
    23 #include "includes.h"
    24 
    25 /** Don't verify this unique id */
    26 #define SERVERID_UNIQUE_ID_NOT_TO_VERIFY 0xFFFFFFFFFFFFFFFFULL
     23#include "replace.h"
     24#include "lib/dbwrap/dbwrap.h"
    2725
    2826/*
     
    3533 */
    3634bool serverid_deregister(const struct server_id id);
    37 
    38 /*
    39  * (De)register additional message flags
    40  */
    41 bool serverid_register_msg_flags(const struct server_id id, bool do_reg,
    42                                  uint32_t msg_flags);
    4335
    4436/*
     
    6860bool serverid_parent_init(TALLOC_CTX *mem_ctx);
    6961
    70 /*
    71  * Get a random unique_id and make sure that it is not
    72  * SERVERID_UNIQUE_ID_NOT_TO_VERIFY
    73  */
    74 uint64_t serverid_get_random_unique_id(void);
    75 
    76 bool serverid_init_readonly(TALLOC_CTX *mem_ctx);
    77 
    7862#endif
  • vendor/current/source3/include/session.h

    r414 r988  
    3535        fstring remote_machine;
    3636        fstring id_str;
    37         uint32  id_num;
     37        uint32_t id_num;
    3838        struct server_id pid;
    3939        fstring ip_addr_str;
    4040        time_t connect_start;
     41        uint16_t connection_dialect;
     42        uint8_t encryption_flags;
     43        uint16_t cipher;
     44        uint8_t signing_flags;
    4145};
    4246
  • vendor/current/source3/include/smb.h

    r919 r988  
    2727#define _SMB_H
    2828
     29#include "libcli/smb/smb_common.h"
     30#include "libds/common/roles.h"
     31
    2932/* logged when starting the various Samba daemons */
    30 #define COPYRIGHT_STARTUP_MESSAGE       "Copyright Andrew Tridgell and the Samba Team 1992-2011"
    31 
    32 
    33 #if defined(LARGE_SMB_OFF_T)
    34 #define BUFFER_SIZE (128*1024)
    35 #else /* no large readwrite possible */
    36 #define BUFFER_SIZE (0xFFFF)
    37 #endif
     33#define COPYRIGHT_STARTUP_MESSAGE       "Copyright Andrew Tridgell and the Samba Team 1992-2016"
    3834
    3935#define SAFETY_MARGIN 1024
    4036#define LARGE_WRITEX_HDR_SIZE 65
     37#define LARGE_WRITEX_BUFFER_SIZE (128*1024)
    4138
    4239#define NMB_PORT 137
    4340#define DGRAM_PORT 138
    44 #define SMB_PORT1 445
    45 #define SMB_PORT2 139
     41#define NBT_SMB_PORT  139   /* Port for SMB over NBT transport (IETF STD#19). */
     42#define TCP_SMB_PORT  445   /* Port for SMB over naked TCP transport.         */
    4643#define SMB_PORTS "445 139"
    4744
     
    6865/* how long to wait for secondary SMB packets (milli-seconds) */
    6966#define SMB_SECONDARY_WAIT (60*1000)
    70 
    71 /* this defines the error codes that receive_smb can put in smb_read_error */
    72 enum smb_read_errors {
    73         SMB_READ_OK = 0,
    74         SMB_READ_TIMEOUT,
    75         SMB_READ_EOF,
    76         SMB_READ_ERROR,
    77         SMB_WRITE_ERROR, /* This error code can go into the client smb_rw_error. */
    78         SMB_READ_BAD_SIG,
    79         SMB_NO_MEMORY,
    80         SMB_DO_NOT_DO_TDIS, /* cli_close_connection() check for this when smbfs wants to keep tree connected */
    81         SMB_READ_BAD_DECRYPT
    82 };
    8367
    8468#define DIR_STRUCT_SIZE 43
     
    127111#define OPENX_FILE_FAIL_IF_NOT_EXIST 0
    128112
    129 typedef union unid_t {
    130         uid_t uid;
    131         gid_t gid;
    132 } unid_t;
    133 
    134113/* pipe string names */
    135114
     
    141120
    142121#include "librpc/gen_ndr/security.h"
    143 
    144 /*
    145  * The complete list of SIDS belonging to this user.
    146  * Created when a vuid is registered.
    147  * The definition of the user_sids array is as follows :
    148  *
    149  * token->user_sids[0] = primary user SID.
    150  * token->user_sids[1] = primary group SID.
    151  * token->user_sids[2..num_sids] = supplementary group SIDS.
    152  */
    153 
    154 #define PRIMARY_USER_SID_INDEX 0
    155 #define PRIMARY_GROUP_SID_INDEX 1
    156 
    157 typedef struct write_cache {
    158         SMB_OFF_T file_size;
    159         SMB_OFF_T offset;
    160         size_t alloc_size;
    161         size_t data_size;
    162         char *data;
    163 } write_cache;
    164 
    165 struct fd_handle {
    166         size_t ref_count;
    167         int fd;
    168         uint64_t position_information;
    169         SMB_OFF_T pos;
    170         uint32 private_options; /* NT Create options, but we only look at
    171                                  * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
    172                                  * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB and
    173                                  * NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE
    174                                  * for print files *only*, where
    175                                  * DELETE_ON_CLOSE is not stored in the share
    176                                  * mode database.
    177                                  */
    178         unsigned long gen_id;
    179 };
    180122
    181123struct idle_event;
     
    187129struct fncall_context;
    188130
    189 struct vfs_fsp_data {
    190     struct vfs_fsp_data *next;
    191     struct vfs_handle_struct *owner;
    192     void (*destroy)(void *p_data);
    193     void *_dummy_;
    194     /* NOTE: This structure contains four pointers so that we can guarantee
    195      * that the end of the structure is always both 4-byte and 8-byte aligned.
    196      */
    197 };
    198 
    199131/* the basic packet size, assuming no words or bytes */
    200132#define smb_size 39
     
    206138
    207139struct notify_mid_map;
    208 struct notify_entry;
     140struct notify_db_entry;
    209141struct notify_event;
    210142struct notify_change_request;
    211143struct sys_notify_backend;
    212144struct sys_notify_context {
    213         struct event_context *ev;
    214         struct connection_struct *conn;
     145        struct tevent_context *ev;
    215146        void *private_data;     /* For use by the system backend */
    216147};
    217 
    218 struct notify_change_buf {
    219         /*
    220          * If no requests are pending, changes are queued here. Simple array,
    221          * we only append.
    222          */
    223 
    224         /*
    225          * num_changes == -1 means that we have got a catch-all change, when
    226          * asked we just return NT_STATUS_OK without specific changes.
    227          */
    228         int num_changes;
    229         struct notify_change *changes;
    230 
    231         /*
    232          * If no changes are around requests are queued here. Using a linked
    233          * list, because we have to append at the end and delete from the top.
    234          */
    235         struct notify_change_request *requests;
    236 };
    237 
    238 struct print_file_data {
    239         char *svcname;
    240         char *docname;
    241         char *filename;
    242         struct policy_handle handle;
    243         uint32_t jobid;
    244         uint16 rap_jobid;
    245 };
    246 
    247 typedef struct files_struct {
    248         struct files_struct *next, *prev;
    249         int fnum;
    250         struct connection_struct *conn;
    251         struct fd_handle *fh;
    252         unsigned int num_smb_operations;
    253         struct file_id file_id;
    254         uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */
    255         mode_t mode;
    256         uint16 file_pid;
    257         uint16 vuid;
    258         write_cache *wcp;
    259         struct timeval open_time;
    260         uint32 access_mask;             /* NTCreateX access bits (FILE_READ_DATA etc.) */
    261         uint32 share_access;            /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
    262 
    263         bool update_write_time_triggered;
    264         struct timed_event *update_write_time_event;
    265         bool update_write_time_on_close;
    266         struct timespec close_write_time;
    267         bool write_time_forced;
    268 
    269         int oplock_type;
    270         int sent_oplock_break;
    271         struct timed_event *oplock_timeout;
    272         struct lock_struct last_lock_failure;
    273         int current_lock_count; /* Count the number of outstanding locks and pending locks. */
    274 
    275         struct share_mode_entry *pending_break_messages;
    276         int num_pending_break_messages;
    277 
    278         bool can_lock;
    279         bool can_read;
    280         bool can_write;
    281         bool modified;
    282         bool is_directory;
    283         bool aio_write_behind;
    284         bool lockdb_clean;
    285         bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */
    286         bool delete_on_close;
    287         bool posix_open;
    288         bool is_sparse;
    289         struct smb_filename *fsp_name;
    290         uint32_t name_hash;             /* Jenkins hash of full pathname. */
    291 
    292         struct vfs_fsp_data *vfs_extension;
    293         struct fake_file_handle *fake_file_handle;
    294 
    295         struct notify_change_buf *notify;
    296 
    297         struct files_struct *base_fsp; /* placeholder for delete on close */
    298 
    299         /*
    300          * Read-only cached brlock record, thrown away when the
    301          * brlock.tdb seqnum changes. This avoids fetching data from
    302          * the brlock.tdb on every read/write call.
    303          */
    304         int brlock_seqnum;
    305         struct byte_range_lock *brlock_rec;
    306 
    307         struct dptr_struct *dptr;
    308 
    309         /* if not NULL, means this is a print file */
    310         struct print_file_data *print_file;
    311 
    312 } files_struct;
    313148
    314149#include "ntquotas.h"
    315150#include "sysquotas.h"
    316151
    317 struct client_address {
    318         char addr[INET6_ADDRSTRLEN];
    319         const char *name;
    320 };
    321 
    322 struct vuid_cache_entry {
    323         struct auth_serversupplied_info *session_info;
    324         uint16_t vuid;
    325         bool read_only;
    326 };
    327 
    328 struct vuid_cache {
    329         unsigned int next_entry;
    330         struct vuid_cache_entry array[VUID_CACHE_SIZE];
    331 };
    332 
    333 typedef struct {
    334         char *name;
    335         bool is_wild;
    336 } name_compare_entry;
    337 
    338 struct trans_state {
    339         struct trans_state *next, *prev;
    340         uint16 vuid;
    341         uint64_t mid;
    342 
    343         uint32 max_param_return;
    344         uint32 max_data_return;
    345         uint32 max_setup_return;
    346 
    347         uint8 cmd;              /* SMBtrans or SMBtrans2 */
    348 
    349         char *name;             /* for trans requests */
    350         uint16 call;            /* for trans2 and nttrans requests */
    351 
    352         bool close_on_completion;
    353         bool one_way;
    354 
    355         unsigned int setup_count;
    356         uint16 *setup;
    357 
    358         size_t received_data;
    359         size_t received_param;
    360 
    361         size_t total_param;
    362         char *param;
    363 
    364         size_t total_data;
    365         char *data;
    366 };
    367 
    368 /*
    369  * Info about an alternate data stream
    370  */
    371 
    372 struct stream_struct {
    373         SMB_OFF_T size;
    374         SMB_OFF_T alloc_size;
    375         char *name;
    376 };
    377 
    378152/* Include VFS stuff */
    379153
    380154#include "smb_acls.h"
     155#include "lib/readdir_attr.h"
    381156#include "vfs.h"
    382157
    383 struct dfree_cached_info {
    384         time_t last_dfree_time;
    385         uint64_t dfree_ret;
    386         uint64_t bsize;
    387         uint64_t dfree;
    388         uint64_t dsize;
    389 };
    390 
    391 struct dptr_struct;
    392 
    393 struct share_params {
    394         int service;
    395 };
    396 
    397 struct share_iterator {
    398         int next_id;
    399 };
    400 
    401 typedef struct connection_struct {
    402         struct connection_struct *next, *prev;
    403         struct smbd_server_connection *sconn; /* can be NULL */
    404         unsigned cnum; /* an index passed over the wire */
    405         struct share_params *params;
    406         bool force_user;
    407         struct vuid_cache vuid_cache;
    408         bool printer;
    409         bool ipc;
    410         bool read_only; /* Attributes for the current user of the share. */
    411         uint32_t share_access;
    412         /* Does this filesystem honor
    413            sub second timestamps on files
    414            and directories when setting time ? */
    415         enum timestamp_set_resolution ts_res;
    416         char *connectpath;
    417         char *origpath;
    418 
    419         struct vfs_handle_struct *vfs_handles;          /* for the new plugins */
    420 
    421         /*
    422          * This represents the user information on this connection. Depending
    423          * on the vuid using this tid, this might change per SMB request.
    424          */
    425         struct auth_serversupplied_info *session_info;
    426 
    427         /*
    428          * If the "force group" parameter is set, this is the primary gid that
    429          * may be used in the users token, depending on the vuid using this tid.
    430          */
    431         gid_t force_group_gid;
    432 
    433         uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
    434 
    435         time_t lastused;
    436         time_t lastused_count;
    437         bool used;
    438         int num_files_open;
    439         unsigned int num_smb_operations; /* Count of smb operations on this tree. */
    440         int encrypt_level;
    441         bool encrypted_tid;
    442 
    443         /* Semantics requested by the client or forced by the server config. */
    444         bool case_sensitive;
    445         bool case_preserve;
    446         bool short_case_preserve;
    447 
    448         /* Semantics provided by the underlying filesystem. */
    449         int fs_capabilities;
    450         /* Device number of the directory of the share mount.
    451            Used to ensure unique FileIndex returns. */
    452         SMB_DEV_T base_share_dev;
    453 
    454         name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
    455         name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
    456         name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */       
    457         name_compare_entry *aio_write_behind_list; /* Per-share list of files to use aio write behind on. */       
    458         struct dfree_cached_info *dfree_info;
    459         struct trans_state *pending_trans;
    460         struct notify_context *notify_ctx;
    461 
    462         struct rpc_pipe_client *spoolss_pipe;
    463 
    464 } connection_struct;
    465 
    466158struct current_user {
    467         connection_struct *conn;
    468         uint16 vuid;
     159        struct connection_struct *conn;
     160        uint64_t vuid; /* SMB2 compat */
    469161        struct security_unix_token ut;
    470162        struct security_token *nt_user_token;
    471 };
    472 
    473 struct smbd_smb2_request;
    474 
    475 struct smb_request {
    476         uint8_t cmd;
    477         uint16 flags2;
    478         uint16 smbpid;
    479         uint64_t mid; /* For compatibility with SMB2. */
    480         uint32_t seqnum;
    481         uint16 vuid;
    482         uint16 tid;
    483         uint8  wct;
    484         uint16_t *vwv;
    485         uint16_t buflen;
    486         const uint8_t *buf;
    487         const uint8 *inbuf;
    488 
    489         /*
    490          * Async handling in the main smb processing loop is directed by
    491          * outbuf: reply_xxx routines indicate sync behaviour by putting their
    492          * reply into "outbuf". If they leave it as NULL, they take of it
    493          * themselves, possibly later.
    494          *
    495          * If async handling is wanted, the reply_xxx routine must make sure
    496          * that it talloc_move()s the smb_req somewhere else.
    497          */
    498         uint8 *outbuf;
    499 
    500         size_t unread_bytes;
    501         bool encrypted;
    502         connection_struct *conn;
    503         struct smbd_server_connection *sconn;
    504         struct smb_perfcount_data pcd;
    505 
    506         /*
    507          * Chained request handling
    508          */
    509         struct files_struct *chain_fsp;
    510 
    511         /*
    512          * Here we collect the outbufs from the chain handlers
    513          */
    514         uint8_t *chain_outbuf;
    515 
    516         /*
    517          * state information for async smb handling
    518          */
    519         void *async_priv;
    520 
    521         bool done;
    522 
    523         /*
    524          * Back pointer to smb2 request.
    525          */
    526         struct smbd_smb2_request *smb2req;
    527163};
    528164
     
    537173        fstring domain; /* domain that the client specified */
    538174} userdom_struct;
    539 
    540 /* used for server information: client, nameserv and ipc */
    541 struct server_info_struct {
    542         fstring name;
    543         uint32 type;
    544         fstring comment;
    545         fstring domain; /* used ONLY in ipc.c NOT namework.c */
    546         bool server_added; /* used ONLY in ipc.c NOT namework.c */
    547 };
    548175
    549176/* used for network interfaces */
     
    555182        struct sockaddr_storage netmask;
    556183        struct sockaddr_storage bcast;
    557 };
    558 
    559 /* Internal message queue for deferred opens. */
    560 struct pending_message_list {
    561         struct pending_message_list *next, *prev;
    562         struct timeval request_time; /* When was this first issued? */
    563         struct timed_event *te;
    564         struct smb_perfcount_data pcd;
    565         uint32_t seqnum;
    566         bool encrypted;
    567         bool processed;
    568         DATA_BLOB buf;
    569         DATA_BLOB private_data;
     184        uint32_t if_index;
     185        uint64_t linkspeed;
     186        uint32_t capability;
    570187};
    571188
     
    573190
    574191#include "librpc/gen_ndr/server_id.h"
    575 
    576 /* struct returned by get_share_modes */
    577 struct share_mode_entry {
    578         struct server_id pid;
    579         uint64_t op_mid;        /* For compatibility with SMB2 opens. */
    580         uint16 op_type;
    581         uint32 access_mask;             /* NTCreateX access bits (FILE_READ_DATA etc.) */
    582         uint32 share_access;            /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
    583         uint32 private_options; /* NT Create options, but we only look at
    584                                  * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
    585                                  * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB for
    586                                  * smbstatus and swat */
    587         struct timeval time;
    588         struct file_id id;
    589         unsigned long share_file_id;
    590         uint32 uid;             /* uid of file opener. */
    591         uint16 flags;           /* See SHARE_MODE_XX above. */
    592         uint32_t name_hash;             /* Jenkins hash of full pathname. */
    593 };
    594192
    595193/* oplock break message definition - linearization of share_mode_entry.
     
    597195Offset  Data                    length.
    5981960       struct server_id pid    4
    599 4       uint16 op_mid           8
    600 12      uint16 op_type          2
    601 14      uint32 access_mask      4
    602 18      uint32 share_access     4
    603 22      uint32 private_options  4
    604 26      uint32 time sec         4
    605 30      uint32 time usec        4
    606 34      uint64 dev              8 bytes
    607 42      uint64 inode            8 bytes
    608 50      uint64 extid            8 bytes
     1974       uint16_t op_mid         8
     19812      uint16_t op_type        2
     19914      uint32_t access_mask    4
     20018      uint32_t share_access   4
     20122      uint32_t private_options        4
     20226      uint32_t time sec               4
     20330      uint32_t time usec      4
     20434      uint64_t dev            8 bytes
     20542      uint64_t inode          8 bytes
     20650      uint64_t extid          8 bytes
    60920758      unsigned long file_id   4 bytes
    610 62      uint32 uid              4 bytes
    611 66      uint16 flags            2 bytes
    612 68      uint32 name_hash        4 bytes
     20862      uint32_t uid            4 bytes
     20966      uint16_t flags          2 bytes
     21068      uint32_t name_hash      4 bytes
    61321172
    614212
     
    634232#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 76
    635233
    636 struct delete_token_list {
    637         struct delete_token_list *next, *prev;
    638         uint32_t name_hash;
    639         struct security_unix_token *delete_token;
    640         struct security_token *delete_nt_token;
    641 };
    642 
    643 struct share_mode_lock {
    644         const char *servicepath; /* canonicalized. */
    645         const char *base_name;
    646         const char *stream_name;
    647         struct file_id id;
    648         int num_share_modes;
    649         struct share_mode_entry *share_modes;
    650         struct delete_token_list *delete_tokens;
    651         struct timespec old_write_time;
    652         struct timespec changed_write_time;
    653         bool fresh;
    654         bool modified;
    655         struct db_record *record;
    656 };
    657 
    658 /*
    659  * Internal structure of locking.tdb share mode db.
    660  * Used by locking.c and libsmbsharemodes.c
    661  */
    662 
    663 struct locking_data {
    664         union {
    665                 struct {
    666                         int num_share_mode_entries;
    667                         struct timespec old_write_time;
    668                         struct timespec changed_write_time;
    669                         uint32 num_delete_token_entries;
    670                 } s;
    671                 struct share_mode_entry dummy; /* Needed for alignment. */
    672         } u;
    673         /* The following four entries are implicit
    674 
    675            (1) struct share_mode_entry modes[num_share_mode_entries];
    676 
    677            (2) A num_delete_token_entries of structs {
    678                 uint32_t len_delete_token;
    679                 char unix_token[len_delete_token] (divisible by 4).
    680            };
    681 
    682            (3) char share_name[];
    683            (4) char file_name[];
    684         */
    685 };
    686 
    687234#define NT_HASH_LEN 16
    688235#define LM_HASH_LEN 16
    689236
    690 /* key and data in the connections database - used in smbstatus and smbd */
    691 struct connections_key {
    692         struct server_id pid;
    693         int cnum;
    694         fstring name;
    695 };
    696 
    697 struct connections_data {
    698         int magic;
    699         struct server_id pid;
    700         int cnum;
    701         uid_t uid;
    702         gid_t gid;
    703         char servicename[FSTRING_LEN];
    704         char addr[24];
    705         char machine[FSTRING_LEN];
    706         time_t start;
    707 
    708         /*
    709          * This field used to hold the msg_flags. For compatibility reasons,
    710          * keep the data structure in the tdb file the same.
    711          */
    712         uint32 unused_compatitibility_field;
    713 };
    714 
    715 /* the following are used by loadparm for option lists */
    716 typedef enum {
    717         P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
    718         P_STRING,P_USTRING,P_ENUM,P_SEP
    719 } parm_type;
    720 
    721 typedef enum {
    722         P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE
    723 } parm_class;
    724 
    725 struct enum_list {
    726         int value;
    727         const char *name;
    728 };
    729 
    730 struct parm_struct {
    731         const char *label;
    732         parm_type type;
    733         parm_class p_class;
    734         void *ptr;
    735         bool (*special)(int snum, const char *, char **);
    736         const struct enum_list *enum_list;
    737         unsigned flags;
    738         union {
    739                 bool bvalue;
    740                 int ivalue;
    741                 char *svalue;
    742                 char cvalue;
    743                 char **lvalue;
    744         } def;
    745 };
    746 
    747 /* The following flags are used in SWAT */
    748 #define FLAG_BASIC      0x0001 /* Display only in BASIC view */
    749 #define FLAG_SHARE      0x0002 /* file sharing options */
    750 #define FLAG_PRINT      0x0004 /* printing options */
    751 #define FLAG_GLOBAL     0x0008 /* local options that should be globally settable in SWAT */
    752 #define FLAG_WIZARD     0x0010 /* Parameters that the wizard will operate on */
    753 #define FLAG_ADVANCED   0x0020 /* Parameters that will be visible in advanced view */
    754 #define FLAG_DEVELOPER  0x0040 /* No longer used */
    755 #define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
    756 #define FLAG_HIDE       0x2000 /* options that should be hidden in SWAT */
    757 #define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */
    758 #define FLAG_META       0x8000 /* A meta directive - not a real parameter */
    759 #define FLAG_CMDLINE    0x10000 /* option has been overridden */
    760 
    761237/* offsets into message for common items */
    762 #define smb_com 8
    763 #define smb_rcls 9
    764 #define smb_reh 10
    765 #define smb_err 11
    766 #define smb_flg 13
    767 #define smb_flg2 14
    768 #define smb_pidhigh 16
    769 #define smb_ss_field 18
    770 #define smb_tid 28
    771 #define smb_pid 30
    772 #define smb_uid 32
    773 #define smb_mid 34
    774 #define smb_wct 36
    775 #define smb_vwv 37
    776 #define smb_vwv0 37
    777 #define smb_vwv1 39
    778 #define smb_vwv2 41
    779 #define smb_vwv3 43
    780 #define smb_vwv4 45
    781 #define smb_vwv5 47
    782 #define smb_vwv6 49
    783 #define smb_vwv7 51
    784 #define smb_vwv8 53
    785 #define smb_vwv9 55
    786 #define smb_vwv10 57
    787 #define smb_vwv11 59
    788 #define smb_vwv12 61
    789 #define smb_vwv13 63
    790 #define smb_vwv14 65
    791 #define smb_vwv15 67
    792 #define smb_vwv16 69
    793 #define smb_vwv17 71
    794 
    795 /* flag defines. CIFS spec 3.1.1 */
    796 #define FLAG_SUPPORT_LOCKREAD       0x01
    797 #define FLAG_CLIENT_BUF_AVAIL       0x02
    798 #define FLAG_RESERVED               0x04
    799 #define FLAG_CASELESS_PATHNAMES     0x08
    800 #define FLAG_CANONICAL_PATHNAMES    0x10
    801 #define FLAG_REQUEST_OPLOCK         0x20
    802 #define FLAG_REQUEST_BATCH_OPLOCK   0x40
    803 #define FLAG_REPLY                  0x80
    804 
    805 /* the complete */
    806 #define SMBmkdir      0x00   /* create directory */
    807 #define SMBrmdir      0x01   /* delete directory */
    808 #define SMBopen       0x02   /* open file */
    809 #define SMBcreate     0x03   /* create file */
    810 #define SMBclose      0x04   /* close file */
    811 #define SMBflush      0x05   /* flush file */
    812 #define SMBunlink     0x06   /* delete file */
    813 #define SMBmv         0x07   /* rename file */
    814 #define SMBgetatr     0x08   /* get file attributes */
    815 #define SMBsetatr     0x09   /* set file attributes */
    816 #define SMBread       0x0A   /* read from file */
    817 #define SMBwrite      0x0B   /* write to file */
    818 #define SMBlock       0x0C   /* lock byte range */
    819 #define SMBunlock     0x0D   /* unlock byte range */
    820 #define SMBctemp      0x0E   /* create temporary file */
    821 #define SMBmknew      0x0F   /* make new file */
    822 #define SMBcheckpath  0x10   /* check directory path */
    823 #define SMBexit       0x11   /* process exit */
    824 #define SMBlseek      0x12   /* seek */
    825 #define SMBtcon       0x70   /* tree connect */
    826 #define SMBtconX      0x75   /* tree connect and X*/
    827 #define SMBtdis       0x71   /* tree disconnect */
    828 #define SMBnegprot    0x72   /* negotiate protocol */
    829 #define SMBdskattr    0x80   /* get disk attributes */
    830 #define SMBsearch     0x81   /* search directory */
    831 #define SMBsplopen    0xC0   /* open print spool file */
    832 #define SMBsplwr      0xC1   /* write to print spool file */
    833 #define SMBsplclose   0xC2   /* close print spool file */
    834 #define SMBsplretq    0xC3   /* return print queue */
    835 #define SMBsends      0xD0   /* send single block message */
    836 #define SMBsendb      0xD1   /* send broadcast message */
    837 #define SMBfwdname    0xD2   /* forward user name */
    838 #define SMBcancelf    0xD3   /* cancel forward */
    839 #define SMBgetmac     0xD4   /* get machine name */
    840 #define SMBsendstrt   0xD5   /* send start of multi-block message */
    841 #define SMBsendend    0xD6   /* send end of multi-block message */
    842 #define SMBsendtxt    0xD7   /* send text of multi-block message */
    843 
    844 /* Core+ protocol */
    845 #define SMBlockread       0x13   /* Lock a range and read */
    846 #define SMBwriteunlock 0x14 /* Unlock a range then write */
    847 #define SMBreadbraw   0x1a  /* read a block of data with no smb header */
    848 #define SMBwritebraw  0x1d  /* write a block of data with no smb header */
    849 #define SMBwritec     0x20  /* secondary write request */
    850 #define SMBwriteclose 0x2c  /* write a file then close it */
    851 
    852 /* dos extended protocol */
    853 #define SMBreadBraw      0x1A   /* read block raw */
    854 #define SMBreadBmpx      0x1B   /* read block multiplexed */
    855 #define SMBreadBs        0x1C   /* read block (secondary response) */
    856 #define SMBwriteBraw     0x1D   /* write block raw */
    857 #define SMBwriteBmpx     0x1E   /* write block multiplexed */
    858 #define SMBwriteBs       0x1F   /* write block (secondary request) */
    859 #define SMBwriteC        0x20   /* write complete response */
    860 #define SMBsetattrE      0x22   /* set file attributes expanded */
    861 #define SMBgetattrE      0x23   /* get file attributes expanded */
    862 #define SMBlockingX      0x24   /* lock/unlock byte ranges and X */
    863 #define SMBtrans         0x25   /* transaction - name, bytes in/out */
    864 #define SMBtranss        0x26   /* transaction (secondary request/response) */
    865 #define SMBioctl         0x27   /* IOCTL */
    866 #define SMBioctls        0x28   /* IOCTL  (secondary request/response) */
    867 #define SMBcopy          0x29   /* copy */
    868 #define SMBmove          0x2A   /* move */
    869 #define SMBecho          0x2B   /* echo */
    870 #define SMBopenX         0x2D   /* open and X */
    871 #define SMBreadX         0x2E   /* read and X */
    872 #define SMBwriteX        0x2F   /* write and X */
    873 #define SMBsesssetupX    0x73   /* Session Set Up & X (including User Logon) */
    874 #define SMBffirst        0x82   /* find first */
    875 #define SMBfunique       0x83   /* find unique */
    876 #define SMBfclose        0x84   /* find close */
    877 #define SMBkeepalive     0x85   /* keepalive */
    878 #define SMBinvalid       0xFE   /* invalid command */
    879 
    880 /* Extended 2.0 protocol */
    881 #define SMBtrans2        0x32   /* TRANS2 protocol set */
    882 #define SMBtranss2       0x33   /* TRANS2 protocol set, secondary command */
    883 #define SMBfindclose     0x34   /* Terminate a TRANSACT2_FINDFIRST */
    884 #define SMBfindnclose    0x35   /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
    885 #define SMBulogoffX      0x74   /* user logoff */
    886 
    887 /* NT SMB extensions. */
    888 #define SMBnttrans       0xA0   /* NT transact */
    889 #define SMBnttranss      0xA1   /* NT transact secondary */
    890 #define SMBntcreateX     0xA2   /* NT create and X */
    891 #define SMBntcancel      0xA4   /* NT cancel */
    892 #define SMBntrename      0xA5   /* NT rename */
    893 
    894 /* These are the trans subcommands */
    895 #define TRANSACT_SETNAMEDPIPEHANDLESTATE  0x01
    896 #define TRANSACT_DCERPCCMD                0x26
    897 #define TRANSACT_WAITNAMEDPIPEHANDLESTATE 0x53
    898 
    899 /* These are the TRANS2 sub commands */
    900 #define TRANSACT2_OPEN                          0x00
    901 #define TRANSACT2_FINDFIRST                     0x01
    902 #define TRANSACT2_FINDNEXT                      0x02
    903 #define TRANSACT2_QFSINFO                       0x03
    904 #define TRANSACT2_SETFSINFO                     0x04
    905 #define TRANSACT2_QPATHINFO                     0x05
    906 #define TRANSACT2_SETPATHINFO                   0x06
    907 #define TRANSACT2_QFILEINFO                     0x07
    908 #define TRANSACT2_SETFILEINFO                   0x08
    909 #define TRANSACT2_FSCTL                         0x09
    910 #define TRANSACT2_IOCTL                         0x0A
    911 #define TRANSACT2_FINDNOTIFYFIRST               0x0B
    912 #define TRANSACT2_FINDNOTIFYNEXT                0x0C
    913 #define TRANSACT2_MKDIR                         0x0D
    914 #define TRANSACT2_SESSION_SETUP                 0x0E
    915 #define TRANSACT2_GET_DFS_REFERRAL              0x10
    916 #define TRANSACT2_REPORT_DFS_INCONSISTANCY      0x11
    917 
    918 /* These are the NT transact sub commands. */
    919 #define NT_TRANSACT_CREATE                1
    920 #define NT_TRANSACT_IOCTL                 2
    921 #define NT_TRANSACT_SET_SECURITY_DESC     3
    922 #define NT_TRANSACT_NOTIFY_CHANGE         4
    923 #define NT_TRANSACT_RENAME                5
    924 #define NT_TRANSACT_QUERY_SECURITY_DESC   6
    925 #define NT_TRANSACT_GET_USER_QUOTA        7
    926 #define NT_TRANSACT_SET_USER_QUOTA        8
     238#define smb_com         (NBT_HDR_SIZE+HDR_COM)
     239#define smb_rcls        (NBT_HDR_SIZE+HDR_RCLS)
     240#define smb_reh         (NBT_HDR_SIZE+HDR_REH)
     241#define smb_err         (NBT_HDR_SIZE+HDR_ERR)
     242#define smb_flg         (NBT_HDR_SIZE+HDR_FLG)
     243#define smb_flg2        (NBT_HDR_SIZE+HDR_FLG2)
     244#define smb_pidhigh     (NBT_HDR_SIZE+HDR_PIDHIGH)
     245#define smb_ss_field    (NBT_HDR_SIZE+HDR_SS_FIELD)
     246#define smb_tid         (NBT_HDR_SIZE+HDR_TID)
     247#define smb_pid         (NBT_HDR_SIZE+HDR_PID)
     248#define smb_uid         (NBT_HDR_SIZE+HDR_UID)
     249#define smb_mid         (NBT_HDR_SIZE+HDR_MID)
     250#define smb_wct         (NBT_HDR_SIZE+HDR_WCT)
     251#define smb_vwv         (NBT_HDR_SIZE+HDR_VWV)
     252#define smb_vwv0        (smb_vwv+( 0*2))
     253#define smb_vwv1        (smb_vwv+( 1*2))
     254#define smb_vwv2        (smb_vwv+( 2*2))
     255#define smb_vwv3        (smb_vwv+( 3*2))
     256#define smb_vwv4        (smb_vwv+( 4*2))
     257#define smb_vwv5        (smb_vwv+( 5*2))
     258#define smb_vwv6        (smb_vwv+( 6*2))
     259#define smb_vwv7        (smb_vwv+( 7*2))
     260#define smb_vwv8        (smb_vwv+( 8*2))
     261#define smb_vwv9        (smb_vwv+( 9*2))
     262#define smb_vwv10       (smb_vwv+(10*2))
     263#define smb_vwv11       (smb_vwv+(11*2))
     264#define smb_vwv12       (smb_vwv+(12*2))
     265#define smb_vwv13       (smb_vwv+(13*2))
     266#define smb_vwv14       (smb_vwv+(14*2))
     267#define smb_vwv15       (smb_vwv+(15*2))
     268#define smb_vwv16       (smb_vwv+(16*2))
     269#define smb_vwv17       (smb_vwv+(17*2))
    927270
    928271/* These are the NT transact_get_user_quota sub commands */
     
    1019362#define smb_ntcreate_SecurityFlags (smb_vwv0 + 47)
    1020363
    1021 /* this is used on a TConX. I'm not sure the name is very helpful though */
    1022 #define SMB_SUPPORT_SEARCH_BITS        0x0001
    1023 #define SMB_SHARE_IN_DFS               0x0002
    1024 
    1025364/* Named pipe write mode flags. Used in writeX calls. */
    1026365#define PIPE_RAW_MODE 0x4
     
    1065404#define EXTENDED_RESPONSE_REQUIRED 0x10
    1066405
    1067 /* ShareAccess field. */
    1068 #define FILE_SHARE_NONE 0 /* Cannot be used in bitmask. */
    1069 #define FILE_SHARE_READ 1
    1070 #define FILE_SHARE_WRITE 2
    1071 #define FILE_SHARE_DELETE 4
    1072 
    1073 /* FileAttributesField */
    1074 #define FILE_ATTRIBUTE_READONLY         0x001L
    1075 #define FILE_ATTRIBUTE_HIDDEN           0x002L
    1076 #define FILE_ATTRIBUTE_SYSTEM           0x004L
    1077 #define FILE_ATTRIBUTE_VOLUME           0x008L
    1078 #define FILE_ATTRIBUTE_DIRECTORY        0x010L
    1079 #define FILE_ATTRIBUTE_ARCHIVE          0x020L
    1080 #define FILE_ATTRIBUTE_NORMAL           0x080L
    1081 #define FILE_ATTRIBUTE_TEMPORARY        0x100L
    1082 #define FILE_ATTRIBUTE_SPARSE           0x200L
    1083 #define FILE_ATTRIBUTE_REPARSE_POINT    0x400L
    1084 #define FILE_ATTRIBUTE_COMPRESSED       0x800L
    1085 #define FILE_ATTRIBUTE_OFFLINE          0x1000L
    1086 #define FILE_ATTRIBUTE_NONINDEXED       0x2000L
    1087 #define FILE_ATTRIBUTE_ENCRYPTED        0x4000L
    1088 #define SAMBA_ATTRIBUTES_MASK           (FILE_ATTRIBUTE_READONLY|\
    1089                                         FILE_ATTRIBUTE_HIDDEN|\
    1090                                         FILE_ATTRIBUTE_SYSTEM|\
    1091                                         FILE_ATTRIBUTE_DIRECTORY|\
    1092                                         FILE_ATTRIBUTE_ARCHIVE)
    1093 
    1094 /* Flags - combined with attributes. */
    1095 #define FILE_FLAG_WRITE_THROUGH    0x80000000L
    1096 #define FILE_FLAG_NO_BUFFERING     0x20000000L
    1097 #define FILE_FLAG_RANDOM_ACCESS    0x10000000L
    1098 #define FILE_FLAG_SEQUENTIAL_SCAN  0x08000000L
    1099 #define FILE_FLAG_DELETE_ON_CLOSE  0x04000000L
    1100 #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L
    1101 #define FILE_FLAG_POSIX_SEMANTICS  0x01000000L
    1102 
    1103 /* CreateDisposition field. */
    1104 #define FILE_SUPERSEDE 0                /* File exists overwrite/supersede. File not exist create. */
    1105 #define FILE_OPEN 1                     /* File exists open. File not exist fail. */
    1106 #define FILE_CREATE 2                   /* File exists fail. File not exist create. */
    1107 #define FILE_OPEN_IF 3                  /* File exists open. File not exist create. */
    1108 #define FILE_OVERWRITE 4                /* File exists overwrite. File not exist fail. */
    1109 #define FILE_OVERWRITE_IF 5             /* File exists overwrite. File not exist create. */
    1110 
    1111 /* CreateOptions field. */
    1112 #define FILE_DIRECTORY_FILE       0x0001
    1113 #define FILE_WRITE_THROUGH        0x0002
    1114 #define FILE_SEQUENTIAL_ONLY      0x0004
    1115 #define FILE_NO_INTERMEDIATE_BUFFERING 0x0008
    1116 #define FILE_SYNCHRONOUS_IO_ALERT      0x0010   /* may be ignored */
    1117 #define FILE_SYNCHRONOUS_IO_NONALERT   0x0020   /* may be ignored */
    1118 #define FILE_NON_DIRECTORY_FILE   0x0040
    1119 #define FILE_CREATE_TREE_CONNECTION    0x0080   /* ignore, should be zero */
    1120 #define FILE_COMPLETE_IF_OPLOCKED      0x0100   /* ignore, should be zero */
    1121 #define FILE_NO_EA_KNOWLEDGE      0x0200
    1122 #define FILE_EIGHT_DOT_THREE_ONLY 0x0400 /* aka OPEN_FOR_RECOVERY: ignore, should be zero */
    1123 #define FILE_RANDOM_ACCESS        0x0800
    1124 #define FILE_DELETE_ON_CLOSE      0x1000
    1125 #define FILE_OPEN_BY_FILE_ID      0x2000
    1126 #define FILE_OPEN_FOR_BACKUP_INTENT    0x4000
    1127 #define FILE_NO_COMPRESSION       0x8000
    1128 #define FILE_RESERVER_OPFILTER    0x00100000    /* ignore, should be zero */
    1129 #define FILE_OPEN_REPARSE_POINT   0x00200000
    1130 #define FILE_OPEN_NO_RECALL       0x00400000
    1131 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 /* ignore should be zero */
    1132 
    1133406#define NTCREATEX_OPTIONS_MUST_IGNORE_MASK      (0x008F0480)
    1134407
     
    1148421/* Private options for printer support */
    1149422#define NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE 0x0008
    1150 
    1151 /* Responses when opening a file. */
    1152 #define FILE_WAS_SUPERSEDED 0
    1153 #define FILE_WAS_OPENED 1
    1154 #define FILE_WAS_CREATED 2
    1155 #define FILE_WAS_OVERWRITTEN 3
    1156 
    1157 /* File type flags */
    1158 #define FILE_TYPE_DISK  0
    1159 #define FILE_TYPE_BYTE_MODE_PIPE 1
    1160 #define FILE_TYPE_MESSAGE_MODE_PIPE 2
    1161 #define FILE_TYPE_PRINTER 3
    1162 #define FILE_TYPE_COMM_DEVICE 4
    1163 #define FILE_TYPE_UNKNOWN 0xFFFF
    1164423
    1165424/* Flag for NT transact rename call. */
     
    1171430#define RENAME_FLAG_RENAME                   0x104
    1172431#define RENAME_FLAG_COPY                     0x105
    1173 
    1174 /* Filesystem Attributes. */
    1175 #define FILE_CASE_SENSITIVE_SEARCH      0x00000001
    1176 #define FILE_CASE_PRESERVED_NAMES       0x00000002
    1177 #define FILE_UNICODE_ON_DISK            0x00000004
    1178 /* According to cifs9f, this is 4, not 8 */
    1179 /* Acconding to testing, this actually sets the security attribute! */
    1180 #define FILE_PERSISTENT_ACLS            0x00000008
    1181 #define FILE_FILE_COMPRESSION           0x00000010
    1182 #define FILE_VOLUME_QUOTAS              0x00000020
    1183 #define FILE_SUPPORTS_SPARSE_FILES      0x00000040
    1184 #define FILE_SUPPORTS_REPARSE_POINTS    0x00000080
    1185 #define FILE_SUPPORTS_REMOTE_STORAGE    0x00000100
    1186 #define FS_LFN_APIS                     0x00004000
    1187 #define FILE_VOLUME_IS_COMPRESSED       0x00008000
    1188 #define FILE_SUPPORTS_OBJECT_IDS        0x00010000
    1189 #define FILE_SUPPORTS_ENCRYPTION        0x00020000
    1190 #define FILE_NAMED_STREAMS              0x00040000
    1191 #define FILE_READ_ONLY_VOLUME           0x00080000
    1192432
    1193433/* ChangeNotify flags. */
     
    1208448        (FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME)
    1209449
     450#define FILE_NOTIFY_CHANGE_ALL \
     451        (FILE_NOTIFY_CHANGE_FILE_NAME   | FILE_NOTIFY_CHANGE_DIR_NAME | \
     452         FILE_NOTIFY_CHANGE_ATTRIBUTES  | FILE_NOTIFY_CHANGE_SIZE | \
     453         FILE_NOTIFY_CHANGE_LAST_WRITE  | FILE_NOTIFY_CHANGE_LAST_ACCESS | \
     454         FILE_NOTIFY_CHANGE_CREATION    | FILE_NOTIFY_CHANGE_EA | \
     455         FILE_NOTIFY_CHANGE_SECURITY    | FILE_NOTIFY_CHANGE_STREAM_NAME | \
     456         FILE_NOTIFY_CHANGE_STREAM_SIZE | FILE_NOTIFY_CHANGE_STREAM_WRITE)
     457
    1210458/* change notify action results */
    1211459#define NOTIFY_ACTION_ADDED 1
     
    1218466#define NOTIFY_ACTION_MODIFIED_STREAM 8
    1219467
     468/*
     469 * Timestamp format used in "previous versions":
     470 * This is the windows-level format of the @GMT- token.
     471 * It is a fixed format not to be confused with the
     472 * format for the POSIX-Level token of the shadow_copy2
     473 * VFS module that can be configured via the "shadow:format"
     474 * configuration option but defaults to the same format.
     475 * See the shadow_copy2 module.
     476 */
     477#define GMT_NAME_LEN 24 /* length of a @GMT- name */
     478#define GMT_FORMAT "@GMT-%Y.%m.%d-%H.%M.%S"
    1220479
    1221480/* where to find the base of the SMB packet proper */
    1222 #define smb_base(buf) (((char *)(buf))+4)
     481#define smb_base(buf) (((const char *)(buf))+4)
    1223482
    1224483/* we don't allow server strings to be longer than 48 characters as
     
    1228487
    1229488#define SMB_SUCCESS 0  /* The request was successful. */
    1230 
    1231 #ifdef WITH_DFS
    1232 void dfs_unlogin(void);
    1233 extern int dcelogin_atmost_once;
    1234 #endif
    1235489
    1236490#ifdef NOSTRDUP
     
    1253507 *        Setting this above 4.9 can have undesired side-effects.
    1254508 *        This may change again in Samba-3.0 after further testing. JHT
     509 *
     510 * Version 6.1 - For older smb server versions, MMC doesn't let offline
     511 *               settings to be configured during share creation. Changing
     512 *               it to 6.1 to mimic Win2K8R2.
     513 *
    1255514 */
    1256515 
    1257 #define DEFAULT_MAJOR_VERSION 0x04
    1258 #define DEFAULT_MINOR_VERSION 0x09
     516#define SAMBA_MAJOR_NBT_ANNOUNCE_VERSION 0x06
     517#define SAMBA_MINOR_NBT_ANNOUNCE_VERSION 0x01
    1259518
    1260519/* Browser Election Values */
     
    1262521#define BROWSER_CONSTANT        0xaa55
    1263522
    1264 /* Sercurity mode bits. */
    1265 #define NEGOTIATE_SECURITY_USER_LEVEL           0x01
    1266 #define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE   0x02
    1267 #define NEGOTIATE_SECURITY_SIGNATURES_ENABLED   0x04
    1268 #define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED  0x08
    1269 
    1270 /* NT Flags2 bits - cifs6.txt section 3.1.2 */
    1271    
    1272 #define FLAGS2_LONG_PATH_COMPONENTS    0x0001
    1273 #define FLAGS2_EXTENDED_ATTRIBUTES     0x0002
    1274 #define FLAGS2_SMB_SECURITY_SIGNATURES 0x0004
    1275 #define FLAGS2_UNKNOWN_BIT4            0x0010
    1276 #define FLAGS2_IS_LONG_NAME            0x0040
    1277 #define FLAGS2_EXTENDED_SECURITY       0x0800
    1278 #define FLAGS2_DFS_PATHNAMES           0x1000
    1279 #define FLAGS2_READ_PERMIT_EXECUTE     0x2000
    1280 #define FLAGS2_32_BIT_ERROR_CODES      0x4000
    1281 #define FLAGS2_UNICODE_STRINGS         0x8000
    1282 
    1283 #define FLAGS2_WIN2K_SIGNATURE         0xC852 /* Hack alert ! For now... JRA. */
    1284 
    1285 /* TCONX Flag (smb_vwv2). */
    1286 #define TCONX_FLAG_EXTENDED_RESPONSE    0x8
    1287 
    1288523/* File Status Flags. See:
    1289524
     
    1294529#define NO_SUBSTREAMS           0x2
    1295530#define NO_REPARSETAG           0x4
    1296 
    1297 /* Capabilities.  see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
    1298 
    1299 #define CAP_RAW_MODE         0x0001
    1300 #define CAP_MPX_MODE         0x0002
    1301 #define CAP_UNICODE          0x0004
    1302 #define CAP_LARGE_FILES      0x0008
    1303 #define CAP_NT_SMBS          0x0010
    1304 #define CAP_RPC_REMOTE_APIS  0x0020
    1305 #define CAP_STATUS32         0x0040
    1306 #define CAP_LEVEL_II_OPLOCKS 0x0080
    1307 #define CAP_LOCK_AND_READ    0x0100
    1308 #define CAP_NT_FIND          0x0200
    1309 #define CAP_DFS              0x1000
    1310 #define CAP_W2K_SMBS         0x2000
    1311 #define CAP_LARGE_READX      0x4000
    1312 #define CAP_LARGE_WRITEX     0x8000
    1313 #define CAP_UNIX             0x800000 /* Capabilities for UNIX extensions. Created by HP. */
    1314 #define CAP_EXTENDED_SECURITY 0x80000000
    1315 
    1316 /* protocol types. It assumes that higher protocols include lower protocols
    1317    as subsets */
    1318 enum protocol_types {
    1319         PROTOCOL_NONE,
    1320         PROTOCOL_CORE,
    1321         PROTOCOL_COREPLUS,
    1322         PROTOCOL_LANMAN1,
    1323         PROTOCOL_LANMAN2,
    1324         PROTOCOL_NT1,
    1325         PROTOCOL_SMB2
    1326 };
    1327 
    1328 /* security levels */
    1329 enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN,SEC_ADS};
    1330 
    1331 /* server roles */
    1332 enum server_types {
    1333         ROLE_STANDALONE,
    1334         ROLE_DOMAIN_MEMBER,
    1335         ROLE_DOMAIN_BDC,
    1336         ROLE_DOMAIN_PDC
    1337 };
    1338 
    1339 /* printing types */
    1340 enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
    1341                      PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ,
    1342                      PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2,PRINT_IPRINT
    1343 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
    1344 ,PRINT_TEST,PRINT_VLP
    1345 #endif /* DEVELOPER */
    1346 };
    1347 
    1348 /* LDAP SSL options */
    1349 enum ldap_ssl_types {LDAP_SSL_OFF, LDAP_SSL_START_TLS};
    1350 
    1351 /* LDAP PASSWD SYNC methods */
    1352 enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};
    1353 
    1354 /*
    1355  * This should be under the HAVE_KRB5 flag but since they're used
    1356  * in lp_kerberos_method(), they ned to be always available
    1357  * If you add any entries to KERBEROS_VERIFY defines, please modify USE.*KEYTAB macros
    1358  * so they remain accurate.
    1359  */
    1360 
    1361 #define KERBEROS_VERIFY_SECRETS 0
    1362 #define KERBEROS_VERIFY_SYSTEM_KEYTAB 1
    1363 #define KERBEROS_VERIFY_DEDICATED_KEYTAB 2
    1364 #define KERBEROS_VERIFY_SECRETS_AND_KEYTAB 3
    1365531
    1366532/* Remote architectures we know about. */
     
    1369535                        RA_SAMBA, RA_CIFSFS, RA_WINXP64, RA_OSX};
    1370536
    1371 /* case handling */
    1372 enum case_handling {CASE_LOWER,CASE_UPPER};
    1373 
    1374 /* ACL compatibility */
    1375 enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K};
    1376 /*
    1377  * Global value meaing that the smb_uid field should be
     537/*
     538 * Global value meaning that the smb_uid field should be
    1378539 * ingored (in share level security and protocol level == CORE)
    1379540 */
     
    1382543#define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */
    1383544
     545#define TID_FIELD_INVALID 0
     546
     547#define FNUM_FIELD_INVALID 0
     548
    1384549/*
    1385550 * Size of buffer to use when moving files across filesystems.
     
    1403568#define EXTENDED_OPLOCK_REQUEST(inbuf) ((SVAL(inbuf,smb_vwv2)&((1<<1)|(1<<2)))>>1)
    1404569
    1405 /* Lock types. */
    1406 #define LOCKING_ANDX_SHARED_LOCK 0x1
    1407 #define LOCKING_ANDX_OPLOCK_RELEASE 0x2
    1408 #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x4
    1409 #define LOCKING_ANDX_CANCEL_LOCK 0x8
    1410 #define LOCKING_ANDX_LARGE_FILES 0x10
    1411 
    1412570/*
    1413571 * Bits we test with.
     
    1415573 */
    1416574
    1417 #define NO_OPLOCK                       0x0
    1418 #define EXCLUSIVE_OPLOCK                0x1
    1419 #define BATCH_OPLOCK                    0x2
    1420 #define LEVEL_II_OPLOCK                 0x4
     575#define NO_OPLOCK                       OPLOCK_NONE
     576#define EXCLUSIVE_OPLOCK                OPLOCK_EXCLUSIVE
     577#define BATCH_OPLOCK                    OPLOCK_BATCH
     578#define LEVEL_II_OPLOCK                 OPLOCK_LEVEL_II
     579#define LEASE_OPLOCK                    0x100
    1421580
    1422581/* The following are Samba-private. */
    1423582#define INTERNAL_OPEN_ONLY              0x8
    1424 #define FAKE_LEVEL_II_OPLOCK            0x10    /* Client requested no_oplock, but we have to
     583/* #define FAKE_LEVEL_II_OPLOCK         0x10 */   /* Not used anymore */
     584                                /* Client requested no_oplock, but we have to
    1425585                                 * inform potential level2 holders on
    1426586                                 * write. */
    1427 #define DEFERRED_OPEN_ENTRY             0x20
    1428 #define UNUSED_SHARE_MODE_ENTRY         0x40
    1429 #define FORCE_OPLOCK_BREAK_TO_NONE      0x80
     587/* #define DEFERRED_OPEN_ENTRY          0x20 */   /* Not used anymore */
     588/* #define UNUSED_SHARE_MODE_ENTRY      0x40 */   /* Not used anymore */
     589/* #define FORCE_OPLOCK_BREAK_TO_NONE   0x80 */   /* Not used anymore */
    1430590
    1431591/* None of the following should ever appear in fsp->oplock_request. */
    1432 #define SAMBA_PRIVATE_OPLOCK_MASK (INTERNAL_OPEN_ONLY|DEFERRED_OPEN_ENTRY|UNUSED_SHARE_MODE_ENTRY|FORCE_OPLOCK_BREAK_TO_NONE)
     592#define SAMBA_PRIVATE_OPLOCK_MASK (INTERNAL_OPEN_ONLY)
    1433593
    1434594#define EXCLUSIVE_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)EXCLUSIVE_OPLOCK|(unsigned int)BATCH_OPLOCK))
    1435595#define BATCH_OPLOCK_TYPE(lck) ((lck) & (unsigned int)BATCH_OPLOCK)
    1436 #define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)LEVEL_II_OPLOCK|(unsigned int)FAKE_LEVEL_II_OPLOCK))
     596#define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & (unsigned int)LEVEL_II_OPLOCK)
    1437597
    1438598/* kernel_oplock_message definition.
     
    1497657    KERNEL_OPLOCK_CAPABILITY,
    1498658    DMAPI_ACCESS_CAPABILITY,
    1499     LEASE_CAPABILITY
     659    LEASE_CAPABILITY,
     660    DAC_OVERRIDE_CAPABILITY
    1500661};
    1501662
     
    1574735};
    1575736
    1576 typedef struct user_struct {
    1577         struct user_struct *next, *prev;
    1578         uint16 vuid; /* Tag for this entry. */
    1579 
    1580         char *session_keystr; /* used by utmp and pam session code. 
    1581                                  TDB key string */
    1582         int homes_snum;
    1583 
    1584         struct auth_serversupplied_info *session_info;
    1585 
    1586         struct auth_ntlmssp_state *auth_ntlmssp_state;
    1587 } user_struct;
    1588 
    1589 struct unix_error_map {
    1590         int unix_error;
    1591         int dos_class;
    1592         int dos_code;
    1593         NTSTATUS nt_error;
    1594 };
    1595 
    1596 /*
    1597    Do you want session setups at user level security with a invalid
    1598    password to be rejected or allowed in as guest? WinNT rejects them
    1599    but it can be a pain as it means "net view" needs to use a password
    1600 
    1601    You have 3 choices in the setting of map_to_guest:
    1602 
    1603    "NEVER_MAP_TO_GUEST" means session setups with an invalid password
    1604    are rejected. This is the default.
    1605 
    1606    "MAP_TO_GUEST_ON_BAD_USER" means session setups with an invalid password
    1607    are rejected, unless the username does not exist, in which case it
    1608    is treated as a guest login
    1609 
    1610    "MAP_TO_GUEST_ON_BAD_PASSWORD" means session setups with an invalid password
    1611    are treated as a guest login
    1612 
    1613    Note that map_to_guest only has an effect in user or server
    1614    level security.
    1615 */
    1616 
    1617 #define NEVER_MAP_TO_GUEST              0
    1618 #define MAP_TO_GUEST_ON_BAD_USER        1
    1619 #define MAP_TO_GUEST_ON_BAD_PASSWORD    2
    1620 #define MAP_TO_GUEST_ON_BAD_UID         3
    1621 
    1622737#define SAFE_NETBIOS_CHARS ". -_"
    1623738
     
    1641756
    1642757struct ea_struct {
    1643         uint8 flags;
     758        uint8_t flags;
    1644759        char *name;
    1645760        DATA_BLOB value;
     
    1659774/* Prefix for xattrs storing streams. */
    1660775#define SAMBA_XATTR_MARKER "user.SAMBA_STREAMS"
    1661 
    1662 /* map readonly options */
    1663 enum mapreadonly_options {MAP_READONLY_NO, MAP_READONLY_YES, MAP_READONLY_PERMISSIONS};
    1664776
    1665777/* usershare error codes. */
     
    1688800#define SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH 28
    1689801struct smb_extended_info {
    1690         uint32 samba_magic;             /* Always SAMBA_EXTRA_INFO_MAGIC */
    1691         uint32 samba_version;           /* Major/Minor/Release/Revision */
    1692         uint32 samba_subversion;        /* Prerelease/RC/Vendor patch */
     802        uint32_t samba_magic;           /* Always SAMBA_EXTRA_INFO_MAGIC */
     803        uint32_t samba_version;         /* Major/Minor/Release/Revision */
     804        uint32_t samba_subversion;      /* Prerelease/RC/Vendor patch */
    1693805        NTTIME samba_gitcommitdate;
    1694806        char   samba_version_string[SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH];
    1695807};
    1696808
    1697 /* time info */
    1698 struct smb_file_time {
    1699         struct timespec mtime;
    1700         struct timespec atime;
    1701         struct timespec ctime;
    1702         struct timespec create_time;
    1703 };
    1704 
    1705 /*
    1706  * unix_convert_flags
    1707  */
    1708 #define UCF_SAVE_LCOMP                  0x00000001
    1709 #define UCF_ALWAYS_ALLOW_WCARD_LCOMP    0x00000002
    1710 #define UCF_COND_ALLOW_WCARD_LCOMP      0x00000004
    1711 #define UCF_POSIX_PATHNAMES             0x00000008
    1712 #define UCF_UNIX_NAME_LOOKUP            0x00000010
    1713 #define UCF_CREATING_FILE               0x00000020
    1714 
    1715 /*
    1716  * smb_filename
    1717  */
    1718 struct smb_filename {
    1719         char *base_name;
    1720         char *stream_name;
    1721         char *original_lcomp;
    1722         SMB_STRUCT_STAT st;
    1723 };
    1724 
    1725 /* struct for maintaining the child processes that get spawned from smbd */
    1726 struct child_pid {
    1727         struct child_pid *prev, *next;
    1728         pid_t pid;
    1729 };
    1730 
    1731 /* Used to keep track of deferred opens. */
    1732 struct deferred_open_record;
    1733 
    1734 /* Client-side offline caching policy types */
    1735 #define CSC_POLICY_MANUAL 0
    1736 #define CSC_POLICY_DOCUMENTS 1
    1737 #define CSC_POLICY_PROGRAMS 2
    1738 #define CSC_POLICY_DISABLE 3
    1739 
    1740 /* Used inside aio code. */
    1741 struct aio_extra;
    1742 
    1743809/*
    1744810 * Reasons for cache flush.
     
    1746812
    1747813enum flush_reason_enum {
    1748     SEEK_FLUSH,
    1749     READ_FLUSH,
    1750     WRITE_FLUSH,
    1751     READRAW_FLUSH,
    1752     OPLOCK_RELEASE_FLUSH,
    1753     CLOSE_FLUSH,
    1754     SYNC_FLUSH,
    1755     SIZECHANGE_FLUSH,
    1756     /* NUM_FLUSH_REASONS must remain the last value in the enumeration. */
    1757     NUM_FLUSH_REASONS};
     814    SAMBA_SEEK_FLUSH,
     815    SAMBA_READ_FLUSH,
     816    SAMBA_WRITE_FLUSH,
     817    SAMBA_READRAW_FLUSH,
     818    SAMBA_OPLOCK_RELEASE_FLUSH,
     819    SAMBA_CLOSE_FLUSH,
     820    SAMBA_SYNC_FLUSH,
     821    SAMBA_SIZECHANGE_FLUSH,
     822};
    1758823
    1759824#endif /* _SMB_H */
  • vendor/current/source3/include/smb_acls.h

    r414 r988  
    2121#define _SMB_ACLS_H
    2222
     23#include "librpc/gen_ndr/smb_acl.h"
     24
     25struct vfs_handle_struct;
     26struct files_struct;
     27
    2328typedef int                     SMB_ACL_TYPE_T;
    2429typedef mode_t                  *SMB_ACL_PERMSET_T;
    2530typedef mode_t                  SMB_ACL_PERM_T;
    26 #define SMB_ACL_READ                            4
    27 #define SMB_ACL_WRITE                           2
    28 #define SMB_ACL_EXECUTE                         1
    29 
    30 /* Types of ACLs. */
    31 enum smb_acl_tag_t {
    32         SMB_ACL_TAG_INVALID=0,
    33         SMB_ACL_USER=1,
    34         SMB_ACL_USER_OBJ,
    35         SMB_ACL_GROUP,
    36         SMB_ACL_GROUP_OBJ,
    37         SMB_ACL_OTHER,
    38         SMB_ACL_MASK
    39 };
    4031
    4132typedef enum smb_acl_tag_t SMB_ACL_TAG_T;
    42 
    43 struct smb_acl_entry {
    44         enum smb_acl_tag_t a_type;
    45         SMB_ACL_PERM_T a_perm;
    46         uid_t uid;
    47         gid_t gid;
    48 };
    49 
    50 typedef struct smb_acl_t {
    51         int     size;
    52         int     count;
    53         int     next;
    54         struct smb_acl_entry acl[1];
    55 } *SMB_ACL_T;
     33typedef struct smb_acl_t *SMB_ACL_T;
    5634
    5735typedef struct smb_acl_entry    *SMB_ACL_ENTRY_T;
    5836
    59 #define SMB_ACL_FIRST_ENTRY                     0
    60 #define SMB_ACL_NEXT_ENTRY                      1
     37/* The following definitions come from lib/sysacls.c  */
    6138
    62 #define SMB_ACL_TYPE_ACCESS                     0
    63 #define SMB_ACL_TYPE_DEFAULT            1
     39int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p);
     40int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p);
     41int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
     42void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d);
     43int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d);
     44int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
     45int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
     46char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p);
     47SMB_ACL_T sys_acl_init(TALLOC_CTX *mem_ctx);
     48int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
     49int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
     50int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
     51int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d);
     52int sys_acl_free_text(char *text);
     53int sys_acl_valid(SMB_ACL_T acl_d);
     54SMB_ACL_T sys_acl_get_file(struct vfs_handle_struct *handle,
     55                           const char *path_p, SMB_ACL_TYPE_T type,
     56                           TALLOC_CTX *mem_ctx);
     57SMB_ACL_T sys_acl_get_fd(struct vfs_handle_struct *handle, struct files_struct *fsp,
     58                         TALLOC_CTX *mem_ctx);
     59int sys_acl_set_file(struct vfs_handle_struct *handle,
     60                     const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
     61int sys_acl_set_fd(struct vfs_handle_struct *handle, struct files_struct *fsp,
     62                   SMB_ACL_T acl_d);
     63int sys_acl_delete_def_file(struct vfs_handle_struct *handle,
     64                            const char *path);
     65int no_acl_syscall_error(int err);
    6466
    6567#endif /* _SMB_ACLS_H */
  • vendor/current/source3/include/smb_krb5.h

    r740 r988  
    1 /*
    2    Unix SMB/CIFS implementation.
    3    simple kerberos5 routines for active directory
    4    Copyright (C) Andrew Tridgell 2001
    5    Copyright (C) Luke Howard 2002-2003
    6    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
    7    Copyright (C) Guenther Deschner 2005-2009
    8 
    9    This program is free software; you can redistribute it and/or modify
    10    it under the terms of the GNU General Public License as published by
    11    the Free Software Foundation; either version 3 of the License, or
    12    (at your option) any later version.
    13 
    14    This program is distributed in the hope that it will be useful,
    15    but WITHOUT ANY WARRANTY; without even the implied warranty of
    16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17    GNU General Public License for more details.
    18 
    19    You should have received a copy of the GNU General Public License
    20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    21 */
    22 
    23 #ifndef _HEADER_smb_krb5_h
    24 #define _HEADER_smb_krb5_h
    25 
    26 #define KRB5_PRIVATE    1       /* this file uses PRIVATE interfaces! */
    27 /* this file uses DEPRECATED interfaces! */
    28 
    29 #if defined(HAVE_KRB5_DEPRECATED_WITH_IDENTIFIER)
    30 #define KRB5_DEPRECATED 1
    31 #else
    32 #define KRB5_DEPRECATED
    33 #endif
    34 
    35 #if HAVE_KRB5_H
    36 #include <krb5.h>
    37 #endif
    38 
    39 #if HAVE_GSSAPI_GSSAPI_H
    40 #include <gssapi/gssapi.h>
    41 #elif HAVE_GSSAPI_GSSAPI_GENERIC_H
    42 #include <gssapi/gssapi_generic.h>
    43 #elif HAVE_GSSAPI_H
    44 #include <gssapi.h>
    45 #endif
    46 
    47 #if HAVE_COM_ERR_H
    48 #include <com_err.h>
    49 #endif
    50 
    51 #ifndef KRB5_ADDR_NETBIOS
    52 #define KRB5_ADDR_NETBIOS 0x14
    53 #endif
    54 
    55 #ifndef KRB5KRB_ERR_RESPONSE_TOO_BIG
    56 #define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L)
    57 #endif
    58 
    59 /* Heimdal uses a slightly different name */
    60 #if defined(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5) && !defined(HAVE_ENCTYPE_ARCFOUR_HMAC)
    61 #define ENCTYPE_ARCFOUR_HMAC ENCTYPE_ARCFOUR_HMAC_MD5
    62 #endif
    63 
    64 /* The older versions of heimdal that don't have this
    65    define don't seem to use it anyway.  I'm told they
    66    always use a subkey */
    67 #ifndef HAVE_AP_OPTS_USE_SUBKEY
    68 #define AP_OPTS_USE_SUBKEY 0
    69 #endif
    70 
    71 #ifdef HAVE_KRB5
    72 typedef struct {
    73 #if defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) /* MIT */
    74         krb5_address **addrs;
    75 #elif defined(HAVE_KRB5_ADDRESSES) /* Heimdal */
    76         krb5_addresses *addrs;
    77 #else
    78 #error UNKNOWN_KRB5_ADDRESS_TYPE
    79 #endif /* defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) */
    80 } smb_krb5_addresses;
    81 
    82 #ifdef HAVE_KRB5_KEYBLOCK_KEYVALUE /* Heimdal */
    83 #define KRB5_KEY_TYPE(k)        ((k)->keytype)
    84 #define KRB5_KEY_LENGTH(k)      ((k)->keyvalue.length)
    85 #define KRB5_KEY_DATA(k)        ((k)->keyvalue.data)
    86 #define KRB5_KEY_DATA_CAST      void
    87 #else /* MIT */
    88 #define KRB5_KEY_TYPE(k)        ((k)->enctype)
    89 #define KRB5_KEY_LENGTH(k)      ((k)->length)
    90 #define KRB5_KEY_DATA(k)        ((k)->contents)
    91 #define KRB5_KEY_DATA_CAST      krb5_octet
    92 #endif /* HAVE_KRB5_KEYBLOCK_KEYVALUE */
    93 
    94 #ifdef HAVE_KRB5_KEYTAB_ENTRY_KEY               /* MIT */
    95 #define KRB5_KT_KEY(k)          (&(k)->key)
    96 #elif HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK          /* Heimdal */
    97 #define KRB5_KT_KEY(k)          (&(k)->keyblock)
    98 #else
    99 #error krb5_keytab_entry has no key or keyblock member
    100 #endif /* HAVE_KRB5_KEYTAB_ENTRY_KEY */
    101 
    102 #endif /* HAVE_KRB5 */
    103 
    104 #include "krb5_protos.h"
    105 
    106 #endif /* _HEADER_smb_krb5_h */
     1#include "lib/krb5_wrap/krb5_samba.h"
     2#include "lib/krb5_wrap/gss_samba.h"
  • vendor/current/source3/include/smb_ldap.h

    r740 r988  
    4545#define LDAP_CONST const
    4646#endif
    47 #ifndef LDAP_OPT_SUCCESS
    48 #define LDAP_OPT_SUCCESS 0
    49 #endif
     47
     48#ifdef HAVE_LDAP_PVT_H
     49#include <ldap_pvt.h>
     50#endif /* HAVE_LDAP_PVT_H */
     51
    5052/* Solaris 8 and maybe other LDAP implementations spell this "..._INPROGRESS": */
    5153#if defined(LDAP_SASL_BIND_INPROGRESS) && !defined(LDAP_SASL_BIND_IN_PROGRESS)
     
    5860#define LDAPS_PORT 636
    5961#endif
    60 
    61 /* function declarations not included in proto.h */
    62 LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to);
    6362
    6463#endif /* HAVE_LDAP_H */
     
    7877#endif
    7978
     79#define LDAP_DEFAULT_TIMEOUT   15
     80#define LDAP_CONNECTION_DEFAULT_TIMEOUT 2
     81#define LDAP_PAGE_SIZE 1000
     82
     83#define ADS_PAGE_CTL_OID        "1.2.840.113556.1.4.319"
     84
     85/*
     86 * Work around versions of the LDAP client libs that don't have the OIDs
     87 * defined, or have them defined under the old name.
     88 * This functionality is really a factor of the server, not the client
     89 *
     90 */
     91
     92#if defined(LDAP_EXOP_X_MODIFY_PASSWD) && !defined(LDAP_EXOP_MODIFY_PASSWD)
     93#define LDAP_EXOP_MODIFY_PASSWD LDAP_EXOP_X_MODIFY_PASSWD
     94#elif !defined(LDAP_EXOP_MODIFY_PASSWD)
     95#define LDAP_EXOP_MODIFY_PASSWD "1.3.6.1.4.1.4203.1.11.1"
     96#endif
     97
     98#if defined(LDAP_EXOP_X_MODIFY_PASSWD_ID) && !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
     99#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID LDAP_EXOP_X_MODIFY_PASSWD_ID
     100#elif !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
     101#define LDAP_TAG_EXOP_MODIFY_PASSWD_ID        ((ber_tag_t) 0x80U)
     102#endif
     103
     104#if defined(LDAP_EXOP_X_MODIFY_PASSWD_NEW) && !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
     105#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW LDAP_EXOP_X_MODIFY_PASSWD_NEW
     106#elif !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
     107#define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW       ((ber_tag_t) 0x82U)
     108#endif
     109
    80110#endif /* _SMB_LDAP_H */
  • vendor/current/source3/include/smb_macros.h

    r740 r988  
    66   Copyright (C) Luke Kenneth Casson Leighton 1996-1999
    77   Copyright (C) Paul Ashton 1998 - 1999
    8    
     8
    99   This program is free software; you can redistribute it and/or modify
    1010   it under the terms of the GNU General Public License as published by
    1111   the Free Software Foundation; either version 3 of the License, or
    1212   (at your option) any later version.
    13    
     13
    1414   This program is distributed in the hope that it will be useful,
    1515   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1616   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1717   GNU General Public License for more details.
    18    
     18
    1919   You should have received a copy of the GNU General Public License
    2020   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    7373#define GUEST_OK(snum)     (VALID_SNUM(snum) && lp_guest_ok(snum))
    7474#define GUEST_ONLY(snum)   (VALID_SNUM(snum) && lp_guest_only(snum))
    75 #define CAN_SETDIR(snum)   (!lp_no_set_dir(snum))
    76 #define CAN_PRINT(conn)    ((conn) && lp_print_ok(SNUM(conn)))
     75#define CAN_PRINT(conn)    ((conn) && lp_printable(SNUM(conn)))
    7776#define MAP_HIDDEN(conn)   ((conn) && lp_map_hidden(SNUM(conn)))
    7877#define MAP_SYSTEM(conn)   ((conn) && lp_map_system(SNUM(conn)))
     
    105104#define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx)))
    106105
    107 #define ERROR_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__)
    108106#define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__)
    109 #define ERROR_FORCE_NT(status) error_packet(outbuf,-1,-1,status,__LINE__,__FILE__)
    110107#define ERROR_BOTH(status,class,code) error_packet(outbuf,class,code,status,__LINE__,__FILE__)
    111108
     
    124121/* Extra macros added by Ying Chen at IBM - speed increase by inlining. */
    125122#define smb_buf(buf) (((char *)(buf)) + smb_size + CVAL(buf,smb_wct)*2)
     123#define smb_buf_const(buf) (((const char *)(buf)) + smb_size + CVAL(buf,smb_wct)*2)
    126124#define smb_buflen(buf) (SVAL(buf,smb_vwv0 + (int)CVAL(buf, smb_wct)*2))
    127125
     
    134132#define smb_offset(p,buf) (PTR_DIFF(p,buf+4))
    135133
    136 #define smb_len(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|((PVAL(buf,1)&1)<<16))
    137 #define _smb_setlen(buf,len) do { buf[0] = 0; buf[1] = ((len)&0x10000)>>16; \
    138         buf[2] = ((len)&0xFF00)>>8; buf[3] = (len)&0xFF; } while (0)
    139 
    140 #define smb_len_large(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|(PVAL(buf,1)<<16))
    141 #define _smb_setlen_large(buf,len) do { buf[0] = 0; buf[1] = ((len)&0xFF0000)>>16; \
    142         buf[2] = ((len)&0xFF00)>>8; buf[3] = (len)&0xFF; } while (0)
    143 
    144 #define ENCRYPTION_REQUIRED(conn) ((conn) ? ((conn)->encrypt_level == Required) : false)
     134#define smb_len(buf) smb_len_nbt(buf)
     135#define _smb_setlen(buf, len) _smb_setlen_nbt(buf, len)
     136#define smb_setlen(buf, len) smb_setlen_nbt(buf, len)
     137
     138#define smb_len_large(buf) smb_len_tcp(buf)
     139#define _smb_setlen_large(buf, len) _smb_setlen_tcp(buf, len)
     140
     141#define ENCRYPTION_REQUIRED(conn) ((conn) ? ((conn)->encrypt_level == SMB_SIGNING_REQUIRED) : false)
    145142#define IS_CONN_ENCRYPTED(conn) ((conn) ? (conn)->encrypted_tid : false)
    146143
     
    174171********************************************************************/
    175172
    176 #define SERVER_HAS_UNIX_CIFS(c) ((c)->capabilities & CAP_UNIX)
     173#define SERVER_HAS_UNIX_CIFS(c) (smb1cli_conn_capabilities(c->conn) & CAP_UNIX)
    177174
    178175/****************************************************************************
     
    182179#define IS_DIRECTORY_SEP(c) ((c) == '\\' || (c) == '/')
    183180#define unix_format(fname) string_replace(fname,'\\','/')
    184 #define unix_format_w(fname) string_replace_w(fname, UCS2_CHAR('\\'), UCS2_CHAR('/'))
    185181
    186182/****************************************************************************
     
    194190*****************************************************************************/
    195191
    196 #define IS_DC  (lp_server_role()==ROLE_DOMAIN_PDC || lp_server_role()==ROLE_DOMAIN_BDC)
     192#define IS_DC  (lp_server_role()==ROLE_DOMAIN_PDC || lp_server_role()==ROLE_DOMAIN_BDC || lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC)
    197193
    198194/*
     
    219215#define SMB_XMALLOC_ARRAY(type,count) (type *)smb_xmalloc_array(sizeof(type),(count))
    220216
    221 /* The new talloc is paranoid malloc checker safe. */
    222 
    223 #if 0
    224 
    225 Disable these now we have checked all code paths and ensured
    226 NULL returns on zero request. JRA.
    227 
    228 #define TALLOC(ctx, size) talloc_zeronull(ctx, size, __location__)
    229 #define TALLOC_P(ctx, type) (type *)talloc_zeronull(ctx, sizeof(type), #type)
    230 #define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array_zeronull(ctx, sizeof(type), count, #type)
    231 #define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup_zeronull(ctx, ptr, size, __location__)
    232 #define TALLOC_ZERO(ctx, size) _talloc_zero_zeronull(ctx, size, __location__)
    233 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero_zeronull(ctx, sizeof(type), #type)
    234 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array_zeronull(ctx, sizeof(type), count, #type)
    235 #define TALLOC_SIZE(ctx, size) talloc_zeronull(ctx, size, __location__)
    236 #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero_zeronull(ctx, size, __location__)
    237 
    238 #else
    239 
    240217#define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__)
    241 #define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
    242 #define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
    243 #define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__)
    244218#define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__)
    245 #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
    246 #define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)
    247219#define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__)
    248220#define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)
    249221
    250 #endif
    251 
    252222#define TALLOC_REALLOC(ctx, ptr, count) _talloc_realloc(ctx, ptr, count, __location__)
    253 #define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type *)_talloc_realloc_array(ctx, ptr, sizeof(type), count, #type)
    254223#define talloc_destroy(ctx) talloc_free(ctx)
    255224#ifndef TALLOC_FREE
     
    314283do { \
    315284        *(array) = ((mem_ctx) != NULL) ? \
    316                 TALLOC_REALLOC_ARRAY(mem_ctx, (*(array)), type, (*(num))+1) : \
     285                talloc_realloc(mem_ctx, (*(array)), type, (*(num))+1) : \
    317286                SMB_REALLOC_ARRAY((*(array)), type, (*(num))+1); \
    318287        SMB_ASSERT((*(array)) != NULL); \
     
    324293        add_to_large_array((mem_ctx), sizeof(type), &(elem), (void *)(array), (num), (size));
    325294
    326 #ifndef toupper_ascii_fast
    327 /* Warning - this must only be called with 0 <= c < 128. IT WILL
    328  * GIVE GARBAGE if c > 128 or c < 0. JRA.
    329  */
    330 extern const char toupper_ascii_fast_table[];
    331 #define toupper_ascii_fast(c) toupper_ascii_fast_table[(unsigned int)(c)];
    332 #endif
     295#define trans_oob(bufsize, offset, length) \
     296        smb_buffer_oob(bufsize, offset, length)
    333297
    334298#endif /* _SMB_MACROS_H */
  • vendor/current/source3/include/smbldap.h

    r740 r988  
    2222#define _SMBLDAP_H
    2323
    24 struct smbldap_state;
    25 
    26 #include "smb_ldap.h"
     24#include "include/smb_ldap.h"
    2725
    2826#ifdef HAVE_LDAP
    2927
    30 /* specify schema versions between 2.2. and 3.0 */
    31 
    32 #define SCHEMAVER_SAMBAACCOUNT          1
    33 #define SCHEMAVER_SAMBASAMACCOUNT       2
    34 
    35 /* objectclass names */
    36 
    37 #define LDAP_OBJ_SAMBASAMACCOUNT        "sambaSamAccount"
    38 #define LDAP_OBJ_SAMBAACCOUNT           "sambaAccount"
    39 #define LDAP_OBJ_GROUPMAP               "sambaGroupMapping"
    40 #define LDAP_OBJ_DOMINFO                "sambaDomain"
    41 #define LDAP_OBJ_IDPOOL                 "sambaUnixIdPool"
    42 #define LDAP_OBJ_IDMAP_ENTRY            "sambaIdmapEntry"
    43 #define LDAP_OBJ_SID_ENTRY              "sambaSidEntry"
    44 #define LDAP_OBJ_TRUST_PASSWORD         "sambaTrustPassword"
    45 #define LDAP_OBJ_TRUSTDOM_PASSWORD      "sambaTrustedDomainPassword"
    46 #define LDAP_OBJ_TRUSTED_DOMAIN         "sambaTrustedDomain"
    47 
    48 #define LDAP_OBJ_ACCOUNT                "account"
    49 #define LDAP_OBJ_POSIXACCOUNT           "posixAccount"
    50 #define LDAP_OBJ_POSIXGROUP             "posixGroup"
    51 #define LDAP_OBJ_OU                     "organizationalUnit"
    52 
    53 /* some generic attributes that get reused a lot */
    54 
    55 #define LDAP_ATTRIBUTE_SID              "sambaSID"
    56 #define LDAP_ATTRIBUTE_UIDNUMBER        "uidNumber"
    57 #define LDAP_ATTRIBUTE_GIDNUMBER        "gidNumber"
    58 #define LDAP_ATTRIBUTE_SID_LIST         "sambaSIDList"
    59 
    60 /* attribute map table indexes */
    61 
    62 #define LDAP_ATTR_LIST_END              0
    63 #define LDAP_ATTR_UID                   1
    64 #define LDAP_ATTR_UIDNUMBER             2
    65 #define LDAP_ATTR_GIDNUMBER             3
    66 #define LDAP_ATTR_UNIX_HOME             4
    67 #define LDAP_ATTR_PWD_LAST_SET          5
    68 #define LDAP_ATTR_PWD_CAN_CHANGE        6
    69 #define LDAP_ATTR_PWD_MUST_CHANGE       7
    70 #define LDAP_ATTR_LOGON_TIME            8
    71 #define LDAP_ATTR_LOGOFF_TIME           9
    72 #define LDAP_ATTR_KICKOFF_TIME          10
    73 #define LDAP_ATTR_CN                    11
    74 #define LDAP_ATTR_DISPLAY_NAME          12
    75 #define LDAP_ATTR_HOME_PATH             13
    76 #define LDAP_ATTR_LOGON_SCRIPT          14
    77 #define LDAP_ATTR_PROFILE_PATH          15
    78 #define LDAP_ATTR_DESC                  16
    79 #define LDAP_ATTR_USER_WKS              17
    80 #define LDAP_ATTR_USER_SID              18
    81 #define LDAP_ATTR_USER_RID              18
    82 #define LDAP_ATTR_PRIMARY_GROUP_SID     19
    83 #define LDAP_ATTR_PRIMARY_GROUP_RID     20
    84 #define LDAP_ATTR_LMPW                  21
    85 #define LDAP_ATTR_NTPW                  22
    86 #define LDAP_ATTR_DOMAIN                23
    87 #define LDAP_ATTR_OBJCLASS              24
    88 #define LDAP_ATTR_ACB_INFO              25
    89 #define LDAP_ATTR_NEXT_USERRID          26
    90 #define LDAP_ATTR_NEXT_GROUPRID         27
    91 #define LDAP_ATTR_DOM_SID               28
    92 #define LDAP_ATTR_HOME_DRIVE            29
    93 #define LDAP_ATTR_GROUP_SID             30
    94 #define LDAP_ATTR_GROUP_TYPE            31
    95 #define LDAP_ATTR_SID                   32
    96 #define LDAP_ATTR_ALGORITHMIC_RID_BASE  33
    97 #define LDAP_ATTR_NEXT_RID              34
    98 #define LDAP_ATTR_BAD_PASSWORD_COUNT    35
    99 #define LDAP_ATTR_LOGON_COUNT           36
    100 #define LDAP_ATTR_MUNGED_DIAL           37
    101 #define LDAP_ATTR_BAD_PASSWORD_TIME     38
    102 #define LDAP_ATTR_PWD_HISTORY           39
    103 #define LDAP_ATTR_SID_LIST              40
    104 #define LDAP_ATTR_MOD_TIMESTAMP         41
    105 #define LDAP_ATTR_LOGON_HOURS           42
    106 #define LDAP_ATTR_TRUST_PASSWD_FLAGS    43
    107 #define LDAP_ATTR_SN                    44
    108 
    109 
    110 typedef struct _attrib_map_entry {
    111         int             attrib;
    112         const char      *name;
    113 } ATTRIB_MAP_ENTRY;
    114 
    115 
    116 /* structures */
    117 
    118 extern ATTRIB_MAP_ENTRY attrib_map_v22[];
    119 extern ATTRIB_MAP_ENTRY attrib_map_to_delete_v22[];
    120 extern ATTRIB_MAP_ENTRY attrib_map_v30[];
    121 extern ATTRIB_MAP_ENTRY attrib_map_to_delete_v30[];
    122 extern ATTRIB_MAP_ENTRY dominfo_attr_list[];
    123 extern ATTRIB_MAP_ENTRY groupmap_attr_list[];
    124 extern ATTRIB_MAP_ENTRY groupmap_attr_list_to_delete[];
    125 extern ATTRIB_MAP_ENTRY idpool_attr_list[];
    126 extern ATTRIB_MAP_ENTRY sidmap_attr_list[];
    127 extern ATTRIB_MAP_ENTRY trustpw_attr_list[];
    128 
    129 
    130 /* Function declarations -- not included in proto.h so we don't
    131    have to worry about LDAP structure types */
    132 
    133 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx,
    134                       struct event_context *event_ctx,
    135                       const char *location,
    136                       struct smbldap_state **smbldap_state);
    137 
    138 const char* get_attr_key2string( ATTRIB_MAP_ENTRY table[], int key );
    139 const char** get_attr_list( TALLOC_CTX *mem_ctx, ATTRIB_MAP_ENTRY table[] );
    140 void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
    141 void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *newblob);
    142 void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
    143                       LDAPMod ***mods,
    144                       const char *attribute, const char *newval);
    145 void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
    146                            LDAPMod ***mods,
    147                            const char *attribute, const DATA_BLOB *newblob);
    148 bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
    149                                    const char *attribute, char *value,
    150                                    int max_len);
    151 int smbldap_modify(struct smbldap_state *ldap_state,
    152                    const char *dn,
    153                    LDAPMod *attrs[]);
     28#include <talloc.h>
     29#include <tevent.h>
    15430
    15531/**
     
    16945        char *bind_dn;
    17046        char *bind_secret;
     47        int (*bind_callback)(LDAP *ldap_struct, struct smbldap_state *ldap_state, void *data);
     48        void *bind_callback_data;
    17149
    17250        bool paged_results;
     
    17553
    17654        time_t last_use; /* monotonic */
    177         struct event_context *event_context;
    178         struct timed_event *idle_event;
     55        struct tevent_context *tevent_context;
     56        struct tevent_timer *idle_event;
    17957
    18058        struct timeval last_rebind; /* monotonic */
     
    21795};
    21896
    219 /* Functions shared between pdb_ldap.c and pdb_nds.c. */
    220 struct pdb_methods;
    221 NTSTATUS pdb_init_ldapsam_compat( struct pdb_methods **pdb_method, const char *location);
    222 void private_data_free_fn(void **result);
    223 int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state,
    224                                   const char *user,
    225                                   LDAPMessage ** result,
    226                                   const char **attr);
    227 NTSTATUS pdb_init_ldapsam( struct pdb_methods **pdb_method, const char *location);
    228 const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver );
    229 
    230 char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry,
    231                                        const char *attribute,
    232                                        TALLOC_CTX *mem_ctx);
    233 char * smbldap_talloc_first_attribute(LDAP *ldap_struct, LDAPMessage *entry,
    234                                       const char *attribute,
    235                                       TALLOC_CTX *mem_ctx);
    236 char * smbldap_talloc_smallest_attribute(LDAP *ldap_struct, LDAPMessage *entry,
    237                                          const char *attribute,
    238                                          TALLOC_CTX *mem_ctx);
    239 bool smbldap_talloc_single_blob(TALLOC_CTX *mem_ctx, LDAP *ld,
    240                                 LDAPMessage *msg, const char *attrib,
    241                                 DATA_BLOB *blob);
    242 bool smbldap_pull_sid(LDAP *ld, LDAPMessage *msg, const char *attrib,
    243                       struct dom_sid *sid);
    244 void talloc_autofree_ldapmsg(TALLOC_CTX *mem_ctx, LDAPMessage *result);
    245 void talloc_autofree_ldapmod(TALLOC_CTX *mem_ctx, LDAPMod **mod);
    246 char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld,
    247                               LDAPMessage *entry);
    248 LDAP *priv2ld(struct ldapsam_privates *priv);
    249 
    25097/* The following definitions come from lib/smbldap.c  */
    25198
    252 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
    253 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
     99NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx,
     100                      struct tevent_context *tevent_ctx,
     101                      const char *location,
     102                      bool anon,
     103                      const char *bind_dn,
     104                      const char *bind_secret,
     105                      struct smbldap_state **smbldap_state);
     106
     107void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
     108void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *newblob);
     109void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
     110                      LDAPMod ***mods,
     111                      const char *attribute, const char *newval);
     112void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
     113                           LDAPMod ***mods,
     114                           const char *attribute, const DATA_BLOB *newblob);
     115bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
     116                                   const char *attribute, char *value,
     117                                   int max_len);
     118int smbldap_modify(struct smbldap_state *ldap_state,
     119                   const char *dn,
     120                   LDAPMod *attrs[]);
     121int smbldap_start_tls(LDAP *ldap_struct, int version);
     122int smbldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
    254123int smbldap_search(struct smbldap_state *ldap_state,
    255124                   const char *base, int scope, const char *filter,
     
    271140                           LDAPMessage ** result);
    272141void smbldap_free_struct(struct smbldap_state **ldap_state) ;
    273 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
    274                       const char *location,
    275                       struct smbldap_state **smbldap_state);
    276142bool smbldap_has_control(LDAP *ld, const char *control);
    277143bool smbldap_has_extension(LDAP *ld, const char *extension);
    278144bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
    279145bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
    280 
    281 /* The following definitions come from lib/smbldap_util.c  */
    282 
    283 NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
    284                                     LDAPMessage ** result, const char *domain_name,
    285                                     bool try_add);
     146char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry,
     147                                       const char *attribute,
     148                                       TALLOC_CTX *mem_ctx);
     149char * smbldap_talloc_first_attribute(LDAP *ldap_struct, LDAPMessage *entry,
     150                                      const char *attribute,
     151                                      TALLOC_CTX *mem_ctx);
     152char * smbldap_talloc_smallest_attribute(LDAP *ldap_struct, LDAPMessage *entry,
     153                                         const char *attribute,
     154                                         TALLOC_CTX *mem_ctx);
     155bool smbldap_talloc_single_blob(TALLOC_CTX *mem_ctx, LDAP *ld,
     156                                LDAPMessage *msg, const char *attrib,
     157                                DATA_BLOB *blob);
     158bool smbldap_pull_sid(LDAP *ld, LDAPMessage *msg, const char *attrib,
     159                      struct dom_sid *sid);
     160void smbldap_talloc_autofree_ldapmsg(TALLOC_CTX *mem_ctx, LDAPMessage *result);
     161void smbldap_talloc_autofree_ldapmod(TALLOC_CTX *mem_ctx, LDAPMod **mod);
     162char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld,
     163                              LDAPMessage *entry);
    286164
    287165#endif  /* HAVE_LDAP */
    288166
    289 #define LDAP_DEFAULT_TIMEOUT   15
    290 #define LDAP_CONNECTION_DEFAULT_TIMEOUT 2
    291 #define LDAP_PAGE_SIZE 1024
    292 
    293 #define ADS_PAGE_CTL_OID        "1.2.840.113556.1.4.319"
    294 
    295 /*
    296  * Work around versions of the LDAP client libs that don't have the OIDs
    297  * defined, or have them defined under the old name.
    298  * This functionality is really a factor of the server, not the client
    299  *
    300  */
    301 
    302 #if defined(LDAP_EXOP_X_MODIFY_PASSWD) && !defined(LDAP_EXOP_MODIFY_PASSWD)
    303 #define LDAP_EXOP_MODIFY_PASSWD LDAP_EXOP_X_MODIFY_PASSWD
    304 #elif !defined(LDAP_EXOP_MODIFY_PASSWD)
    305 #define LDAP_EXOP_MODIFY_PASSWD "1.3.6.1.4.1.4203.1.11.1"
    306 #endif
    307 
    308 #if defined(LDAP_EXOP_X_MODIFY_PASSWD_ID) && !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
    309 #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID LDAP_EXOP_X_MODIFY_PASSWD_ID
    310 #elif !defined(LDAP_EXOP_MODIFY_PASSWD_ID)
    311 #define LDAP_TAG_EXOP_MODIFY_PASSWD_ID        ((ber_tag_t) 0x80U)
    312 #endif
    313 
    314 #if defined(LDAP_EXOP_X_MODIFY_PASSWD_NEW) && !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
    315 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW LDAP_EXOP_X_MODIFY_PASSWD_NEW
    316 #elif !defined(LDAP_EXOP_MODIFY_PASSWD_NEW)
    317 #define LDAP_TAG_EXOP_MODIFY_PASSWD_NEW       ((ber_tag_t) 0x82U)
    318 #endif
    319 
    320167#endif  /* _SMBLDAP_H */
  • vendor/current/source3/include/smbprofile.h

    r740 r988  
    11#ifndef _PROFILE_H_
    22#define _PROFILE_H_
    3 /* 
     3/*
    44   Unix SMB/CIFS implementation.
    55   store smbd profiling information in shared memory
     
    1111   the Free Software Foundation; either version 3 of the License, or
    1212   (at your option) any later version.
    13    
     13
    1414   This program is distributed in the hope that it will be useful,
    1515   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1616   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1717   GNU General Public License for more details.
    18    
     18
    1919   You should have received a copy of the GNU General Public License
    2020   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    2222*/
    2323
     24struct tevent_context;
     25
     26#ifdef WITH_PROFILE
     27
     28#define SMBPROFILE_STATS_ALL_SECTIONS \
     29        SMBPROFILE_STATS_START \
     30        \
     31        SMBPROFILE_STATS_SECTION_START(global, "SMBD loop") \
     32        SMBPROFILE_STATS_COUNT(connect) \
     33        SMBPROFILE_STATS_COUNT(disconnect) \
     34        SMBPROFILE_STATS_BASIC(idle) \
     35        SMBPROFILE_STATS_TIME(cpu_user) \
     36        SMBPROFILE_STATS_TIME(cpu_system) \
     37        SMBPROFILE_STATS_COUNT(request) \
     38        SMBPROFILE_STATS_BASIC(push_sec_ctx) \
     39        SMBPROFILE_STATS_BASIC(set_sec_ctx) \
     40        SMBPROFILE_STATS_BASIC(set_root_sec_ctx) \
     41        SMBPROFILE_STATS_BASIC(pop_sec_ctx) \
     42        SMBPROFILE_STATS_SECTION_END \
     43        \
     44        SMBPROFILE_STATS_SECTION_START(syscall, "System Calls") \
     45        SMBPROFILE_STATS_BASIC(syscall_opendir) \
     46        SMBPROFILE_STATS_BASIC(syscall_fdopendir) \
     47        SMBPROFILE_STATS_BASIC(syscall_readdir) \
     48        SMBPROFILE_STATS_BASIC(syscall_seekdir) \
     49        SMBPROFILE_STATS_BASIC(syscall_telldir) \
     50        SMBPROFILE_STATS_BASIC(syscall_rewinddir) \
     51        SMBPROFILE_STATS_BASIC(syscall_mkdir) \
     52        SMBPROFILE_STATS_BASIC(syscall_rmdir) \
     53        SMBPROFILE_STATS_BASIC(syscall_closedir) \
     54        SMBPROFILE_STATS_BASIC(syscall_open) \
     55        SMBPROFILE_STATS_BASIC(syscall_createfile) \
     56        SMBPROFILE_STATS_BASIC(syscall_close) \
     57        SMBPROFILE_STATS_BYTES(syscall_read) \
     58        SMBPROFILE_STATS_BYTES(syscall_pread) \
     59        SMBPROFILE_STATS_BYTES(syscall_asys_pread) \
     60        SMBPROFILE_STATS_BYTES(syscall_write) \
     61        SMBPROFILE_STATS_BYTES(syscall_pwrite) \
     62        SMBPROFILE_STATS_BYTES(syscall_asys_pwrite) \
     63        SMBPROFILE_STATS_BASIC(syscall_lseek) \
     64        SMBPROFILE_STATS_BYTES(syscall_sendfile) \
     65        SMBPROFILE_STATS_BYTES(syscall_recvfile) \
     66        SMBPROFILE_STATS_BASIC(syscall_rename) \
     67        SMBPROFILE_STATS_BASIC(syscall_rename_at) \
     68        SMBPROFILE_STATS_BASIC(syscall_fsync) \
     69        SMBPROFILE_STATS_BASIC(syscall_asys_fsync) \
     70        SMBPROFILE_STATS_BASIC(syscall_stat) \
     71        SMBPROFILE_STATS_BASIC(syscall_fstat) \
     72        SMBPROFILE_STATS_BASIC(syscall_lstat) \
     73        SMBPROFILE_STATS_BASIC(syscall_get_alloc_size) \
     74        SMBPROFILE_STATS_BASIC(syscall_unlink) \
     75        SMBPROFILE_STATS_BASIC(syscall_chmod) \
     76        SMBPROFILE_STATS_BASIC(syscall_fchmod) \
     77        SMBPROFILE_STATS_BASIC(syscall_chown) \
     78        SMBPROFILE_STATS_BASIC(syscall_fchown) \
     79        SMBPROFILE_STATS_BASIC(syscall_lchown) \
     80        SMBPROFILE_STATS_BASIC(syscall_chdir) \
     81        SMBPROFILE_STATS_BASIC(syscall_getwd) \
     82        SMBPROFILE_STATS_BASIC(syscall_ntimes) \
     83        SMBPROFILE_STATS_BASIC(syscall_ftruncate) \
     84        SMBPROFILE_STATS_BASIC(syscall_fallocate) \
     85        SMBPROFILE_STATS_BASIC(syscall_fcntl_lock) \
     86        SMBPROFILE_STATS_BASIC(syscall_kernel_flock) \
     87        SMBPROFILE_STATS_BASIC(syscall_linux_setlease) \
     88        SMBPROFILE_STATS_BASIC(syscall_fcntl_getlock) \
     89        SMBPROFILE_STATS_BASIC(syscall_readlink) \
     90        SMBPROFILE_STATS_BASIC(syscall_symlink) \
     91        SMBPROFILE_STATS_BASIC(syscall_link) \
     92        SMBPROFILE_STATS_BASIC(syscall_mknod) \
     93        SMBPROFILE_STATS_BASIC(syscall_realpath) \
     94        SMBPROFILE_STATS_BASIC(syscall_get_quota) \
     95        SMBPROFILE_STATS_BASIC(syscall_set_quota) \
     96        SMBPROFILE_STATS_BASIC(syscall_get_sd) \
     97        SMBPROFILE_STATS_BASIC(syscall_set_sd) \
     98        SMBPROFILE_STATS_BASIC(syscall_brl_lock) \
     99        SMBPROFILE_STATS_BASIC(syscall_brl_unlock) \
     100        SMBPROFILE_STATS_BASIC(syscall_brl_cancel) \
     101        SMBPROFILE_STATS_SECTION_END \
     102        \
     103        SMBPROFILE_STATS_SECTION_START(acl, "ACL Calls") \
     104        SMBPROFILE_STATS_BASIC(get_nt_acl) \
     105        SMBPROFILE_STATS_BASIC(fget_nt_acl) \
     106        SMBPROFILE_STATS_BASIC(fset_nt_acl) \
     107        SMBPROFILE_STATS_BASIC(chmod_acl) \
     108        SMBPROFILE_STATS_BASIC(fchmod_acl) \
     109        SMBPROFILE_STATS_SECTION_END \
     110        \
     111        SMBPROFILE_STATS_SECTION_START(statcache, "Stat Cache") \
     112        SMBPROFILE_STATS_COUNT(statcache_lookups) \
     113        SMBPROFILE_STATS_COUNT(statcache_misses) \
     114        SMBPROFILE_STATS_COUNT(statcache_hits) \
     115        SMBPROFILE_STATS_SECTION_END \
     116        \
     117        SMBPROFILE_STATS_SECTION_START(writecache, "Write Cache") \
     118        SMBPROFILE_STATS_COUNT(writecache_allocations) \
     119        SMBPROFILE_STATS_COUNT(writecache_deallocations) \
     120        SMBPROFILE_STATS_COUNT(writecache_cached_reads) \
     121        SMBPROFILE_STATS_COUNT(writecache_total_writes) \
     122        SMBPROFILE_STATS_COUNT(writecache_init_writes) \
     123        SMBPROFILE_STATS_COUNT(writecache_abutted_writes) \
     124        SMBPROFILE_STATS_COUNT(writecache_non_oplock_writes) \
     125        SMBPROFILE_STATS_COUNT(writecache_direct_writes) \
     126        SMBPROFILE_STATS_COUNT(writecache_cached_writes) \
     127        SMBPROFILE_STATS_COUNT(writecache_perfect_writes) \
     128        SMBPROFILE_STATS_COUNT(writecache_flush_reason_seek) \
     129        SMBPROFILE_STATS_COUNT(writecache_flush_reason_read) \
     130        SMBPROFILE_STATS_COUNT(writecache_flush_reason_readraw) \
     131        SMBPROFILE_STATS_COUNT(writecache_flush_reason_write) \
     132        SMBPROFILE_STATS_COUNT(writecache_flush_reason_oplock) \
     133        SMBPROFILE_STATS_COUNT(writecache_flush_reason_close) \
     134        SMBPROFILE_STATS_COUNT(writecache_flush_reason_sync) \
     135        SMBPROFILE_STATS_COUNT(writecache_flush_reason_sizechange) \
     136        SMBPROFILE_STATS_SECTION_END \
     137        \
     138        SMBPROFILE_STATS_SECTION_START(SMB, "SMB Calls") \
     139        SMBPROFILE_STATS_BASIC(SMBmkdir) \
     140        SMBPROFILE_STATS_BASIC(SMBrmdir) \
     141        SMBPROFILE_STATS_BASIC(SMBopen) \
     142        SMBPROFILE_STATS_BASIC(SMBcreate) \
     143        SMBPROFILE_STATS_BASIC(SMBclose) \
     144        SMBPROFILE_STATS_BASIC(SMBflush) \
     145        SMBPROFILE_STATS_BASIC(SMBunlink) \
     146        SMBPROFILE_STATS_BASIC(SMBmv) \
     147        SMBPROFILE_STATS_BASIC(SMBgetatr) \
     148        SMBPROFILE_STATS_BASIC(SMBsetatr) \
     149        SMBPROFILE_STATS_BASIC(SMBread) \
     150        SMBPROFILE_STATS_BASIC(SMBwrite) \
     151        SMBPROFILE_STATS_BASIC(SMBlock) \
     152        SMBPROFILE_STATS_BASIC(SMBunlock) \
     153        SMBPROFILE_STATS_BASIC(SMBctemp) \
     154        SMBPROFILE_STATS_BASIC(SMBmknew) \
     155        SMBPROFILE_STATS_BASIC(SMBcheckpath) \
     156        SMBPROFILE_STATS_BASIC(SMBexit) \
     157        SMBPROFILE_STATS_BASIC(SMBlseek) \
     158        SMBPROFILE_STATS_BASIC(SMBlockread) \
     159        SMBPROFILE_STATS_BASIC(SMBwriteunlock) \
     160        SMBPROFILE_STATS_BASIC(SMBreadbraw) \
     161        SMBPROFILE_STATS_BASIC(SMBreadBmpx) \
     162        SMBPROFILE_STATS_BASIC(SMBreadBs) \
     163        SMBPROFILE_STATS_BASIC(SMBwritebraw) \
     164        SMBPROFILE_STATS_BASIC(SMBwriteBmpx) \
     165        SMBPROFILE_STATS_BASIC(SMBwriteBs) \
     166        SMBPROFILE_STATS_BASIC(SMBwritec) \
     167        SMBPROFILE_STATS_BASIC(SMBsetattrE) \
     168        SMBPROFILE_STATS_BASIC(SMBgetattrE) \
     169        SMBPROFILE_STATS_BASIC(SMBlockingX) \
     170        SMBPROFILE_STATS_BASIC(SMBtrans) \
     171        SMBPROFILE_STATS_BASIC(SMBtranss) \
     172        SMBPROFILE_STATS_BASIC(SMBioctl) \
     173        SMBPROFILE_STATS_BASIC(SMBioctls) \
     174        SMBPROFILE_STATS_BASIC(SMBcopy) \
     175        SMBPROFILE_STATS_BASIC(SMBmove) \
     176        SMBPROFILE_STATS_BASIC(SMBecho) \
     177        SMBPROFILE_STATS_BASIC(SMBwriteclose) \
     178        SMBPROFILE_STATS_BASIC(SMBopenX) \
     179        SMBPROFILE_STATS_BASIC(SMBreadX) \
     180        SMBPROFILE_STATS_BASIC(SMBwriteX) \
     181        SMBPROFILE_STATS_BASIC(SMBtrans2) \
     182        SMBPROFILE_STATS_BASIC(SMBtranss2) \
     183        SMBPROFILE_STATS_BASIC(SMBfindclose) \
     184        SMBPROFILE_STATS_BASIC(SMBfindnclose) \
     185        SMBPROFILE_STATS_BASIC(SMBtcon) \
     186        SMBPROFILE_STATS_BASIC(SMBtdis) \
     187        SMBPROFILE_STATS_BASIC(SMBnegprot) \
     188        SMBPROFILE_STATS_BASIC(SMBsesssetupX) \
     189        SMBPROFILE_STATS_BASIC(SMBulogoffX) \
     190        SMBPROFILE_STATS_BASIC(SMBtconX) \
     191        SMBPROFILE_STATS_BASIC(SMBdskattr) \
     192        SMBPROFILE_STATS_BASIC(SMBsearch) \
     193        SMBPROFILE_STATS_BASIC(SMBffirst) \
     194        SMBPROFILE_STATS_BASIC(SMBfunique) \
     195        SMBPROFILE_STATS_BASIC(SMBfclose) \
     196        SMBPROFILE_STATS_BASIC(SMBnttrans) \
     197        SMBPROFILE_STATS_BASIC(SMBnttranss) \
     198        SMBPROFILE_STATS_BASIC(SMBntcreateX) \
     199        SMBPROFILE_STATS_BASIC(SMBntcancel) \
     200        SMBPROFILE_STATS_BASIC(SMBntrename) \
     201        SMBPROFILE_STATS_BASIC(SMBsplopen) \
     202        SMBPROFILE_STATS_BASIC(SMBsplwr) \
     203        SMBPROFILE_STATS_BASIC(SMBsplclose) \
     204        SMBPROFILE_STATS_BASIC(SMBsplretq) \
     205        SMBPROFILE_STATS_BASIC(SMBsends) \
     206        SMBPROFILE_STATS_BASIC(SMBsendb) \
     207        SMBPROFILE_STATS_BASIC(SMBfwdname) \
     208        SMBPROFILE_STATS_BASIC(SMBcancelf) \
     209        SMBPROFILE_STATS_BASIC(SMBgetmac) \
     210        SMBPROFILE_STATS_BASIC(SMBsendstrt) \
     211        SMBPROFILE_STATS_BASIC(SMBsendend) \
     212        SMBPROFILE_STATS_BASIC(SMBsendtxt) \
     213        SMBPROFILE_STATS_BASIC(SMBinvalid) \
     214        SMBPROFILE_STATS_SECTION_END \
     215        \
     216        SMBPROFILE_STATS_SECTION_START(Trans2, "Trans2 Calls") \
     217        SMBPROFILE_STATS_BASIC(Trans2_open) \
     218        SMBPROFILE_STATS_BASIC(Trans2_findfirst) \
     219        SMBPROFILE_STATS_BASIC(Trans2_findnext) \
     220        SMBPROFILE_STATS_BASIC(Trans2_qfsinfo) \
     221        SMBPROFILE_STATS_BASIC(Trans2_setfsinfo) \
     222        SMBPROFILE_STATS_BASIC(Trans2_qpathinfo) \
     223        SMBPROFILE_STATS_BASIC(Trans2_setpathinfo) \
     224        SMBPROFILE_STATS_BASIC(Trans2_qfileinfo) \
     225        SMBPROFILE_STATS_BASIC(Trans2_setfileinfo) \
     226        SMBPROFILE_STATS_BASIC(Trans2_fsctl) \
     227        SMBPROFILE_STATS_BASIC(Trans2_ioctl) \
     228        SMBPROFILE_STATS_BASIC(Trans2_findnotifyfirst) \
     229        SMBPROFILE_STATS_BASIC(Trans2_findnotifynext) \
     230        SMBPROFILE_STATS_BASIC(Trans2_mkdir) \
     231        SMBPROFILE_STATS_BASIC(Trans2_session_setup) \
     232        SMBPROFILE_STATS_BASIC(Trans2_get_dfs_referral) \
     233        SMBPROFILE_STATS_BASIC(Trans2_report_dfs_inconsistancy) \
     234        SMBPROFILE_STATS_SECTION_END \
     235        \
     236        SMBPROFILE_STATS_SECTION_START(NT_transact, "NT Transact Calls") \
     237        SMBPROFILE_STATS_BASIC(NT_transact_create) \
     238        SMBPROFILE_STATS_BASIC(NT_transact_ioctl) \
     239        SMBPROFILE_STATS_BASIC(NT_transact_set_security_desc) \
     240        SMBPROFILE_STATS_BASIC(NT_transact_notify_change) \
     241        SMBPROFILE_STATS_BASIC(NT_transact_rename) \
     242        SMBPROFILE_STATS_BASIC(NT_transact_query_security_desc) \
     243        SMBPROFILE_STATS_BASIC(NT_transact_get_user_quota) \
     244        SMBPROFILE_STATS_BASIC(NT_transact_set_user_quota) \
     245        SMBPROFILE_STATS_SECTION_END \
     246        \
     247        SMBPROFILE_STATS_SECTION_START(smb2, "SMB2 Calls") \
     248        SMBPROFILE_STATS_IOBYTES(smb2_negprot) \
     249        SMBPROFILE_STATS_IOBYTES(smb2_sesssetup) \
     250        SMBPROFILE_STATS_IOBYTES(smb2_logoff) \
     251        SMBPROFILE_STATS_IOBYTES(smb2_tcon) \
     252        SMBPROFILE_STATS_IOBYTES(smb2_tdis) \
     253        SMBPROFILE_STATS_IOBYTES(smb2_create) \
     254        SMBPROFILE_STATS_IOBYTES(smb2_close) \
     255        SMBPROFILE_STATS_IOBYTES(smb2_flush) \
     256        SMBPROFILE_STATS_IOBYTES(smb2_read) \
     257        SMBPROFILE_STATS_IOBYTES(smb2_write) \
     258        SMBPROFILE_STATS_IOBYTES(smb2_lock) \
     259        SMBPROFILE_STATS_IOBYTES(smb2_ioctl) \
     260        SMBPROFILE_STATS_IOBYTES(smb2_cancel) \
     261        SMBPROFILE_STATS_IOBYTES(smb2_keepalive) \
     262        SMBPROFILE_STATS_IOBYTES(smb2_find) \
     263        SMBPROFILE_STATS_IOBYTES(smb2_notify) \
     264        SMBPROFILE_STATS_IOBYTES(smb2_getinfo) \
     265        SMBPROFILE_STATS_IOBYTES(smb2_setinfo) \
     266        SMBPROFILE_STATS_IOBYTES(smb2_break) \
     267        SMBPROFILE_STATS_SECTION_END \
     268        \
     269        SMBPROFILE_STATS_END
     270
    24271/* this file defines the profile structure in the profile shared
    25272   memory area */
    26273
    27 #define PROF_SHMEM_KEY ((key_t)0x07021999)
    28 #define PROF_SHM_MAGIC 0x6349985
    29 #define PROF_SHM_VERSION 12
    30 
    31274/* time values in the following structure are in microseconds */
    32275
    33 #define __profile_stats_value(which, domain) domain[which]
    34 
    35 enum profile_stats_values
     276struct smbprofile_stats_count {
     277        uint64_t count;         /* number of events */
     278};
     279
     280struct smbprofile_stats_time {
     281        uint64_t time;          /* microseconds */
     282};
     283
     284struct smbprofile_stats_time_async {
     285        uint64_t start;
     286        struct smbprofile_stats_time *stats;
     287};
     288
     289struct smbprofile_stats_basic {
     290        uint64_t count;         /* number of events */
     291        uint64_t time;          /* microseconds */
     292};
     293
     294struct smbprofile_stats_basic_async {
     295        uint64_t start;
     296        struct smbprofile_stats_basic *stats;
     297};
     298
     299struct smbprofile_stats_bytes {
     300        uint64_t count;         /* number of events */
     301        uint64_t time;          /* microseconds */
     302        uint64_t idle;          /* idle time compared to 'time' microseconds */
     303        uint64_t bytes;         /* bytes */
     304};
     305
     306struct smbprofile_stats_bytes_async {
     307        uint64_t start;
     308        uint64_t idle_start;
     309        uint64_t idle_time;
     310        struct smbprofile_stats_bytes *stats;
     311};
     312
     313struct smbprofile_stats_iobytes {
     314        uint64_t count;         /* number of events */
     315        uint64_t time;          /* microseconds */
     316        uint64_t idle;          /* idle time compared to 'time' microseconds */
     317        uint64_t inbytes;       /* bytes read */
     318        uint64_t outbytes;      /* bytes written */
     319};
     320
     321struct smbprofile_stats_iobytes_async {
     322        uint64_t start;
     323        uint64_t idle_start;
     324        uint64_t idle_time;
     325        struct smbprofile_stats_iobytes *stats;
     326};
     327
     328struct profile_stats {
     329        uint64_t magic;
     330        struct {
     331#define SMBPROFILE_STATS_START
     332#define SMBPROFILE_STATS_SECTION_START(name, display)
     333#define SMBPROFILE_STATS_COUNT(name) \
     334        struct smbprofile_stats_count name##_stats;
     335#define SMBPROFILE_STATS_TIME(name) \
     336        struct smbprofile_stats_time name##_stats;
     337#define SMBPROFILE_STATS_BASIC(name) \
     338        struct smbprofile_stats_basic name##_stats;
     339#define SMBPROFILE_STATS_BYTES(name) \
     340        struct smbprofile_stats_bytes name##_stats;
     341#define SMBPROFILE_STATS_IOBYTES(name) \
     342        struct smbprofile_stats_iobytes name##_stats;
     343#define SMBPROFILE_STATS_SECTION_END
     344#define SMBPROFILE_STATS_END
     345        SMBPROFILE_STATS_ALL_SECTIONS
     346#undef SMBPROFILE_STATS_START
     347#undef SMBPROFILE_STATS_SECTION_START
     348#undef SMBPROFILE_STATS_COUNT
     349#undef SMBPROFILE_STATS_TIME
     350#undef SMBPROFILE_STATS_BASIC
     351#undef SMBPROFILE_STATS_BYTES
     352#undef SMBPROFILE_STATS_IOBYTES
     353#undef SMBPROFILE_STATS_SECTION_END
     354#undef SMBPROFILE_STATS_END
     355        } values;
     356};
     357
     358#define _SMBPROFILE_COUNT_INCREMENT(_stats, _area, _v) do { \
     359        if (smbprofile_state.config.do_count) { \
     360                (_area)->values._stats.count += (_v); \
     361                smbprofile_dump_schedule(); \
     362        } \
     363} while(0)
     364#define SMBPROFILE_COUNT_INCREMENT(_name, _area, _v) \
     365        _SMBPROFILE_COUNT_INCREMENT(_name##_stats, _area, _v)
     366
     367#define SMBPROFILE_TIME_ASYNC_STATE(_async_name) \
     368        struct smbprofile_stats_time_async _async_name;
     369#define _SMBPROFILE_TIME_ASYNC_START(_stats, _area, _async) do { \
     370        (_async) = (struct smbprofile_stats_time_async) {}; \
     371        if (smbprofile_state.config.do_times) { \
     372                (_async).stats = &((_area)->values._stats), \
     373                (_async).start = profile_timestamp(); \
     374        } \
     375} while(0)
     376#define SMBPROFILE_TIME_ASYNC_START(_name, _area, _async) \
     377        _SMBPROFILE_TIME_ASYNC_START(_name##_stats, _area, _async)
     378#define SMBPROFILE_TIME_ASYNC_END(_async) do { \
     379        if ((_async).start != 0) { \
     380                (_async).stats->time += profile_timestamp() - (_async).start; \
     381                (_async) = (struct smbprofile_stats_basic_async) {}; \
     382                smbprofile_dump_schedule(); \
     383        } \
     384} while(0)
     385
     386#define SMBPROFILE_BASIC_ASYNC_STATE(_async_name) \
     387        struct smbprofile_stats_basic_async _async_name;
     388#define _SMBPROFILE_BASIC_ASYNC_START(_stats, _area, _async) do { \
     389        (_async) = (struct smbprofile_stats_basic_async) {}; \
     390        if (smbprofile_state.config.do_count) { \
     391                if (smbprofile_state.config.do_times) { \
     392                        (_async).start = profile_timestamp(); \
     393                        (_async).stats = &((_area)->values._stats); \
     394                } \
     395                (_area)->values._stats.count += 1; \
     396                smbprofile_dump_schedule(); \
     397        } \
     398} while(0)
     399#define SMBPROFILE_BASIC_ASYNC_START(_name, _area, _async) \
     400        _SMBPROFILE_BASIC_ASYNC_START(_name##_stats, _area, _async)
     401#define SMBPROFILE_BASIC_ASYNC_END(_async) do { \
     402        if ((_async).start != 0) { \
     403                (_async).stats->time += profile_timestamp() - (_async).start; \
     404                (_async) = (struct smbprofile_stats_basic_async) {}; \
     405                smbprofile_dump_schedule(); \
     406        } \
     407} while(0)
     408
     409#define _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async) do { \
     410        (_async).stats = &((_area)->values._stats); \
     411        if (smbprofile_state.config.do_times) { \
     412                (_async).start = profile_timestamp(); \
     413        } \
     414} while(0)
     415#define _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async) do { \
     416        if ((_async).start != 0) { \
     417                if ((_async).idle_start == 0) { \
     418                        (_async).idle_start = profile_timestamp(); \
     419                } \
     420        } \
     421} while(0)
     422#define _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async) do { \
     423        if ((_async).idle_start != 0) { \
     424                (_async).idle_time += \
     425                        profile_timestamp() - (_async).idle_start; \
     426                (_async).idle_start = 0; \
     427        } \
     428} while(0)
     429#define _SMBPROFILE_TIMER_ASYNC_END(_async) do { \
     430        if ((_async).start != 0) { \
     431                _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async); \
     432                (_async).stats->time += profile_timestamp() - (_async).start; \
     433                (_async).stats->idle += (_async).idle_time; \
     434        } \
     435} while(0)
     436
     437#define SMBPROFILE_BYTES_ASYNC_STATE(_async_name) \
     438        struct smbprofile_stats_bytes_async _async_name;
     439#define _SMBPROFILE_BYTES_ASYNC_START(_stats, _area, _async, _bytes) do { \
     440        (_async) = (struct smbprofile_stats_bytes_async) {}; \
     441        if (smbprofile_state.config.do_count) { \
     442                _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async); \
     443                (_area)->values._stats.count += 1; \
     444                (_area)->values._stats.bytes += (_bytes); \
     445                smbprofile_dump_schedule(); \
     446        } \
     447} while(0)
     448#define SMBPROFILE_BYTES_ASYNC_START(_name, _area, _async, _bytes) \
     449        _SMBPROFILE_BYTES_ASYNC_START(_name##_stats, _area, _async, _bytes)
     450#define SMBPROFILE_BYTES_ASYNC_SET_IDLE(_async) \
     451        _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async)
     452#define SMBPROFILE_BYTES_ASYNC_SET_BUSY(_async) \
     453        _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async)
     454#define SMBPROFILE_BYTES_ASYNC_END(_async) do { \
     455        if ((_async).stats != NULL) { \
     456                _SMBPROFILE_TIMER_ASYNC_END(_async); \
     457                (_async) = (struct smbprofile_stats_bytes_async) {}; \
     458                smbprofile_dump_schedule(); \
     459        } \
     460} while(0)
     461
     462#define SMBPROFILE_IOBYTES_ASYNC_STATE(_async_name) \
     463        struct smbprofile_stats_iobytes_async _async_name;
     464#define _SMBPROFILE_IOBYTES_ASYNC_START(_stats, _area, _async, _inbytes) do { \
     465        (_async) = (struct smbprofile_stats_iobytes_async) {}; \
     466        if (smbprofile_state.config.do_count) { \
     467                _SMBPROFILE_TIMER_ASYNC_START(_stats, _area, _async); \
     468                (_area)->values._stats.count += 1; \
     469                (_area)->values._stats.inbytes += (_inbytes); \
     470                smbprofile_dump_schedule(); \
     471        } \
     472} while(0)
     473#define SMBPROFILE_IOBYTES_ASYNC_START(_name, _area, _async, _inbytes) \
     474        _SMBPROFILE_IOBYTES_ASYNC_START(_name##_stats, _area, _async, _inbytes)
     475#define SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(_async) \
     476        _SMBPROFILE_TIMER_ASYNC_SET_IDLE(_async)
     477#define SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(_async) \
     478        _SMBPROFILE_TIMER_ASYNC_SET_BUSY(_async)
     479#define SMBPROFILE_IOBYTES_ASYNC_END(_async, _outbytes) do { \
     480        if ((_async).stats != NULL) { \
     481                (_async).stats->outbytes += (_outbytes); \
     482                _SMBPROFILE_TIMER_ASYNC_END(_async); \
     483                (_async) = (struct smbprofile_stats_iobytes_async) {}; \
     484                smbprofile_dump_schedule(); \
     485        } \
     486} while(0)
     487
     488extern struct profile_stats *profile_p;
     489
     490struct smbprofile_global_state {
     491        struct {
     492                struct tdb_wrap *db;
     493                struct tevent_context *ev;
     494                struct tevent_timer *te;
     495        } internal;
     496
     497        struct {
     498                bool do_count;
     499                bool do_times;
     500        } config;
     501
     502        struct {
     503                struct profile_stats global;
     504        } stats;
     505};
     506
     507extern struct smbprofile_global_state smbprofile_state;
     508
     509void smbprofile_dump_schedule_timer(void);
     510void smbprofile_dump_setup(struct tevent_context *ev);
     511
     512static inline void smbprofile_dump_schedule(void)
    36513{
    37         PR_VALUE_SMBD_IDLE = 0,
    38 #define smbd_idle_count __profile_stats_value(PR_VALUE_SMBD_IDLE, count)
    39 #define smbd_idle_time __profile_stats_value(PR_VALUE_SMBD_IDLE, time)
    40 
    41 /* system call counters */
    42         PR_VALUE_SYSCALL_OPENDIR,
    43 #define syscall_opendir_count __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, count)
    44 #define syscall_opendir_time __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, time)
    45 
    46         PR_VALUE_SYSCALL_FDOPENDIR,
    47 #define syscall_fdopendir_count __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, count)
    48 #define syscall_fdopendir_time __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, time)
    49 
    50         PR_VALUE_SYSCALL_READDIR,
    51 #define syscall_readdir_count __profile_stats_value(PR_VALUE_SYSCALL_READDIR, count)
    52 #define syscall_readdir_time __profile_stats_value(PR_VALUE_SYSCALL_READDIR, time)
    53 
    54         PR_VALUE_SYSCALL_SEEKDIR,
    55 #define syscall_seekdir_count __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, count)
    56 #define syscall_seekdir_time __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, time)
    57 
    58         PR_VALUE_SYSCALL_TELLDIR,
    59 #define syscall_telldir_count __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, count)
    60 #define syscall_telldir_time __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, time)
    61 
    62         PR_VALUE_SYSCALL_REWINDDIR,
    63 #define syscall_rewinddir_count __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, count)
    64 #define syscall_rewinddir_time __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, time)
    65 
    66         PR_VALUE_SYSCALL_MKDIR,
    67 #define syscall_mkdir_count __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, count)
    68 #define syscall_mkdir_time __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, time)
    69 
    70         PR_VALUE_SYSCALL_RMDIR,
    71 #define syscall_rmdir_count __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, count)
    72 #define syscall_rmdir_time __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, time)
    73 
    74         PR_VALUE_SYSCALL_CLOSEDIR,
    75 #define syscall_closedir_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, count)
    76 #define syscall_closedir_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, time)
    77 
    78         PR_VALUE_SYSCALL_OPEN,
    79 #define syscall_open_count __profile_stats_value(PR_VALUE_SYSCALL_OPEN, count)
    80 #define syscall_open_time __profile_stats_value(PR_VALUE_SYSCALL_OPEN, time)
    81 
    82         PR_VALUE_SYSCALL_CREATEFILE,
    83 #define syscall_createfile_count __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, count)
    84 #define syscall_createfile_time __profile_stats_value(PR_VALUE_SYSCALL_CREATEFILE, time)
    85 
    86         PR_VALUE_SYSCALL_CLOSE,
    87 #define syscall_close_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, count)
    88 #define syscall_close_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, time)
    89 
    90         PR_VALUE_SYSCALL_READ,
    91 #define syscall_read_count __profile_stats_value(PR_VALUE_SYSCALL_READ, count)
    92 #define syscall_read_time __profile_stats_value(PR_VALUE_SYSCALL_READ, time)
    93 
    94         PR_VALUE_SYSCALL_PREAD,
    95 #define syscall_pread_count __profile_stats_value(PR_VALUE_SYSCALL_PREAD, count)
    96 #define syscall_pread_time __profile_stats_value(PR_VALUE_SYSCALL_PREAD, time)
    97 
    98         PR_VALUE_SYSCALL_WRITE,
    99 #define syscall_write_count __profile_stats_value(PR_VALUE_SYSCALL_WRITE, count)
    100 #define syscall_write_time __profile_stats_value(PR_VALUE_SYSCALL_WRITE, time)
    101 
    102         PR_VALUE_SYSCALL_PWRITE,
    103 #define syscall_pwrite_count __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, count)
    104 #define syscall_pwrite_time __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, time)
    105 
    106         PR_VALUE_SYSCALL_LSEEK,
    107 #define syscall_lseek_count __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, count)
    108 #define syscall_lseek_time __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, time)
    109 
    110         PR_VALUE_SYSCALL_SENDFILE,
    111 #define syscall_sendfile_count __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, count)
    112 #define syscall_sendfile_time __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, time)
    113 
    114         PR_VALUE_SYSCALL_RECVFILE,
    115 #define syscall_recvfile_count __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, count)
    116 #define syscall_recvfile_time __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, time)
    117 
    118         PR_VALUE_SYSCALL_RENAME,
    119 #define syscall_rename_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME, count)
    120 #define syscall_rename_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME, time)
    121 
    122         PR_VALUE_SYSCALL_RENAME_AT,
    123 #define syscall_rename_at_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, count)
    124 #define syscall_rename_at_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME_AT, time)
    125 
    126         PR_VALUE_SYSCALL_FSYNC,
    127 #define syscall_fsync_count __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, count)
    128 #define syscall_fsync_time __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, time)
    129 
    130         PR_VALUE_SYSCALL_STAT,
    131 #define syscall_stat_count __profile_stats_value(PR_VALUE_SYSCALL_STAT, count)
    132 #define syscall_stat_time __profile_stats_value(PR_VALUE_SYSCALL_STAT, time)
    133 
    134         PR_VALUE_SYSCALL_FSTAT,
    135 #define syscall_fstat_count __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, count)
    136 #define syscall_fstat_time __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, time)
    137 
    138         PR_VALUE_SYSCALL_LSTAT,
    139 #define syscall_lstat_count __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, count)
    140 #define syscall_lstat_time __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, time)
    141 
    142         PR_VALUE_SYSCALL_GET_ALLOC_SIZE,
    143 #define syscall_get_alloc_size_count __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, count)
    144 #define syscall_get_alloc_size_time __profile_stats_value(PR_VALUE_SYSCALL_GET_ALLOC_SIZE, time)
    145 
    146         PR_VALUE_SYSCALL_UNLINK,
    147 #define syscall_unlink_count __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, count)
    148 #define syscall_unlink_time __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, time)
    149 
    150         PR_VALUE_SYSCALL_CHMOD,
    151 #define syscall_chmod_count __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, count)
    152 #define syscall_chmod_time __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, time)
    153 
    154         PR_VALUE_SYSCALL_FCHMOD,
    155 #define syscall_fchmod_count __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, count)
    156 #define syscall_fchmod_time __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, time)
    157 
    158         PR_VALUE_SYSCALL_CHOWN,
    159 #define syscall_chown_count __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, count)
    160 #define syscall_chown_time __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, time)
    161 
    162         PR_VALUE_SYSCALL_FCHOWN,
    163 #define syscall_fchown_count __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, count)
    164 #define syscall_fchown_time __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, time)
    165 
    166         PR_VALUE_SYSCALL_LCHOWN,
    167 #define syscall_lchown_count __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, count)
    168 #define syscall_lchown_time __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, time)
    169 
    170         PR_VALUE_SYSCALL_CHDIR,
    171 #define syscall_chdir_count __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, count)
    172 #define syscall_chdir_time __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, time)
    173 
    174         PR_VALUE_SYSCALL_GETWD,
    175 #define syscall_getwd_count __profile_stats_value(PR_VALUE_SYSCALL_GETWD, count)
    176 #define syscall_getwd_time __profile_stats_value(PR_VALUE_SYSCALL_GETWD, time)
    177 
    178         PR_VALUE_SYSCALL_NTIMES,
    179 #define syscall_ntimes_count __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, count)
    180 #define syscall_ntimes_time __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, time)
    181 
    182         PR_VALUE_SYSCALL_FTRUNCATE,
    183 #define syscall_ftruncate_count __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, count)
    184 #define syscall_ftruncate_time __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, time)
    185 
    186         PR_VALUE_SYSCALL_FALLOCATE,
    187 #define syscall_fallocate_count __profile_stats_value(PR_VALUE_SYSCALL_FALLOCATE, count)
    188 #define syscall_fallocate_time __profile_stats_value(PR_VALUE_SYSCALL_FALLOCATE, time)
    189 
    190         PR_VALUE_SYSCALL_FCNTL_LOCK,
    191 #define syscall_fcntl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, count)
    192 #define syscall_fcntl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, time)
    193 
    194         PR_VALUE_SYSCALL_KERNEL_FLOCK,
    195 #define syscall_kernel_flock_count __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, count)
    196 #define syscall_kernel_flock_time __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, time)
    197 
    198         PR_VALUE_SYSCALL_LINUX_SETLEASE,
    199 #define syscall_linux_setlease_count __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, count)
    200 #define syscall_linux_setlease_time __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, time)
    201 
    202         PR_VALUE_SYSCALL_FCNTL_GETLOCK,
    203 #define syscall_fcntl_getlock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, count)
    204 #define syscall_fcntl_getlock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, time)
    205 
    206         PR_VALUE_SYSCALL_READLINK,
    207 #define syscall_readlink_count __profile_stats_value(PR_VALUE_SYSCALL_READLINK, count)
    208 #define syscall_readlink_time __profile_stats_value(PR_VALUE_SYSCALL_READLINK, time)
    209 
    210         PR_VALUE_SYSCALL_SYMLINK,
    211 #define syscall_symlink_count __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, count)
    212 #define syscall_symlink_time __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, time)
    213 
    214         PR_VALUE_SYSCALL_LINK,
    215 #define syscall_link_count __profile_stats_value(PR_VALUE_SYSCALL_LINK, count)
    216 #define syscall_link_time __profile_stats_value(PR_VALUE_SYSCALL_LINK, time)
    217 
    218         PR_VALUE_SYSCALL_MKNOD,
    219 #define syscall_mknod_count __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, count)
    220 #define syscall_mknod_time __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, time)
    221 
    222         PR_VALUE_SYSCALL_REALPATH,
    223 #define syscall_realpath_count __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, count)
    224 #define syscall_realpath_time __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, time)
    225 
    226         PR_VALUE_SYSCALL_GET_QUOTA,
    227 #define syscall_get_quota_count __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, count)
    228 #define syscall_get_quota_time __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, time)
    229 
    230         PR_VALUE_SYSCALL_SET_QUOTA,
    231 #define syscall_set_quota_count __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, count)
    232 #define syscall_set_quota_time __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, time)
    233 
    234         PR_VALUE_SYSCALL_GET_SD,
    235 #define syscall_get_sd_count __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, count)
    236 #define syscall_get_sd_time __profile_stats_value(PR_VALUE_SYSCALL_GET_SD, time)
    237 
    238         PR_VALUE_SYSCALL_SET_SD,
    239 #define syscall_set_sd_count __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, count)
    240 #define syscall_set_sd_time __profile_stats_value(PR_VALUE_SYSCALL_SET_SD, time)
    241 
    242         PR_VALUE_SYSCALL_BRL_LOCK,
    243 #define syscall_brl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, count)
    244 #define syscall_brl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_LOCK, time)
    245 
    246         PR_VALUE_SYSCALL_BRL_UNLOCK,
    247 #define syscall_brl_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, count)
    248 #define syscall_brl_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_UNLOCK, time)
    249 
    250         PR_VALUE_SYSCALL_BRL_CANCEL,
    251 #define syscall_brl_cancel_count __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, count)
    252 #define syscall_brl_cancel_time __profile_stats_value(PR_VALUE_SYSCALL_BRL_CANCEL, time)
    253 
    254         PR_VALUE_SYSCALL_STRICT_LOCK,
    255 #define syscall_strict_lock_count __profile_stats_value(PR_VALUE_SYSCALL_STRICT_LOCK, count)
    256 #define syscall_strict_lock_time __profile_stats_value(PR_VALUE_SYSCALL_STRICT_LOCK, time)
    257 
    258         PR_VALUE_SYSCALL_STRICT_UNLOCK,
    259 #define syscall_strict_unlock_count __profile_stats_value(PR_VALUE_SYSCALL_STRICT_UNLOCK, count)
    260 #define syscall_strict_unlock_time __profile_stats_value(PR_VALUE_SYSCALL_STRICT_UNLOCK, time)
    261 
    262 /* counters for individual SMB types */
    263         PR_VALUE_SMBMKDIR,
    264 #define SMBmkdir_count __profile_stats_value(PR_VALUE_SMBMKDIR, count)
    265 #define SMBmkdir_time __profile_stats_value(PR_VALUE_SMBMKDIR, time)
    266 
    267         PR_VALUE_SMBRMDIR,
    268 #define SMBrmdir_count __profile_stats_value(PR_VALUE_SMBRMDIR, count)
    269 #define SMBrmdir_time __profile_stats_value(PR_VALUE_SMBRMDIR, time)
    270 
    271         PR_VALUE_SMBOPEN,
    272 #define SMBopen_count __profile_stats_value(PR_VALUE_SMBOPEN, count)
    273 #define SMBopen_time __profile_stats_value(PR_VALUE_SMBOPEN, time)
    274 
    275         PR_VALUE_SMBCREATE,
    276 #define SMBcreate_count __profile_stats_value(PR_VALUE_SMBCREATE, count)
    277 #define SMBcreate_time __profile_stats_value(PR_VALUE_SMBCREATE, time)
    278 
    279         PR_VALUE_SMBCLOSE,
    280 #define SMBclose_count __profile_stats_value(PR_VALUE_SMBCLOSE, count)
    281 #define SMBclose_time __profile_stats_value(PR_VALUE_SMBCLOSE, time)
    282 
    283         PR_VALUE_SMBFLUSH,
    284 #define SMBflush_count __profile_stats_value(PR_VALUE_SMBFLUSH, count)
    285 #define SMBflush_time __profile_stats_value(PR_VALUE_SMBFLUSH, time)
    286 
    287         PR_VALUE_SMBUNLINK,
    288 #define SMBunlink_count __profile_stats_value(PR_VALUE_SMBUNLINK, count)
    289 #define SMBunlink_time __profile_stats_value(PR_VALUE_SMBUNLINK, time)
    290 
    291         PR_VALUE_SMBMV,
    292 #define SMBmv_count __profile_stats_value(PR_VALUE_SMBMV, count)
    293 #define SMBmv_time __profile_stats_value(PR_VALUE_SMBMV, time)
    294 
    295         PR_VALUE_SMBGETATR,
    296 #define SMBgetatr_count __profile_stats_value(PR_VALUE_SMBGETATR, count)
    297 #define SMBgetatr_time __profile_stats_value(PR_VALUE_SMBGETATR, time)
    298 
    299         PR_VALUE_SMBSETATR,
    300 #define SMBsetatr_count __profile_stats_value(PR_VALUE_SMBSETATR, count)
    301 #define SMBsetatr_time __profile_stats_value(PR_VALUE_SMBSETATR, time)
    302 
    303         PR_VALUE_SMBREAD,
    304 #define SMBread_count __profile_stats_value(PR_VALUE_SMBREAD, count)
    305 #define SMBread_time __profile_stats_value(PR_VALUE_SMBREAD, time)
    306 
    307         PR_VALUE_SMBWRITE,
    308 #define SMBwrite_count __profile_stats_value(PR_VALUE_SMBWRITE, count)
    309 #define SMBwrite_time __profile_stats_value(PR_VALUE_SMBWRITE, time)
    310 
    311         PR_VALUE_SMBLOCK,
    312 #define SMBlock_count __profile_stats_value(PR_VALUE_SMBLOCK, count)
    313 #define SMBlock_time __profile_stats_value(PR_VALUE_SMBLOCK, time)
    314 
    315         PR_VALUE_SMBUNLOCK,
    316 #define SMBunlock_count __profile_stats_value(PR_VALUE_SMBUNLOCK, count)
    317 #define SMBunlock_time __profile_stats_value(PR_VALUE_SMBUNLOCK, time)
    318 
    319         PR_VALUE_SMBCTEMP,
    320 #define SMBctemp_count __profile_stats_value(PR_VALUE_SMBCTEMP, count)
    321 #define SMBctemp_time __profile_stats_value(PR_VALUE_SMBCTEMP, time)
    322 
    323         /* SMBmknew stats are currently combined with SMBcreate */
    324         PR_VALUE_SMBMKNEW,
    325 #define SMBmknew_count __profile_stats_value(PR_VALUE_SMBMKNEW, count)
    326 #define SMBmknew_time __profile_stats_value(PR_VALUE_SMBMKNEW, time)
    327 
    328         PR_VALUE_SMBCHECKPATH,
    329 #define SMBcheckpath_count __profile_stats_value(PR_VALUE_SMBCHECKPATH, count)
    330 #define SMBcheckpath_time __profile_stats_value(PR_VALUE_SMBCHECKPATH, time)
    331 
    332         PR_VALUE_SMBEXIT,
    333 #define SMBexit_count __profile_stats_value(PR_VALUE_SMBEXIT, count)
    334 #define SMBexit_time __profile_stats_value(PR_VALUE_SMBEXIT, time)
    335 
    336         PR_VALUE_SMBLSEEK,
    337 #define SMBlseek_count __profile_stats_value(PR_VALUE_SMBLSEEK, count)
    338 #define SMBlseek_time __profile_stats_value(PR_VALUE_SMBLSEEK, time)
    339 
    340         PR_VALUE_SMBLOCKREAD,
    341 #define SMBlockread_count __profile_stats_value(PR_VALUE_SMBLOCKREAD, count)
    342 #define SMBlockread_time __profile_stats_value(PR_VALUE_SMBLOCKREAD, time)
    343 
    344         PR_VALUE_SMBWRITEUNLOCK,
    345 #define SMBwriteunlock_count __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, count)
    346 #define SMBwriteunlock_time __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, time)
    347 
    348         PR_VALUE_SMBREADBRAW,
    349 #define SMBreadbraw_count __profile_stats_value(PR_VALUE_SMBREADBRAW, count)
    350 #define SMBreadbraw_time __profile_stats_value(PR_VALUE_SMBREADBRAW, time)
    351 
    352         PR_VALUE_SMBREADBMPX,
    353 #define SMBreadBmpx_count __profile_stats_value(PR_VALUE_SMBREADBMPX, count)
    354 #define SMBreadBmpx_time __profile_stats_value(PR_VALUE_SMBREADBMPX, time)
    355 
    356         PR_VALUE_SMBREADBS,
    357 #define SMBreadBs_count __profile_stats_value(PR_VALUE_SMBREADBS, count)
    358 #define SMBreadBs_time __profile_stats_value(PR_VALUE_SMBREADBS, time)
    359 
    360         PR_VALUE_SMBWRITEBRAW,
    361 #define SMBwritebraw_count __profile_stats_value(PR_VALUE_SMBWRITEBRAW, count)
    362 #define SMBwritebraw_time __profile_stats_value(PR_VALUE_SMBWRITEBRAW, time)
    363 
    364         PR_VALUE_SMBWRITEBMPX,
    365 #define SMBwriteBmpx_count __profile_stats_value(PR_VALUE_SMBWRITEBMPX, count)
    366 #define SMBwriteBmpx_time __profile_stats_value(PR_VALUE_SMBWRITEBMPX, time)
    367 
    368         PR_VALUE_SMBWRITEBS,
    369 #define SMBwriteBs_count __profile_stats_value(PR_VALUE_SMBWRITEBS, count)
    370 #define SMBwriteBs_time __profile_stats_value(PR_VALUE_SMBWRITEBS, time)
    371 
    372         PR_VALUE_SMBWRITEC,
    373 #define SMBwritec_count __profile_stats_value(PR_VALUE_SMBWRITEC, count)
    374 #define SMBwritec_time __profile_stats_value(PR_VALUE_SMBWRITEC, time)
    375 
    376         PR_VALUE_SMBSETATTRE,
    377 #define SMBsetattrE_count __profile_stats_value(PR_VALUE_SMBSETATTRE, count)
    378 #define SMBsetattrE_time __profile_stats_value(PR_VALUE_SMBSETATTRE, time)
    379 
    380         PR_VALUE_SMBGETATTRE,
    381 #define SMBgetattrE_count __profile_stats_value(PR_VALUE_SMBGETATTRE, count)
    382 #define SMBgetattrE_time __profile_stats_value(PR_VALUE_SMBGETATTRE, time)
    383 
    384         PR_VALUE_SMBLOCKINGX,
    385 #define SMBlockingX_count __profile_stats_value(PR_VALUE_SMBLOCKINGX, count)
    386 #define SMBlockingX_time __profile_stats_value(PR_VALUE_SMBLOCKINGX, time)
    387 
    388         PR_VALUE_SMBTRANS,
    389 #define SMBtrans_count __profile_stats_value(PR_VALUE_SMBTRANS, count)
    390 #define SMBtrans_time __profile_stats_value(PR_VALUE_SMBTRANS, time)
    391 
    392         PR_VALUE_SMBTRANSS,
    393 #define SMBtranss_count __profile_stats_value(PR_VALUE_SMBTRANSS, count)
    394 #define SMBtranss_time __profile_stats_value(PR_VALUE_SMBTRANSS, time)
    395 
    396         PR_VALUE_SMBIOCTL,
    397 #define SMBioctl_count __profile_stats_value(PR_VALUE_SMBIOCTL, count)
    398 #define SMBioctl_time __profile_stats_value(PR_VALUE_SMBIOCTL, time)
    399 
    400         PR_VALUE_SMBIOCTLS,
    401 #define SMBioctls_count __profile_stats_value(PR_VALUE_SMBIOCTLS, count)
    402 #define SMBioctls_time __profile_stats_value(PR_VALUE_SMBIOCTLS, time)
    403 
    404         PR_VALUE_SMBCOPY,
    405 #define SMBcopy_count __profile_stats_value(PR_VALUE_SMBCOPY, count)
    406 #define SMBcopy_time __profile_stats_value(PR_VALUE_SMBCOPY, time)
    407 
    408         PR_VALUE_SMBMOVE,
    409 #define SMBmove_count __profile_stats_value(PR_VALUE_SMBMOVE, count)
    410 #define SMBmove_time __profile_stats_value(PR_VALUE_SMBMOVE, time)
    411 
    412         PR_VALUE_SMBECHO,
    413 #define SMBecho_count __profile_stats_value(PR_VALUE_SMBECHO, count)
    414 #define SMBecho_time __profile_stats_value(PR_VALUE_SMBECHO, time)
    415 
    416         PR_VALUE_SMBWRITECLOSE,
    417 #define SMBwriteclose_count __profile_stats_value(PR_VALUE_SMBWRITECLOSE, count)
    418 #define SMBwriteclose_time __profile_stats_value(PR_VALUE_SMBWRITECLOSE, time)
    419 
    420         PR_VALUE_SMBOPENX,
    421 #define SMBopenX_count __profile_stats_value(PR_VALUE_SMBOPENX, count)
    422 #define SMBopenX_time __profile_stats_value(PR_VALUE_SMBOPENX, time)
    423 
    424         PR_VALUE_SMBREADX,
    425 #define SMBreadX_count __profile_stats_value(PR_VALUE_SMBREADX, count)
    426 #define SMBreadX_time __profile_stats_value(PR_VALUE_SMBREADX, time)
    427 
    428         PR_VALUE_SMBWRITEX,
    429 #define SMBwriteX_count __profile_stats_value(PR_VALUE_SMBWRITEX, count)
    430 #define SMBwriteX_time __profile_stats_value(PR_VALUE_SMBWRITEX, time)
    431 
    432         PR_VALUE_SMBTRANS2,
    433 #define SMBtrans2_count __profile_stats_value(PR_VALUE_SMBTRANS2, count)
    434 #define SMBtrans2_time __profile_stats_value(PR_VALUE_SMBTRANS2, time)
    435 
    436         PR_VALUE_SMBTRANSS2,
    437 #define SMBtranss2_count __profile_stats_value(PR_VALUE_SMBTRANSS2, count)
    438 #define SMBtranss2_time __profile_stats_value(PR_VALUE_SMBTRANSS2, time)
    439 
    440         PR_VALUE_SMBFINDCLOSE,
    441 #define SMBfindclose_count __profile_stats_value(PR_VALUE_SMBFINDCLOSE, count)
    442 #define SMBfindclose_time __profile_stats_value(PR_VALUE_SMBFINDCLOSE, time)
    443 
    444         PR_VALUE_SMBFINDNCLOSE,
    445 #define SMBfindnclose_count __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, count)
    446 #define SMBfindnclose_time __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, time)
    447 
    448         PR_VALUE_SMBTCON,
    449 #define SMBtcon_count __profile_stats_value(PR_VALUE_SMBTCON, count)
    450 #define SMBtcon_time __profile_stats_value(PR_VALUE_SMBTCON, time)
    451 
    452         PR_VALUE_SMBTDIS,
    453 #define SMBtdis_count __profile_stats_value(PR_VALUE_SMBTDIS, count)
    454 #define SMBtdis_time __profile_stats_value(PR_VALUE_SMBTDIS, time)
    455 
    456         PR_VALUE_SMBNEGPROT,
    457 #define SMBnegprot_count __profile_stats_value(PR_VALUE_SMBNEGPROT, count)
    458 #define SMBnegprot_time __profile_stats_value(PR_VALUE_SMBNEGPROT, time)
    459 
    460         PR_VALUE_SMBSESSSETUPX,
    461 #define SMBsesssetupX_count __profile_stats_value(PR_VALUE_SMBSESSSETUPX, count)
    462 #define SMBsesssetupX_time __profile_stats_value(PR_VALUE_SMBSESSSETUPX, time)
    463 
    464         PR_VALUE_SMBULOGOFFX,
    465 #define SMBulogoffX_count __profile_stats_value(PR_VALUE_SMBULOGOFFX, count)
    466 #define SMBulogoffX_time __profile_stats_value(PR_VALUE_SMBULOGOFFX, time)
    467 
    468         PR_VALUE_SMBTCONX,
    469 #define SMBtconX_count __profile_stats_value(PR_VALUE_SMBTCONX, count)
    470 #define SMBtconX_time __profile_stats_value(PR_VALUE_SMBTCONX, time)
    471 
    472         PR_VALUE_SMBDSKATTR,
    473 #define SMBdskattr_count __profile_stats_value(PR_VALUE_SMBDSKATTR, count)
    474 #define SMBdskattr_time __profile_stats_value(PR_VALUE_SMBDSKATTR, time)
    475 
    476         PR_VALUE_SMBSEARCH,
    477 #define SMBsearch_count __profile_stats_value(PR_VALUE_SMBSEARCH, count)
    478 #define SMBsearch_time __profile_stats_value(PR_VALUE_SMBSEARCH, time)
    479 
    480         /* SBMffirst stats combined with SMBsearch */
    481         PR_VALUE_SMBFFIRST,
    482 #define SMBffirst_count __profile_stats_value(PR_VALUE_SMBFFIRST, count)
    483 #define SMBffirst_time __profile_stats_value(PR_VALUE_SMBFFIRST, time)
    484 
    485         /* SBMfunique stats combined with SMBsearch */
    486         PR_VALUE_SMBFUNIQUE,
    487 #define SMBfunique_count __profile_stats_value(PR_VALUE_SMBFUNIQUE, count)
    488 #define SMBfunique_time __profile_stats_value(PR_VALUE_SMBFUNIQUE, time)
    489 
    490         PR_VALUE_SMBFCLOSE,
    491 #define SMBfclose_count __profile_stats_value(PR_VALUE_SMBFCLOSE, count)
    492 #define SMBfclose_time __profile_stats_value(PR_VALUE_SMBFCLOSE, time)
    493 
    494         PR_VALUE_SMBNTTRANS,
    495 #define SMBnttrans_count __profile_stats_value(PR_VALUE_SMBNTTRANS, count)
    496 #define SMBnttrans_time __profile_stats_value(PR_VALUE_SMBNTTRANS, time)
    497 
    498         PR_VALUE_SMBNTTRANSS,
    499 #define SMBnttranss_count __profile_stats_value(PR_VALUE_SMBNTTRANSS, count)
    500 #define SMBnttranss_time __profile_stats_value(PR_VALUE_SMBNTTRANSS, time)
    501 
    502         PR_VALUE_SMBNTCREATEX,
    503 #define SMBntcreateX_count __profile_stats_value(PR_VALUE_SMBNTCREATEX, count)
    504 #define SMBntcreateX_time __profile_stats_value(PR_VALUE_SMBNTCREATEX, time)
    505 
    506         PR_VALUE_SMBNTCANCEL,
    507 #define SMBntcancel_count __profile_stats_value(PR_VALUE_SMBNTCANCEL, count)
    508 #define SMBntcancel_time __profile_stats_value(PR_VALUE_SMBNTCANCEL, time)
    509 
    510         PR_VALUE_SMBNTRENAME,
    511 #define SMBntrename_count __profile_stats_value(PR_VALUE_SMBNTRENAME, count)
    512 #define SMBntrename_time __profile_stats_value(PR_VALUE_SMBNTRENAME, time)
    513 
    514         PR_VALUE_SMBSPLOPEN,
    515 #define SMBsplopen_count __profile_stats_value(PR_VALUE_SMBSPLOPEN, count)
    516 #define SMBsplopen_time __profile_stats_value(PR_VALUE_SMBSPLOPEN, time)
    517 
    518         PR_VALUE_SMBSPLWR,
    519 #define SMBsplwr_count __profile_stats_value(PR_VALUE_SMBSPLWR, count)
    520 #define SMBsplwr_time __profile_stats_value(PR_VALUE_SMBSPLWR, time)
    521 
    522         PR_VALUE_SMBSPLCLOSE,
    523 #define SMBsplclose_count __profile_stats_value(PR_VALUE_SMBSPLCLOSE, count)
    524 #define SMBsplclose_time __profile_stats_value(PR_VALUE_SMBSPLCLOSE, time)
    525 
    526         PR_VALUE_SMBSPLRETQ,
    527 #define SMBsplretq_count __profile_stats_value(PR_VALUE_SMBSPLRETQ, count)
    528 #define SMBsplretq_time __profile_stats_value(PR_VALUE_SMBSPLRETQ, time)
    529 
    530         PR_VALUE_SMBSENDS,
    531 #define SMBsends_count __profile_stats_value(PR_VALUE_SMBSENDS, count)
    532 #define SMBsends_time __profile_stats_value(PR_VALUE_SMBSENDS, time)
    533 
    534         PR_VALUE_SMBSENDB,
    535 #define SMBsendb_count __profile_stats_value(PR_VALUE_SMBSENDB, count)
    536 #define SMBsendb_time __profile_stats_value(PR_VALUE_SMBSENDB, time)
    537 
    538         PR_VALUE_SMBFWDNAME,
    539 #define SMBfwdname_count __profile_stats_value(PR_VALUE_SMBFWDNAME, count)
    540 #define SMBfwdname_time __profile_stats_value(PR_VALUE_SMBFWDNAME, time)
    541 
    542         PR_VALUE_SMBCANCELF,
    543 #define SMBcancelf_count __profile_stats_value(PR_VALUE_SMBCANCELF, count)
    544 #define SMBcancelf_time __profile_stats_value(PR_VALUE_SMBCANCELF, time)
    545 
    546         PR_VALUE_SMBGETMAC,
    547 #define SMBgetmac_count __profile_stats_value(PR_VALUE_SMBGETMAC, count)
    548 #define SMBgetmac_time __profile_stats_value(PR_VALUE_SMBGETMAC, time)
    549 
    550         PR_VALUE_SMBSENDSTRT,
    551 #define SMBsendstrt_count __profile_stats_value(PR_VALUE_SMBSENDSTRT, count)
    552 #define SMBsendstrt_time __profile_stats_value(PR_VALUE_SMBSENDSTRT, time)
    553 
    554         PR_VALUE_SMBSENDEND,
    555 #define SMBsendend_count __profile_stats_value(PR_VALUE_SMBSENDEND, count)
    556 #define SMBsendend_time __profile_stats_value(PR_VALUE_SMBSENDEND, time)
    557 
    558         PR_VALUE_SMBSENDTXT,
    559 #define SMBsendtxt_count __profile_stats_value(PR_VALUE_SMBSENDTXT, count)
    560 #define SMBsendtxt_time __profile_stats_value(PR_VALUE_SMBSENDTXT, time)
    561 
    562         PR_VALUE_SMBINVALID,
    563 #define SMBinvalid_count __profile_stats_value(PR_VALUE_SMBINVALID, count)
    564 #define SMBinvalid_time __profile_stats_value(PR_VALUE_SMBINVALID, time)
    565 
    566 /* Pathworks setdir command */
    567         PR_VALUE_PATHWORKS_SETDIR,
    568 #define pathworks_setdir_count __profile_stats_value(PR_VALUE_PATHWORKS_SETDIR, count)
    569 #define pathworks_setdir_time __profile_stats_value(PR_VALUE_PATHWORKS_SETDIR, time)
    570 
    571 /* These are the TRANS2 sub commands */
    572         PR_VALUE_TRANS2_OPEN,
    573 #define Trans2_open_count __profile_stats_value(PR_VALUE_TRANS2_OPEN, count)
    574 #define Trans2_open_time __profile_stats_value(PR_VALUE_TRANS2_OPEN, time)
    575 
    576         PR_VALUE_TRANS2_FINDFIRST,
    577 #define Trans2_findfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, count)
    578 #define Trans2_findfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, time)
    579 
    580         PR_VALUE_TRANS2_FINDNEXT,
    581 #define Trans2_findnext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, count)
    582 #define Trans2_findnext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, time)
    583 
    584         PR_VALUE_TRANS2_QFSINFO,
    585 #define Trans2_qfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, count)
    586 #define Trans2_qfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, time)
    587 
    588         PR_VALUE_TRANS2_SETFSINFO,
    589 #define Trans2_setfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, count)
    590 #define Trans2_setfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, time)
    591 
    592         PR_VALUE_TRANS2_QPATHINFO,
    593 #define Trans2_qpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, count)
    594 #define Trans2_qpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, time)
    595 
    596         PR_VALUE_TRANS2_SETPATHINFO,
    597 #define Trans2_setpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, count)
    598 #define Trans2_setpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, time)
    599 
    600         PR_VALUE_TRANS2_QFILEINFO,
    601 #define Trans2_qfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, count)
    602 #define Trans2_qfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, time)
    603 
    604         PR_VALUE_TRANS2_SETFILEINFO,
    605 #define Trans2_setfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, count)
    606 #define Trans2_setfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, time)
    607 
    608         PR_VALUE_TRANS2_FSCTL,
    609 #define Trans2_fsctl_count __profile_stats_value(PR_VALUE_TRANS2_FSCTL, count)
    610 #define Trans2_fsctl_time __profile_stats_value(PR_VALUE_TRANS2_FSCTL, time)
    611 
    612         PR_VALUE_TRANS2_IOCTL,
    613 #define Trans2_ioctl_count __profile_stats_value(PR_VALUE_TRANS2_IOCTL, count)
    614 #define Trans2_ioctl_time __profile_stats_value(PR_VALUE_TRANS2_IOCTL, time)
    615 
    616         PR_VALUE_TRANS2_FINDNOTIFYFIRST,
    617 #define Trans2_findnotifyfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, count)
    618 #define Trans2_findnotifyfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, time)
    619 
    620         PR_VALUE_TRANS2_FINDNOTIFYNEXT,
    621 #define Trans2_findnotifynext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, count)
    622 #define Trans2_findnotifynext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, time)
    623 
    624         PR_VALUE_TRANS2_MKDIR,
    625 #define Trans2_mkdir_count __profile_stats_value(PR_VALUE_TRANS2_MKDIR, count)
    626 #define Trans2_mkdir_time __profile_stats_value(PR_VALUE_TRANS2_MKDIR, time)
    627 
    628         PR_VALUE_TRANS2_SESSION_SETUP,
    629 #define Trans2_session_setup_count __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, count)
    630 #define Trans2_session_setup_time __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, time)
    631 
    632         PR_VALUE_TRANS2_GET_DFS_REFERRAL,
    633 #define Trans2_get_dfs_referral_count __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, count)
    634 #define Trans2_get_dfs_referral_time __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, time)
    635 
    636         PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY,
    637 #define Trans2_report_dfs_inconsistancy_count __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, count)
    638 #define Trans2_report_dfs_inconsistancy_time __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, time)
    639 
    640 /* These are the NT transact sub commands. */
    641         PR_VALUE_NT_TRANSACT_CREATE,
    642 #define NT_transact_create_count __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, count)
    643 #define NT_transact_create_time __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, time)
    644 
    645         PR_VALUE_NT_TRANSACT_IOCTL,
    646 #define NT_transact_ioctl_count __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, count)
    647 #define NT_transact_ioctl_time __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, time)
    648 
    649         PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC,
    650 #define NT_transact_set_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, count)
    651 #define NT_transact_set_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, time)
    652 
    653         PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE,
    654 #define NT_transact_notify_change_count __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, count)
    655 #define NT_transact_notify_change_time __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, time)
    656 
    657         PR_VALUE_NT_TRANSACT_RENAME,
    658 #define NT_transact_rename_count __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, count)
    659 #define NT_transact_rename_time __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, time)
    660 
    661         PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC,
    662 #define NT_transact_query_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, count)
    663 #define NT_transact_query_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, time)
    664 
    665         PR_VALUE_NT_TRANSACT_GET_USER_QUOTA,
    666 #define NT_transact_get_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, count)
    667 #define NT_transact_get_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, time)
    668 
    669         PR_VALUE_NT_TRANSACT_SET_USER_QUOTA,
    670 #define NT_transact_set_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, count)
    671 #define NT_transact_set_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, time)
    672 
    673 /* These are ACL manipulation calls */
    674         PR_VALUE_GET_NT_ACL,
    675 #define get_nt_acl_count __profile_stats_value(PR_VALUE_GET_NT_ACL, count)
    676 #define get_nt_acl_time __profile_stats_value(PR_VALUE_GET_NT_ACL, time)
    677 
    678         PR_VALUE_FGET_NT_ACL,
    679 #define fget_nt_acl_count __profile_stats_value(PR_VALUE_FGET_NT_ACL, count)
    680 #define fget_nt_acl_time __profile_stats_value(PR_VALUE_FGET_NT_ACL, time)
    681 
    682         PR_VALUE_FSET_NT_ACL,
    683 #define fset_nt_acl_count __profile_stats_value(PR_VALUE_FSET_NT_ACL, count)
    684 #define fset_nt_acl_time __profile_stats_value(PR_VALUE_FSET_NT_ACL, time)
    685 
    686         PR_VALUE_CHMOD_ACL,
    687 #define chmod_acl_count __profile_stats_value(PR_VALUE_CHMOD_ACL, count)
    688 #define chmod_acl_time __profile_stats_value(PR_VALUE_CHMOD_ACL, time)
    689 
    690         PR_VALUE_FCHMOD_ACL,
    691 #define fchmod_acl_count __profile_stats_value(PR_VALUE_FCHMOD_ACL, count)
    692 #define fchmod_acl_time __profile_stats_value(PR_VALUE_FCHMOD_ACL, time)
    693 
    694 /* These are nmbd stats */
    695         PR_VALUE_NAME_RELEASE,
    696 #define name_release_count __profile_stats_value(PR_VALUE_NAME_RELEASE, count)
    697 #define name_release_time __profile_stats_value(PR_VALUE_NAME_RELEASE, time)
    698 
    699         PR_VALUE_NAME_REFRESH,
    700 #define name_refresh_count __profile_stats_value(PR_VALUE_NAME_REFRESH, count)
    701 #define name_refresh_time __profile_stats_value(PR_VALUE_NAME_REFRESH, time)
    702 
    703         PR_VALUE_NAME_REGISTRATION,
    704 #define name_registration_count __profile_stats_value(PR_VALUE_NAME_REGISTRATION, count)
    705 #define name_registration_time __profile_stats_value(PR_VALUE_NAME_REGISTRATION, time)
    706 
    707         PR_VALUE_NODE_STATUS,
    708 #define node_status_count __profile_stats_value(PR_VALUE_NODE_STATUS, count)
    709 #define node_status_time __profile_stats_value(PR_VALUE_NODE_STATUS, time)
    710 
    711         PR_VALUE_NAME_QUERY,
    712 #define name_query_count __profile_stats_value(PR_VALUE_NAME_QUERY, count)
    713 #define name_query_time __profile_stats_value(PR_VALUE_NAME_QUERY, time)
    714 
    715         PR_VALUE_HOST_ANNOUNCE,
    716 #define host_announce_count __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, count)
    717 #define host_announce_time __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, time)
    718 
    719         PR_VALUE_WORKGROUP_ANNOUNCE,
    720 #define workgroup_announce_count __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, count)
    721 #define workgroup_announce_time __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, time)
    722 
    723         PR_VALUE_LOCAL_MASTER_ANNOUNCE,
    724 #define local_master_announce_count __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, count)
    725 #define local_master_announce_time __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, time)
    726 
    727         PR_VALUE_MASTER_BROWSER_ANNOUNCE,
    728 #define master_browser_announce_count __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, count)
    729 #define master_browser_announce_time __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, time)
    730 
    731         PR_VALUE_LM_HOST_ANNOUNCE,
    732 #define lm_host_announce_count __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, count)
    733 #define lm_host_announce_time __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, time)
    734 
    735         PR_VALUE_GET_BACKUP_LIST,
    736 #define get_backup_list_count __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, count)
    737 #define get_backup_list_time __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, time)
    738 
    739         PR_VALUE_RESET_BROWSER,
    740 #define reset_browser_count __profile_stats_value(PR_VALUE_RESET_BROWSER, count)
    741 #define reset_browser_time __profile_stats_value(PR_VALUE_RESET_BROWSER, time)
    742 
    743         PR_VALUE_ANNOUNCE_REQUEST,
    744 #define announce_request_count __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, count)
    745 #define announce_request_time __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, time)
    746 
    747         PR_VALUE_LM_ANNOUNCE_REQUEST,
    748 #define lm_announce_request_count __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, count)
    749 #define lm_announce_request_time __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, time)
    750 
    751         PR_VALUE_DOMAIN_LOGON,
    752 #define domain_logon_count __profile_stats_value(PR_VALUE_DOMAIN_LOGON, count)
    753 #define domain_logon_time __profile_stats_value(PR_VALUE_DOMAIN_LOGON, time)
    754 
    755         PR_VALUE_SYNC_BROWSE_LISTS,
    756 #define sync_browse_lists_count __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, count)
    757 #define sync_browse_lists_time __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, time)
    758 
    759         PR_VALUE_RUN_ELECTIONS,
    760 #define run_elections_count __profile_stats_value(PR_VALUE_RUN_ELECTIONS, count)
    761 #define run_elections_time __profile_stats_value(PR_VALUE_RUN_ELECTIONS, time)
    762 
    763         PR_VALUE_ELECTION,
    764 #define election_count __profile_stats_value(PR_VALUE_ELECTION, count)
    765 #define election_time __profile_stats_value(PR_VALUE_ELECTION, time)
    766 
    767         PR_VALUE_SMB2_NEGPROT,
    768 #define smb2_negprot_count __profile_stats_value(PR_VALUE_SMB2_NEGPROT, count)
    769 #define smb2_negprot_time __profile_stats_value(PR_VALUE_SMB2_NEGPROT, time)
    770 
    771         PR_VALUE_SMB2_SESSSETUP,
    772 #define smb2_sesssetup_count __profile_stats_value(PR_VALUE_SMB2_SESSSETUP, count)
    773 #define smb2_sesssetup_time __profile_stats_value(PR_VALUE_SMB2_SESSSETUP, time)
    774 
    775         PR_VALUE_SMB2_LOGOFF,
    776 #define smb2_logoff_count __profile_stats_value(PR_VALUE_SMB2_LOGOFF, count)
    777 #define smb2_logoff_time __profile_stats_value(PR_VALUE_SMB2_LOGOFF, time)
    778 
    779         PR_VALUE_SMB2_TCON,
    780 #define smb2_tcon_count __profile_stats_value(PR_VALUE_SMB2_TCON, count)
    781 #define smb2_tcon_time __profile_stats_value(PR_VALUE_SMB2_TCON, time)
    782 
    783         PR_VALUE_SMB2_TDIS,
    784 #define smb2_tdis_count __profile_stats_value(PR_VALUE_SMB2_TDIS, count)
    785 #define smb2_tdis_time __profile_stats_value(PR_VALUE_SMB2_TDIS, time)
    786 
    787         PR_VALUE_SMB2_CREATE,
    788 #define smb2_create_count __profile_stats_value(PR_VALUE_SMB2_CREATE, count)
    789 #define smb2_create_time __profile_stats_value(PR_VALUE_SMB2_CREATE, time)
    790 
    791         PR_VALUE_SMB2_CLOSE,
    792 #define smb2_close_count __profile_stats_value(PR_VALUE_SMB2_CLOSE, count)
    793 #define smb2_close_time __profile_stats_value(PR_VALUE_SMB2_CLOSE, time)
    794 
    795         PR_VALUE_SMB2_FLUSH,
    796 #define smb2_flush_count __profile_stats_value(PR_VALUE_SMB2_FLUSH, count)
    797 #define smb2_flush_time __profile_stats_value(PR_VALUE_SMB2_FLUSH, time)
    798 
    799         PR_VALUE_SMB2_READ,
    800 #define smb2_read_count __profile_stats_value(PR_VALUE_SMB2_READ, count)
    801 #define smb2_read_time __profile_stats_value(PR_VALUE_SMB2_READ, time)
    802 
    803         PR_VALUE_SMB2_WRITE,
    804 #define smb2_write_count __profile_stats_value(PR_VALUE_SMB2_WRITE, count)
    805 #define smb2_write_time __profile_stats_value(PR_VALUE_SMB2_WRITE, time)
    806 
    807         PR_VALUE_SMB2_LOCK,
    808 #define smb2_lock_count __profile_stats_value(PR_VALUE_SMB2_LOCK, count)
    809 #define smb2_lock_time __profile_stats_value(PR_VALUE_SMB2_LOCK, time)
    810 
    811         PR_VALUE_SMB2_IOCTL,
    812 #define smb2_ioctl_count __profile_stats_value(PR_VALUE_SMB2_IOCTL, count)
    813 #define smb2_ioctl_time __profile_stats_value(PR_VALUE_SMB2_IOCTL, time)
    814 
    815         PR_VALUE_SMB2_CANCEL,
    816 #define smb2_cancel_count __profile_stats_value(PR_VALUE_SMB2_CANCEL, count)
    817 #define smb2_cancel_time __profile_stats_value(PR_VALUE_SMB2_CANCEL, time)
    818 
    819         PR_VALUE_SMB2_KEEPALIVE,
    820 #define smb2_keepalive_count __profile_stats_value(PR_VALUE_SMB2_KEEPALIVE, count)
    821 #define smb2_keepalive_time __profile_stats_value(PR_VALUE_SMB2_KEEPALIVE, time)
    822 
    823         PR_VALUE_SMB2_FIND,
    824 #define smb2_find_count __profile_stats_value(PR_VALUE_SMB2_FIND, count)
    825 #define smb2_find_time __profile_stats_value(PR_VALUE_SMB2_FIND, time)
    826 
    827         PR_VALUE_SMB2_NOTIFY,
    828 #define smb2_notify_count __profile_stats_value(PR_VALUE_SMB2_NOTIFY, count)
    829 #define smb2_notify_time __profile_stats_value(PR_VALUE_SMB2_NOTIFY, time)
    830 
    831         PR_VALUE_SMB2_GETINFO,
    832 #define smb2_getinfo_count __profile_stats_value(PR_VALUE_SMB2_GETINFO, count)
    833 #define smb2_getinfo_time __profile_stats_value(PR_VALUE_SMB2_GETINFO, time)
    834 
    835         PR_VALUE_SMB2_SETINFO,
    836 #define smb2_setinfo_count __profile_stats_value(PR_VALUE_SMB2_SETINFO, count)
    837 #define smb2_setinfo_time __profile_stats_value(PR_VALUE_SMB2_SETINFO, time)
    838 
    839         PR_VALUE_SMB2_BREAK,
    840 #define smb2_break_count __profile_stats_value(PR_VALUE_SMB2_BREAK, count)
    841 #define smb2_break_time __profile_stats_value(PR_VALUE_SMB2_BREAK, time)
    842 
    843         /* This mist remain the last value. */
    844         PR_VALUE_MAX
    845 }; /* enum profile_stats_values */
    846 
    847 const char * profile_value_name(enum profile_stats_values val);
    848 
    849 struct profile_stats {
    850 /* general counters */
    851         unsigned smb_count; /* how many SMB packets we have processed */
    852         unsigned uid_changes; /* how many times we change our effective uid */
    853 
    854 /* system call and protocol operation counters and cumulative times */
    855         unsigned count[PR_VALUE_MAX];
    856         unsigned time[PR_VALUE_MAX];
    857 
    858 /* cumulative byte counts */
    859         unsigned syscall_pread_bytes;
    860         unsigned syscall_pwrite_bytes;
    861         unsigned syscall_read_bytes;
    862         unsigned syscall_write_bytes;
    863         unsigned syscall_sendfile_bytes;
    864         unsigned syscall_recvfile_bytes;
    865 
    866 /* stat cache counters */
    867         unsigned statcache_lookups;
    868         unsigned statcache_misses;
    869         unsigned statcache_hits;
    870 
    871 /* write cache counters */
    872         unsigned writecache_read_hits;
    873         unsigned writecache_abutted_writes;
    874         unsigned writecache_total_writes;
    875         unsigned writecache_non_oplock_writes;
    876         unsigned writecache_direct_writes;
    877         unsigned writecache_init_writes;
    878         unsigned writecache_flushed_writes[NUM_FLUSH_REASONS];
    879         unsigned writecache_num_perfect_writes;
    880         unsigned writecache_num_write_caches;
    881         unsigned writecache_allocated_write_caches;
    882 };
    883 
    884 struct profile_header {
    885         int prof_shm_magic;
    886         int prof_shm_version;
    887         struct profile_stats stats;
    888 };
    889 
    890 extern struct profile_header *profile_h;
    891 extern struct profile_stats *profile_p;
    892 extern bool do_profile_flag;
    893 extern bool do_profile_times;
    894 
    895 #ifdef WITH_PROFILE
    896 
    897 /* these are helper macros - do not call them directly in the code
    898  * use the DO_PROFILE_* START_PROFILE and END_PROFILE ones
    899  * below which test for the profile flage first
    900  */
    901 #define INC_PROFILE_COUNT(x) profile_p->x++
    902 #define DEC_PROFILE_COUNT(x) profile_p->x--
    903 #define ADD_PROFILE_COUNT(x,y) profile_p->x += (y)
     514        if (likely(smbprofile_state.internal.te != NULL)) {
     515                return;
     516        }
     517
     518        if (unlikely(smbprofile_state.internal.ev == NULL)) {
     519                return;
     520        }
     521
     522        smbprofile_dump_schedule_timer();
     523}
     524
     525static inline bool smbprofile_dump_pending(void)
     526{
     527        if (smbprofile_state.internal.te == NULL) {
     528                return false;
     529        }
     530
     531        return true;
     532}
     533
     534void smbprofile_dump(void);
     535
     536void smbprofile_cleanup(pid_t pid, pid_t dst);
     537void smbprofile_stats_accumulate(struct profile_stats *acc,
     538                                 const struct profile_stats *add);
     539void smbprofile_collect(struct profile_stats *stats);
    904540
    905541static inline uint64_t profile_timestamp(void)
     
    913549}
    914550
    915 /* end of helper macros */
    916 
    917551#define DO_PROFILE_INC(x) \
    918         if (do_profile_flag) { \
    919                 INC_PROFILE_COUNT(x); \
    920         }
    921 
    922 #define DO_PROFILE_DEC(x) \
    923         if (do_profile_flag) { \
    924                 DEC_PROFILE_COUNT(x); \
    925         }
    926 
    927 #define DO_PROFILE_DEC_INC(x,y) \
    928         if (do_profile_flag) { \
    929                 DEC_PROFILE_COUNT(x); \
    930                 INC_PROFILE_COUNT(y); \
    931         }
    932 
    933 #define DO_PROFILE_ADD(x,n) \
    934         if (do_profile_flag) { \
    935                 ADD_PROFILE_COUNT(x,n); \
    936         }
     552        _SMBPROFILE_COUNT_INCREMENT(x##_stats, profile_p, 1); \
    937553
    938554#define START_PROFILE(x) \
    939         uint64_t __profstamp_##x = 0; \
    940         if (do_profile_flag) { \
    941                 __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
    942                 INC_PROFILE_COUNT(x##_count); \
    943         }
     555        struct smbprofile_stats_basic_async __profasync_##x = {}; \
     556        _SMBPROFILE_BASIC_ASYNC_START(x##_stats, profile_p, __profasync_##x);
    944557
    945558#define START_PROFILE_BYTES(x,n) \
    946         uint64_t __profstamp_##x = 0; \
    947         if (do_profile_flag) { \
    948                 __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
    949                 INC_PROFILE_COUNT(x##_count); \
    950                 ADD_PROFILE_COUNT(x##_bytes, n); \
    951         }
     559        struct smbprofile_stats_bytes_async __profasync_##x = {}; \
     560        _SMBPROFILE_BYTES_ASYNC_START(x##_stats, profile_p, __profasync_##x, n);
    952561
    953562#define END_PROFILE(x) \
    954         if (do_profile_times) { \
    955                 ADD_PROFILE_COUNT(x##_time, \
    956                     profile_timestamp() - __profstamp_##x); \
    957         }
     563        SMBPROFILE_BASIC_ASYNC_END(__profasync_##x)
     564
     565#define END_PROFILE_BYTES(x) \
     566        SMBPROFILE_BYTES_ASYNC_END(__profasync_##x)
     567
    958568#else /* WITH_PROFILE */
    959569
     570#define SMBPROFILE_COUNT_INCREMENT(_name, _area, _v)
     571
     572#define SMBPROFILE_TIME_ASYNC_STATE(_async_name)
     573#define SMBPROFILE_TIME_ASYNC_START(_name, _area, _async)
     574#define SMBPROFILE_TIME_ASYNC_END(_async)
     575
     576#define SMBPROFILE_BASIC_ASYNC_STATE(_async_name)
     577#define SMBPROFILE_BASIC_ASYNC_START(_name, _area, _async)
     578#define SMBPROFILE_BASIC_ASYNC_END(_async)
     579
     580#define SMBPROFILE_BYTES_ASYNC_STATE(_async_name)
     581#define SMBPROFILE_BYTES_ASYNC_START(_name, _area, _async, _inbytes)
     582#define SMBPROFILE_BYTES_ASYNC_SET_IDLE(_async)
     583#define SMBPROFILE_BYTES_ASYNC_SET_BUSY(_async)
     584#define SMBPROFILE_BYTES_ASYNC_END(_async)
     585
     586#define SMBPROFILE_IOBYTES_ASYNC_STATE(_async_name)
     587#define SMBPROFILE_IOBYTES_ASYNC_START(_name, _area, _async, _inbytes)
     588#define SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(_async)
     589#define SMBPROFILE_IOBYTES_ASYNC_SET_BUSY(_async)
     590#define SMBPROFILE_IOBYTES_ASYNC_END(_async, _outbytes)
     591
    960592#define DO_PROFILE_INC(x)
    961 #define DO_PROFILE_DEC(x)
    962 #define DO_PROFILE_DEC_INC(x,y)
    963 #define DO_PROFILE_ADD(x,n)
    964593#define START_PROFILE(x)
    965594#define START_PROFILE_BYTES(x,n)
    966595#define END_PROFILE(x)
     596#define END_PROFILE_BYTES(x)
     597
     598static inline bool smbprofile_dump_pending(void)
     599{
     600        return false;
     601}
     602
     603static inline void smbprofile_dump_setup(struct tevent_context *ev)
     604{
     605        return;
     606}
     607
     608static inline void smbprofile_dump(void)
     609{
     610        return;
     611}
     612
     613static inline void smbprofile_cleanup(pid_t pid, pid_t dst)
     614{
     615        return;
     616}
     617
    967618#endif /* WITH_PROFILE */
    968619
     
    970621
    971622void set_profile_level(int level, struct server_id src);
     623
     624struct messaging_context;
    972625bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
    973626
  • vendor/current/source3/include/srvstr.h

    r414 r988  
    2020#define srvstr_pull_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \
    2121    pull_string_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags)
    22 
    23 /* pull a string from the smb_buf part of a packet. In this case the
    24    string can either be null terminated or it can be terminated by the
    25    end of the smbbuf area
    26 */
    27 
    28 #define srvstr_pull_req_talloc(ctx, req_, dest, src, flags) \
    29     pull_string_talloc(ctx, req_->inbuf, req_->flags2, dest, src, \
    30                        smbreq_bufrem(req_, src), flags)
  • vendor/current/source3/include/tldap.h

    r740 r988  
    2323#include <talloc.h>
    2424#include <tevent.h>
     25#include "lib/util/data_blob.h"
    2526
    2627struct tldap_context;
  • vendor/current/source3/include/trans2.h

    r740 r988  
    282282#define TYPE_MOUNTED                    0x20
    283283#define TYPE_VIRTUAL                    0x40
     284
     285/* SMB_FS_SECTOR_SIZE_INFORMATION values */
     286#define SSINFO_FLAGS_ALIGNED_DEVICE                     0x00000001
     287#define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE        0x00000002
     288#define SSINFO_FLAGS_NO_SEEK_PENALTY                    0x00000004
     289#define SSINFO_FLAGS_TRIM_ENABLED                       0x00000008
     290
     291#define SSINFO_OFFSET_UNKNOWN                           0xffffffff
    284292
    285293/* NT passthrough levels... */
     
    334342#define SMB_FS_FULL_SIZE_INFORMATION                    1007
    335343#define SMB_FS_OBJECTID_INFORMATION                     1008
     344#define SMB_FS_SECTOR_SIZE_INFORMATION                  1011
    336345
    337346/* SMB_FS_DEVICE_INFORMATION device types. */
     
    356365#define FLAG_TRANS2_FIND_BACKUP_INTENT  0x10
    357366
    358 /* UNIX CIFS Extensions - created by HP */
    359 /*
    360  * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved.
    361  * Supposedly Microsoft have agreed to this.
    362  */
    363 
    364 #define MIN_UNIX_INFO_LEVEL 0x200
    365 #define MAX_UNIX_INFO_LEVEL 0x2FF
    366 
    367 #define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL))
    368 
    369 #define SMB_QUERY_FILE_UNIX_BASIC      0x200   /* UNIX File Info*/
    370 #define SMB_SET_FILE_UNIX_BASIC        0x200
    371 #define SMB_SET_FILE_UNIX_INFO2        0x20B   /* UNIX File Info2 */
    372 
    373 #define SMB_MODE_NO_CHANGE                 0xFFFFFFFF     /* file mode value which */
    374                                               /* means "don't change it" */
    375 #define SMB_UID_NO_CHANGE                  0xFFFFFFFF
    376 #define SMB_GID_NO_CHANGE                  0xFFFFFFFF
    377 
    378 #define SMB_SIZE_NO_CHANGE_LO              0xFFFFFFFF
    379 #define SMB_SIZE_NO_CHANGE_HI              0xFFFFFFFF
    380  
    381 #define SMB_TIME_NO_CHANGE_LO              0xFFFFFFFF
    382 #define SMB_TIME_NO_CHANGE_HI              0xFFFFFFFF
    383 
    384 /*
    385 Offset Size         Name
    386 0      LARGE_INTEGER EndOfFile                File size
    387 8      LARGE_INTEGER Blocks                   Number of bytes used on disk (st_blocks).
    388 16     LARGE_INTEGER CreationTime             Creation time
    389 24     LARGE_INTEGER LastAccessTime           Last access time
    390 32     LARGE_INTEGER LastModificationTime     Last modification time
    391 40     LARGE_INTEGER Uid                      Numeric user id for the owner
    392 48     LARGE_INTEGER Gid                      Numeric group id of owner
    393 56     ULONG Type                             Enumeration specifying the pathname type:
    394                                               0 -- File
    395                                               1 -- Directory
    396                                               2 -- Symbolic link
    397                                               3 -- Character device
    398                                               4 -- Block device
    399                                               5 -- FIFO (named pipe)
    400                                               6 -- Unix domain socket
    401 
    402 60     LARGE_INTEGER devmajor                 Major device number if type is device
    403 68     LARGE_INTEGER devminor                 Minor device number if type is device
    404 76     LARGE_INTEGER uniqueid                 This is a server-assigned unique id for the file. The client
    405                                               will typically map this onto an inode number. The scope of
    406                                               uniqueness is the share.
    407 84     LARGE_INTEGER permissions              Standard UNIX file permissions  - see below.
    408 92     LARGE_INTEGER nlinks                   The number of directory entries that map to this entry
    409                                               (number of hard links)
    410 
    411 100 - end.
    412 */
    413 
    414 #define SMB_FILE_UNIX_BASIC_SIZE 100
    415 
    416 /* UNIX filetype mappings. */
    417 
    418 #define UNIX_TYPE_FILE 0
    419 #define UNIX_TYPE_DIR 1
    420 #define UNIX_TYPE_SYMLINK 2
    421 #define UNIX_TYPE_CHARDEV 3
    422 #define UNIX_TYPE_BLKDEV 4
    423 #define UNIX_TYPE_FIFO 5
    424 #define UNIX_TYPE_SOCKET 6
    425 #define UNIX_TYPE_UNKNOWN 0xFFFFFFFF
    426 
    427 /*
    428  * Oh this is fun. "Standard UNIX permissions" has no
    429  * meaning in POSIX. We need to define the mapping onto
    430  * and off the wire as this was not done in the original HP
    431  * spec. JRA.
    432  */
    433 
    434 #define UNIX_X_OTH                      0000001
    435 #define UNIX_W_OTH                      0000002
    436 #define UNIX_R_OTH                      0000004
    437 #define UNIX_X_GRP                      0000010
    438 #define UNIX_W_GRP                      0000020
    439 #define UNIX_R_GRP                      0000040
    440 #define UNIX_X_USR                      0000100
    441 #define UNIX_W_USR                      0000200
    442 #define UNIX_R_USR                      0000400
    443 #define UNIX_STICKY                     0001000
    444 #define UNIX_SET_GID                    0002000
    445 #define UNIX_SET_UID                    0004000
    446 
    447 /* Masks for the above */
    448 #define UNIX_OTH_MASK                   0000007
    449 #define UNIX_GRP_MASK                   0000070
    450 #define UNIX_USR_MASK                   0000700
    451 #define UNIX_PERM_MASK                  0000777
    452 #define UNIX_EXTRA_MASK                 0007000
    453 #define UNIX_ALL_MASK                   0007777
    454 
    455 /* Flags for chflags (CIFS_UNIX_EXTATTR_CAP capability) and
    456  * SMB_QUERY_FILE_UNIX_INFO2.
    457  */
    458 #define EXT_SECURE_DELETE               0x00000001
    459 #define EXT_ENABLE_UNDELETE             0x00000002
    460 #define EXT_SYNCHRONOUS                 0x00000004
    461 #define EXT_IMMUTABLE                   0x00000008
    462 #define EXT_OPEN_APPEND_ONLY            0x00000010
    463 #define EXT_DO_NOT_BACKUP               0x00000020
    464 #define EXT_NO_UPDATE_ATIME             0x00000040
    465 #define EXT_HIDDEN                      0x00000080
    466 
    467 #define SMB_QUERY_FILE_UNIX_LINK       0x201
    468 #define SMB_SET_FILE_UNIX_LINK         0x201
    469 #define SMB_SET_FILE_UNIX_HLINK        0x203
    470 /* SMB_QUERY_POSIX_ACL 0x204 see below */
    471 #define SMB_QUERY_XATTR                0x205 /* need for non-user XATTRs */
    472 #define SMB_QUERY_ATTR_FLAGS           0x206 /* chflags, chattr */
    473 #define SMB_SET_ATTR_FLAGS             0x206
    474 #define SMB_QUERY_POSIX_PERMISSION     0x207
    475 /* Only valid for qfileinfo */
    476 #define SMB_QUERY_POSIX_LOCK           0x208
    477 /* Only valid for setfileinfo */
    478 #define SMB_SET_POSIX_LOCK             0x208
    479 
    480 /* The set info levels for POSIX path operations. */
    481 #define SMB_POSIX_PATH_OPEN            0x209
    482 #define SMB_POSIX_PATH_UNLINK          0x20A
    483 
    484 #define SMB_QUERY_FILE_UNIX_INFO2      0x20B   /* UNIX File Info2 */
    485 #define SMB_SET_FILE_UNIX_INFO2        0x20B
    486 
    487 /*
    488 SMB_QUERY_FILE_UNIX_INFO2 is SMB_QUERY_FILE_UNIX_BASIC with create
    489 time and file flags appended. The corresponding info level for
    490 findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2.
    491     Size    Offset  Value
    492     ---------------------
    493     0      LARGE_INTEGER EndOfFile  File size
    494     8      LARGE_INTEGER Blocks     Number of blocks used on disk
    495     16     LARGE_INTEGER ChangeTime Attribute change time
    496     24     LARGE_INTEGER LastAccessTime           Last access time
    497     32     LARGE_INTEGER LastModificationTime     Last modification time
    498     40     LARGE_INTEGER Uid        Numeric user id for the owner
    499     48     LARGE_INTEGER Gid        Numeric group id of owner
    500     56     ULONG Type               Enumeration specifying the file type
    501     60     LARGE_INTEGER devmajor   Major device number if type is device
    502     68     LARGE_INTEGER devminor   Minor device number if type is device
    503     76     LARGE_INTEGER uniqueid   This is a server-assigned unique id
    504     84     LARGE_INTEGER permissions            Standard UNIX permissions
    505     92     LARGE_INTEGER nlinks                 Number of hard links
    506     100    LARGE_INTEGER CreationTime           Create/birth time
    507     108    ULONG FileFlags          File flags enumeration
    508     112    ULONG FileFlagsMask      Mask of valid flags
    509 */
    510 
    511 /* Transact 2 Find First levels */
    512 #define SMB_FIND_FILE_UNIX             0x202
    513 #define SMB_FIND_FILE_UNIX_INFO2       0x20B /* UNIX File Info2 */
    514 
    515 #define SMB_FILE_UNIX_INFO2_SIZE 116
    516 
    517 /*
    518  Info level for TRANS2_QFSINFO - returns version of CIFS UNIX extensions, plus
    519  64-bits worth of capability fun :-).
    520  Use the same info level for TRANS2_SETFSINFO
    521 */
    522 
    523 #define SMB_QUERY_CIFS_UNIX_INFO      0x200
    524 #define SMB_SET_CIFS_UNIX_INFO        0x200
    525 
    526 /* Returns or sets the following.
    527 
    528   UINT16             major version number
    529   UINT16             minor version number
    530   LARGE_INTEGER      capability bitfield
    531 
    532 */
    533 
    534 #define CIFS_UNIX_MAJOR_VERSION 1
    535 #define CIFS_UNIX_MINOR_VERSION 0
    536 
    537 #define CIFS_UNIX_FCNTL_LOCKS_CAP           0x1
    538 #define CIFS_UNIX_POSIX_ACLS_CAP            0x2
    539 #define CIFS_UNIX_XATTTR_CAP                0x4 /* for support of other xattr
    540                                                 namespaces such as system,
    541                                                 security and trusted */
    542 #define CIFS_UNIX_EXTATTR_CAP               0x8 /* for support of chattr
    543                                                 (chflags) and lsattr */
    544 #define CIFS_UNIX_POSIX_PATHNAMES_CAP      0x10 /* Use POSIX pathnames on the wire. */
    545 #define CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP        0x20 /* We can cope with POSIX open/mkdir/unlink etc. */
    546 #define CIFS_UNIX_LARGE_READ_CAP           0x40 /* We can cope with 24 bit reads in readX. */
    547 #define CIFS_UNIX_LARGE_WRITE_CAP          0x80 /* We can cope with 24 bit writes in writeX. */
    548 #define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP      0x100 /* We can do SPNEGO negotiations for encryption. */
    549 #define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP    0x200 /* We *must* SPNEGO negotiations for encryption. */
    550 
    551 #define SMB_QUERY_POSIX_FS_INFO     0x201
    552 
    553 /* Returns FILE_SYSTEM_POSIX_INFO struct as follows
    554       (NB   For undefined values return -1 in that field)
    555    le32 OptimalTransferSize;    bsize on some os, iosize on other os, This
    556                                 is a hint to the client about best size. Server
    557                                 can return -1 if no preference, ie if SMB
    558                                 negotiated size is adequate for optimal
    559                                 read/write performance
    560    le32 BlockSize; (often 512 bytes) NB: BlockSize * TotalBlocks = disk space
    561    le64 TotalBlocks;  redundant with other infolevels but easy to ret here
    562    le64 BlocksAvail;  although redundant, easy to return
    563    le64 UserBlocksAvail;      bavail
    564    le64 TotalFileNodes;
    565    le64 FreeFileNodes;
    566    le64 FileSysIdentifier;    fsid
    567    (NB statfs field Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call)
    568    (NB statfs field flags can come from FILE_SYSTEM_DEVICE_INFO call) 
    569 */
    570 
    571 #define SMB_QUERY_POSIX_WHO_AM_I  0x202 /* QFS Info */
    572 /* returns:
    573         __u32 flags;  0 = Authenticated user 1 = GUEST
    574         __u32 mask;  which flags bits server understands ie 0x0001
    575         __u64 unix_user_id;
    576         __u64 unix_user_gid;
    577         __u32 number_of_supplementary_gids;  may be zero
    578         __u32 number_of_sids;  may be zero
    579         __u32 length_of_sid_array;  in bytes - may be zero
    580         __u32 pad;  reserved - MBZ
    581         __u64 gid_array[0];  may be empty
    582         __u8 * psid_list  may be empty
    583 */
    584 
    585 /* ... more as we think of them :-). */
    586 
    587 /* SMB POSIX ACL definitions. */
    588 /* Wire format is (all little endian) :
    589 
    590 [2 bytes]              -     Version number.
    591 [2 bytes]              -     Number of ACE entries to follow.
    592 [2 bytes]              -     Number of default ACE entries to follow.
    593 -------------------------------------
    594 ^
    595 |
    596 ACE entries
    597 |
    598 v
    599 -------------------------------------
    600 ^
    601 |
    602 Default ACE entries
    603 |
    604 v
    605 -------------------------------------
    606 
    607 Where an ACE entry looks like :
    608 
    609 [1 byte]           - Entry type.
    610 
    611 Entry types are :
    612 
    613 ACL_USER_OBJ            0x01
    614 ACL_USER                0x02
    615 ACL_GROUP_OBJ           0x04
    616 ACL_GROUP               0x08
    617 ACL_MASK                0x10
    618 ACL_OTHER               0x20
    619 
    620 [1 byte]          - permissions (perm_t)
    621 
    622 perm_t types are :
    623 
    624 ACL_READ                0x04
    625 ACL_WRITE               0x02
    626 ACL_EXECUTE             0x01
    627 
    628 [8 bytes]         - uid/gid to apply this permission to.
    629 
    630 In the same format as the uid/gid fields in the other
    631 UNIX extensions definitions. Use 0xFFFFFFFFFFFFFFFF for
    632 the MASK and OTHER entry types.
    633 
    634 If the Number of ACE entries for either file or default ACE's
    635 is set to 0xFFFF this means ignore this kind of ACE (and the
    636 number of entries sent will be zero.
    637 
    638 */
    639 
    640 #define SMB_QUERY_POSIX_WHOAMI     0x202
    641 
    642 enum smb_whoami_flags {
    643     SMB_WHOAMI_GUEST = 0x1 /* Logged in as (or squashed to) guest */
    644 };
    645 
    646 /* Mask of which WHOAMI bits are valid. This should make it easier for clients
    647  * to cope with servers that have different sets of WHOAMI flags (as more get
    648  * added).
    649  */
    650 #define SMB_WHOAMI_MASK 0x00000001
    651 
    652 /*
    653    SMBWhoami - Query the user mapping performed by the server for the
    654    connected tree. This is a subcommand of the TRANS2_QFSINFO.
    655 
    656    Returns:
    657         4 bytes unsigned -      mapping flags (smb_whoami_flags)
    658         4 bytes unsigned -      flags mask
    659 
    660         8 bytes unsigned -      primary UID
    661         8 bytes unsigned -      primary GID
    662         4 bytes unsigned -      number of supplementary GIDs
    663         4 bytes unsigned -      number of SIDs
    664         4 bytes unsigned -      SID list byte count
    665         4 bytes -               pad / reserved (must be zero)
    666 
    667         8 bytes unsigned[] -    list of GIDs (may be empty)
    668         struct dom_sid[] -              list of SIDs (may be empty)
    669 */
    670 
    671 /*
    672  * The following trans2 is done between client and server
    673  * as a FSINFO call to set up the encryption state for transport
    674  * encryption.
    675  * This is a subcommand of the TRANS2_QFSINFO.
    676  *
    677  * The request looks like :
    678  *
    679  * [data block] -> SPNEGO framed GSSAPI request.
    680  *
    681  * The reply looks like :
    682  *
    683  * [data block] -> SPNEGO framed GSSAPI reply - if error
    684  *                 is NT_STATUS_OK then we're done, if it's
    685  *                 NT_STATUS_MORE_PROCESSING_REQUIRED then the
    686  *                 client needs to keep going. If it's an
    687  *                 error it can be any NT_STATUS error.
    688  *
    689  */
    690 
    691 #define SMB_REQUEST_TRANSPORT_ENCRYPTION     0x203 /* QFSINFO */
    692 
    693 
    694 /* The query/set info levels for POSIX ACLs. */
    695 #define SMB_QUERY_POSIX_ACL  0x204
    696 #define SMB_SET_POSIX_ACL  0x204
    697 
    698 /* Current on the wire ACL version. */
    699 #define SMB_POSIX_ACL_VERSION 1
    700 
    701 /* ACE entry type. */
    702 #define SMB_POSIX_ACL_USER_OBJ            0x01
    703 #define SMB_POSIX_ACL_USER                0x02
    704 #define SMB_POSIX_ACL_GROUP_OBJ           0x04
    705 #define SMB_POSIX_ACL_GROUP               0x08
    706 #define SMB_POSIX_ACL_MASK                0x10
    707 #define SMB_POSIX_ACL_OTHER               0x20
    708 
    709 /* perm_t types. */
    710 #define SMB_POSIX_ACL_READ                0x04
    711 #define SMB_POSIX_ACL_WRITE               0x02
    712 #define SMB_POSIX_ACL_EXECUTE             0x01
    713 
    714 #define SMB_POSIX_ACL_HEADER_SIZE         6
    715 #define SMB_POSIX_ACL_ENTRY_SIZE         10
    716 
    717 #define SMB_POSIX_IGNORE_ACE_ENTRIES    0xFFFF
    718 
    719 /* Definition of data block of SMB_SET_POSIX_LOCK */
    720 /*
    721   [2 bytes] lock_type - 0 = Read, 1 = Write, 2 = Unlock
    722   [2 bytes] lock_flags - 1 = Wait (only valid for setlock)
    723   [4 bytes] pid = locking context.
    724   [8 bytes] start = unsigned 64 bits.
    725   [8 bytes] length = unsigned 64 bits.
    726 */
    727 
    728 #define POSIX_LOCK_TYPE_OFFSET 0
    729 #define POSIX_LOCK_FLAGS_OFFSET 2
    730 #define POSIX_LOCK_PID_OFFSET 4
    731 #define POSIX_LOCK_START_OFFSET 8
    732 #define POSIX_LOCK_LEN_OFFSET 16
    733 #define POSIX_LOCK_DATA_SIZE 24
    734 
    735 #define POSIX_LOCK_FLAG_NOWAIT 0
    736 #define POSIX_LOCK_FLAG_WAIT 1
    737 
    738 #define POSIX_LOCK_TYPE_READ 0
    739 #define POSIX_LOCK_TYPE_WRITE 1
    740 #define POSIX_LOCK_TYPE_UNLOCK 2
    741 
    742 /* SMB_POSIX_PATH_OPEN "open_mode" definitions. */
    743 #define SMB_O_RDONLY                      0x1
    744 #define SMB_O_WRONLY                      0x2
    745 #define SMB_O_RDWR                        0x4
    746 
    747 #define SMB_ACCMODE                       0x7
    748 
    749 #define SMB_O_CREAT                      0x10
    750 #define SMB_O_EXCL                       0x20
    751 #define SMB_O_TRUNC                      0x40
    752 #define SMB_O_APPEND                     0x80
    753 #define SMB_O_SYNC                      0x100
    754 #define SMB_O_DIRECTORY                 0x200
    755 #define SMB_O_NOFOLLOW                  0x400
    756 #define SMB_O_DIRECT                    0x800
    757 
    758 /* Definition of request data block for SMB_POSIX_PATH_OPEN */
    759 /*
    760   [4 bytes] flags (as smb_ntcreate_Flags).
    761   [4 bytes] open_mode                   - SMB_O_xxx flags above.
    762   [8 bytes] mode_t (permissions)        - same encoding as "Standard UNIX permissions" above in SMB_SET_FILE_UNIX_BASIC.
    763   [2 bytes] ret_info_level      - optimization. Info level to be returned.
    764 */
    765 
    766 /* Definition of reply data block for SMB_POSIX_PATH_OPEN */
    767 
    768 #define SMB_NO_INFO_LEVEL_RETURNED 0xFFFF
    769 
    770 /*
    771   [2 bytes] - flags field. Identical to flags reply for oplock response field in SMBNTCreateX)
    772   [2 bytes] - FID returned.
    773   [4 bytes] - CreateAction (same as in NTCreateX response).
    774   [2 bytes] - reply info level    - as requested or 0xFFFF if not available.
    775   [2 bytes] - padding (must be zero)
    776   [n bytes] - info level reply  - if available.
    777 */
    778 
    779 /* Definition of request data block for SMB_POSIX_UNLINK */
    780 /*
    781   [2 bytes] flags (defined below).
    782 */
    783 
    784 #define SMB_POSIX_UNLINK_FILE_TARGET 0
    785 #define SMB_POSIX_UNLINK_DIRECTORY_TARGET 1
    786 
    787367#endif
  • vendor/current/source3/include/transfer_file.h

    r414 r988  
    2525                               void *out_file,
    2626                               size_t n,
    27                                ssize_t (*read_fn)(void *, void *, size_t),
    28                                ssize_t (*write_fn)(void *, const void *, size_t));
     27                               ssize_t (*pread_fn)(void *, void *, size_t, off_t),
     28                               ssize_t (*pwrite_fn)(void *, const void *, size_t, off_t));
    2929
    30 SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n);
     30off_t transfer_file(int infd, int outfd, off_t n);
    3131
    3232#endif /* __TRANSFER_FILE_H__ */
  • vendor/current/source3/include/util_tdb.h

    r740 r988  
    2727#include "../../lib/util/util_tdb.h"
    2828
    29 int tdb_chainlock_with_timeout( struct tdb_context *tdb, TDB_DATA key,
    30                                 unsigned int timeout);
    31 int tdb_lock_bystring_with_timeout(struct tdb_context *tdb, const char *keyval,
    32                                    int timeout);
    33 int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
    34                                         unsigned int timeout);
    35 
    3629int tdb_trans_store_bystring(TDB_CONTEXT *tdb, const char *keystr,
    3730                             TDB_DATA data, int flags);
     
    4033int tdb_trans_delete(struct tdb_context *tdb, TDB_DATA key);
    4134
    42 int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...);
    43 size_t tdb_pack(uint8 *buf, int bufsize, const char *fmt, ...);
    44 bool tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len,
     35/*
     36 * The tdb_unpack() and tdb_pack[_append]() helpers are deprecated. Consider
     37 * using idl/ndr for marshalling of complex data types instead.
     38 */
     39int tdb_unpack(const uint8_t *buf, int bufsize, const char *fmt, ...);
     40size_t tdb_pack(uint8_t *buf, int bufsize, const char *fmt, ...);
     41bool tdb_pack_append(TALLOC_CTX *mem_ctx, uint8_t **buf, size_t *len,
    4542                     const char *fmt, ...);
    4643
     
    5249int tdb_data_cmp(TDB_DATA t1, TDB_DATA t2);
    5350
     51char *tdb_data_string(TALLOC_CTX *mem_ctx, TDB_DATA d);
     52
     53/****************************************************************************
     54 Lock a chain, with timeout.
     55****************************************************************************/
     56int tdb_chainlock_with_timeout( struct tdb_context *tdb, TDB_DATA key,
     57                                unsigned int timeout);
     58
     59/****************************************************************************
     60 Lock a chain by string, with timeout Return non-zero if lock failed.
     61****************************************************************************/
     62int tdb_lock_bystring_with_timeout(struct tdb_context *tdb, const char *keyval,
     63                                   int timeout);
     64
     65/****************************************************************************
     66 Readlock a chain by string, with timeout Return non-zero if lock failed.
     67****************************************************************************/
     68int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
     69                                        unsigned int timeout);
     70
     71
    5472#endif /* __TDBUTIL_H__ */
  • vendor/current/source3/include/vfs.h

    r740 r988  
    77   Copyright (C) Stefan (metze) Metzmacher              2003
    88   Copyright (C) Volker Lendecke                        2009
    9    
     9
    1010   This program is free software; you can redistribute it and/or modify
    1111   it under the terms of the GNU General Public License as published by
    1212   the Free Software Foundation; either version 3 of the License, or
    1313   (at your option) any later version.
    14    
     14
    1515   This program is distributed in the hope that it will be useful,
    1616   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1717   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1818   GNU General Public License for more details.
    19    
     19
    2020   You should have received a copy of the GNU General Public License
    2121   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    135135/* Leave at 28 - not yet released. Add fdopendir. JRA. */
    136136/* Leave at 28 - not yet released. Rename open function to open_fn. - gd */
    137 #define SMB_VFS_INTERFACE_VERSION 28
     137/* Leave at 28 - not yet released. Make getwd function always return malloced memory. JRA. */
     138/* Bump to version 29 - Samba 3.6.0 will ship with interface version 28. */
     139/* Leave at 29 - not yet releases. Add fsctl. Richard Sharpe */
     140/* Leave at 29 - not yet released. add SMB_VFS_GET_DFS_REFERRAL() - metze */
     141/* Leave at 29 - not yet released. Remove l{list,get,set,remove}xattr - abartlet */
     142/* Leave at 29 - not yet released. move to plain off_t - abartlet */
     143/* Leave at 29 - not yet released. Remove sys_acl functions other than set and get - abartlet */
     144/* Leave at 29 - not yet released. Added backup_intent bool to files_struct - JRA */
     145/* Leave at 29 - not yet released. Add durable handle functions - metze/obnox */
     146/* Leave at 29 - not yet released. Added sys_acl_blob_get_file and sys_acl_blob_get_fd */
     147/* Bump to version 30 - Samba 4.0.0 will ship with interface version 30 */
     148/* Leave at 30 - not yet released. Added conn->cwd to save vfs_GetWd() calls. */
     149/* Leave at 30 - not yet released. Changed sys_acl_blob_get_file interface to remove type */
     150/* Bump to version 31 - Samba 4.1.0 will ship with interface version 31 */
     151/* Leave at 31 - not yet released. Make struct vuid_cache_entry in
     152                connection_struct a pointer. */
     153/* Leave at 31 - not yet released. Add share_access to vuid_cache_entry. */
     154/* Leave at 31 - not yet released. add SMB_VFS_COPY_CHUNK() */
     155/* Leave at 31 - not yet released. Remove the unused
     156                fsp->pending_break_messages array */
     157/* Leave at 31 - not yet released. add SMB_VFS_[GET/SET]_COMPRESSION() */
     158
     159/* Bump to version 32 - Samba 4.2 will ship with that. */
     160/* Version 32 - Add "lease" to CREATE_FILE operation */
     161/* Version 32 - Add "lease" to struct files_struct */
     162/* Version 32 - Add SMB_VFS_READDIR_ATTR() */
     163/* Version 32 - Add in and out create context blobs to create_file */
     164/* Version 32 - Remove unnecessary SMB_VFS_DISK_FREE() small_query parameter */
     165/* Bump to version 33 - Samba 4.3 will ship with that. */
     166/* Version 33 - change fallocate mode flags param from enum->uint32_t */
     167/* Version 33 - Add snapshot create/delete calls */
     168/* Version 33 - Add OS X SMB2 AAPL copyfile extension flag to fsp */
     169/* Version 33 - Remove notify_watch_fn */
     170/* Bump to version 34 - Samba 4.4 will ship with that */
     171/* Version 34 - Remove bool posix_open, add uint64_t posix_flags */
     172/* Version 34 - Added bool posix_pathnames to struct smb_request */
     173
     174#define SMB_VFS_INTERFACE_VERSION 34
    138175
    139176/*
     
    155192struct blocking_lock_record;
    156193struct smb_filename;
    157 
    158 #define VFS_FIND(__fn__) while (handle->fns->__fn__==NULL) { \
     194struct dfs_GetDFSReferral;
     195
     196typedef union unid_t {
     197        uid_t uid;
     198        gid_t gid;
     199} unid_t;
     200
     201struct fd_handle {
     202        size_t ref_count;
     203        int fd;
     204        uint64_t position_information;
     205        off_t pos;
     206        uint32_t private_options;       /* NT Create options, but we only look at
     207                                 * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
     208                                 * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB and
     209                                 * NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE
     210                                 * for print files *only*, where
     211                                 * DELETE_ON_CLOSE is not stored in the share
     212                                 * mode database.
     213                                 */
     214        unsigned long gen_id;
     215};
     216
     217struct fsp_lease {
     218        size_t ref_count;
     219        struct smbd_server_connection *sconn;
     220        struct tevent_timer *timeout;
     221        struct smb2_lease lease;
     222};
     223
     224typedef struct files_struct {
     225        struct files_struct *next, *prev;
     226        uint64_t fnum;
     227        struct smbXsrv_open *op;
     228        struct connection_struct *conn;
     229        struct fd_handle *fh;
     230        unsigned int num_smb_operations;
     231        struct file_id file_id;
     232        uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */
     233        uint16_t file_pid;
     234        uint64_t vuid; /* SMB2 compat */
     235        struct write_cache *wcp;
     236        struct timeval open_time;
     237        uint32_t access_mask;           /* NTCreateX access bits (FILE_READ_DATA etc.) */
     238        uint32_t share_access;          /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */
     239
     240        bool update_write_time_triggered;
     241        struct tevent_timer *update_write_time_event;
     242        bool update_write_time_on_close;
     243        struct timespec close_write_time;
     244        bool write_time_forced;
     245
     246        int oplock_type;
     247        struct fsp_lease *lease; /* Not yet used. Placeholder for leases. */
     248        int sent_oplock_break;
     249        struct tevent_timer *oplock_timeout;
     250        struct lock_struct last_lock_failure;
     251        int current_lock_count; /* Count the number of outstanding locks and pending locks. */
     252
     253        bool can_lock;
     254        bool can_read;
     255        bool can_write;
     256        bool modified;
     257        bool is_directory;
     258        bool aio_write_behind;
     259        bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */
     260        bool delete_on_close;
     261        uint64_t posix_flags;
     262        bool is_sparse;
     263        bool backup_intent; /* Handle was successfully opened with backup intent
     264                                and opener has privilege to do so. */
     265        bool aapl_copyfile_supported;
     266        struct smb_filename *fsp_name;
     267        uint32_t name_hash;             /* Jenkins hash of full pathname. */
     268        uint64_t mid;                   /* Mid of the operation that created us. */
     269
     270        struct vfs_fsp_data *vfs_extension;
     271        struct fake_file_handle *fake_file_handle;
     272
     273        struct notify_change_buf *notify;
     274
     275        struct files_struct *base_fsp; /* placeholder for delete on close */
     276
     277        /*
     278         * Read-only cached brlock record, thrown away when the
     279         * brlock.tdb seqnum changes. This avoids fetching data from
     280         * the brlock.tdb on every read/write call.
     281         */
     282        int brlock_seqnum;
     283        struct byte_range_lock *brlock_rec;
     284
     285        struct dptr_struct *dptr;
     286
     287        /* if not NULL, means this is a print file */
     288        struct print_file_data *print_file;
     289
     290        unsigned num_aio_requests;
     291        struct tevent_req **aio_requests;
     292
     293        /*
     294         * If a close request comes in while we still have aio_requests
     295         * around, we need to hold back the close. When all aio_requests are
     296         * done, the aio completion routines need tevent_wait_done() on
     297         * this. A bit ugly, but before we have close_file() fully async
     298         * possibly the simplest approach. Thanks, Jeremy for the idea.
     299         */
     300        struct tevent_req *deferred_close;
     301} files_struct;
     302
     303#define FSP_POSIX_FLAGS_OPEN            0x01
     304#define FSP_POSIX_FLAGS_RENAME          0x02
     305#define FSP_POSIX_FLAGS_PATHNAMES       0x04
     306
     307#define FSP_POSIX_FLAGS_ALL                     \
     308        (FSP_POSIX_FLAGS_OPEN |                 \
     309         FSP_POSIX_FLAGS_PATHNAMES |            \
     310         FSP_POSIX_FLAGS_RENAME)
     311
     312struct vuid_cache_entry {
     313        struct auth_session_info *session_info;
     314        uint64_t vuid; /* SMB2 compat */
     315        bool read_only;
     316        uint32_t share_access;
     317};
     318
     319struct vuid_cache {
     320        unsigned int next_entry;
     321        struct vuid_cache_entry array[VUID_CACHE_SIZE];
     322};
     323
     324typedef struct {
     325        char *name;
     326        bool is_wild;
     327} name_compare_entry;
     328
     329struct dfree_cached_info {
     330        time_t last_dfree_time;
     331        uint64_t dfree_ret;
     332        uint64_t bsize;
     333        uint64_t dfree;
     334        uint64_t dsize;
     335};
     336
     337struct share_params {
     338        int service;
     339};
     340
     341typedef struct connection_struct {
     342        struct connection_struct *next, *prev;
     343        struct smbd_server_connection *sconn; /* can be NULL */
     344        struct smbXsrv_tcon *tcon; /* can be NULL */
     345        uint32_t cnum; /* an index passed over the wire */
     346        struct share_params *params;
     347        bool force_user;
     348        struct vuid_cache *vuid_cache;
     349        bool printer;
     350        bool ipc;
     351        bool read_only; /* Attributes for the current user of the share. */
     352        uint32_t share_access;
     353        /* Does this filesystem honor
     354           sub second timestamps on files
     355           and directories when setting time ? */
     356        enum timestamp_set_resolution ts_res;
     357        char *connectpath;
     358        char *origpath;
     359        char *cwd; /* Working directory. */
     360
     361        struct vfs_handle_struct *vfs_handles;          /* for the new plugins */
     362
     363        /*
     364         * This represents the user information on this connection. Depending
     365         * on the vuid using this tid, this might change per SMB request.
     366         */
     367        struct auth_session_info *session_info;
     368
     369        /*
     370         * If the "force group" parameter is set, this is the primary gid that
     371         * may be used in the users token, depending on the vuid using this tid.
     372         */
     373        gid_t force_group_gid;
     374
     375        uint64_t vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
     376
     377        time_t lastused;
     378        time_t lastused_count;
     379        int num_files_open;
     380        unsigned int num_smb_operations; /* Count of smb operations on this tree. */
     381        int encrypt_level;
     382        bool encrypted_tid;
     383
     384        /* Semantics requested by the client or forced by the server config. */
     385        bool case_sensitive;
     386        bool case_preserve;
     387        bool short_case_preserve;
     388
     389        /* Semantics provided by the underlying filesystem. */
     390        int fs_capabilities;
     391        /* Device number of the directory of the share mount.
     392           Used to ensure unique FileIndex returns. */
     393        SMB_DEV_T base_share_dev;
     394
     395        name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */
     396        name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */
     397        name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */       
     398        name_compare_entry *aio_write_behind_list; /* Per-share list of files to use aio write behind on. */       
     399        struct dfree_cached_info *dfree_info;
     400        struct trans_state *pending_trans;
     401
     402        struct rpc_pipe_client *spoolss_pipe;
     403
     404} connection_struct;
     405
     406struct smbd_smb2_request;
     407struct privilege_paths;
     408
     409struct smb_request {
     410        uint8_t cmd;
     411        uint16_t flags2;
     412        uint16_t smbpid;
     413        uint64_t mid; /* For compatibility with SMB2. */
     414        uint32_t seqnum;
     415        uint64_t vuid; /* For compatibility with SMB2. */
     416        uint32_t tid;
     417        uint8_t  wct;
     418        const uint16_t *vwv;
     419        uint16_t buflen;
     420        const uint8_t *buf;
     421        const uint8_t *inbuf;
     422
     423        /*
     424         * Async handling in the main smb processing loop is directed by
     425         * outbuf: reply_xxx routines indicate sync behaviour by putting their
     426         * reply into "outbuf". If they leave it as NULL, they take care of it
     427         * themselves, possibly later.
     428         *
     429         * If async handling is wanted, the reply_xxx routine must make sure
     430         * that it talloc_move()s the smb_req somewhere else.
     431         */
     432        uint8_t *outbuf;
     433
     434        size_t unread_bytes;
     435        bool encrypted;
     436        connection_struct *conn;
     437        struct smbd_server_connection *sconn;
     438        struct smbXsrv_connection *xconn;
     439        struct smb_perfcount_data pcd;
     440
     441        /*
     442         * Chained request handling
     443         */
     444        struct files_struct *chain_fsp;
     445
     446        /*
     447         * state information for async smb handling
     448         */
     449        void *async_priv;
     450
     451        /*
     452         * Back pointer to smb2 request.
     453         */
     454        struct smbd_smb2_request *smb2req;
     455
     456        /*
     457         * Pathnames used if request done
     458         * under privilege.
     459         */
     460        struct privilege_paths *priv_paths;
     461
     462        /*
     463         * Request list for chained requests, we're part of it.
     464         */
     465        struct smb_request **chain;
     466
     467        struct timeval request_time;
     468
     469        bool posix_pathnames;
     470};
     471
     472/*
     473 * Info about an alternate data stream
     474 */
     475
     476struct stream_struct {
     477        off_t size;
     478        off_t alloc_size;
     479        char *name;
     480};
     481
     482/* time info */
     483struct smb_file_time {
     484        struct timespec mtime;
     485        struct timespec atime;
     486        struct timespec ctime;
     487        struct timespec create_time;
     488};
     489
     490/*
     491 * smb_filename
     492 */
     493struct smb_filename {
     494        char *base_name;
     495        char *stream_name;
     496        char *original_lcomp;
     497        SMB_STRUCT_STAT st;
     498};
     499
     500#define VFS_FIND(__fn__) while (handle->fns->__fn__##_fn==NULL) { \
    159501                                handle = handle->next; \
    160502                         }
     
    165507};
    166508
    167 enum vfs_fallocate_mode {
    168         VFS_FALLOCATE_EXTEND_SIZE = 0,
    169         VFS_FALLOCATE_KEEP_SIZE = 1
     509enum vfs_fallocate_flags {
     510        VFS_FALLOCATE_FL_KEEP_SIZE              = 0x0001,
     511        VFS_FALLOCATE_FL_PUNCH_HOLE             = 0x0002,
    170512};
    171513
     
    182524
    183525        int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user);
    184         void (*disconnect)(struct vfs_handle_struct *handle);
    185         uint64_t (*disk_free)(struct vfs_handle_struct *handle, const char *path, bool small_query, uint64_t *bsize,
     526        void (*disconnect_fn)(struct vfs_handle_struct *handle);
     527        uint64_t (*disk_free_fn)(struct vfs_handle_struct *handle, const char *path, uint64_t *bsize,
    186528                              uint64_t *dfree, uint64_t *dsize);
    187         int (*get_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
    188         int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
    189         int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels);
    190         int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
    191         uint32_t (*fs_capabilities)(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res);
     529        int (*get_quota_fn)(struct vfs_handle_struct *handle, const char *path,
     530                            enum SMB_QUOTA_TYPE qtype, unid_t id,
     531                            SMB_DISK_QUOTA *qt);
     532        int (*set_quota_fn)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
     533        int (*get_shadow_copy_data_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels);
     534        int (*statvfs_fn)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
     535        uint32_t (*fs_capabilities_fn)(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res);
     536
     537        /*
     538         * Note: that "struct dfs_GetDFSReferral *r"
     539         * needs to be a valid TALLOC_CTX
     540         */
     541        NTSTATUS (*get_dfs_referrals_fn)(struct vfs_handle_struct *handle,
     542                                         struct dfs_GetDFSReferral *r);
    192543
    193544        /* Directory operations */
    194545
    195         SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes);
    196         SMB_STRUCT_DIR *(*fdopendir)(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attributes);
    197         SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle,
    198                                       SMB_STRUCT_DIR *dirp,
    199                                       SMB_STRUCT_STAT *sbuf);
    200         void (*seekdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset);
    201         long (*telldir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
    202         void (*rewind_dir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
    203         int (*mkdir)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
    204         int (*rmdir)(struct vfs_handle_struct *handle, const char *path);
    205         int (*closedir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir);
    206         void (*init_search_op)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
     546        DIR *(*opendir_fn)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attributes);
     547        DIR *(*fdopendir_fn)(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32_t attributes);
     548        struct dirent *(*readdir_fn)(struct vfs_handle_struct *handle,
     549                                         DIR *dirp,
     550                                        SMB_STRUCT_STAT *sbuf);
     551        void (*seekdir_fn)(struct vfs_handle_struct *handle, DIR *dirp, long offset);
     552        long (*telldir_fn)(struct vfs_handle_struct *handle, DIR *dirp);
     553        void (*rewind_dir_fn)(struct vfs_handle_struct *handle, DIR *dirp);
     554        int (*mkdir_fn)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
     555        int (*rmdir_fn)(struct vfs_handle_struct *handle, const char *path);
     556        int (*closedir_fn)(struct vfs_handle_struct *handle, DIR *dir);
     557        void (*init_search_op_fn)(struct vfs_handle_struct *handle, DIR *dirp);
    207558
    208559        /* File operations */
     
    211562                       struct smb_filename *smb_fname, files_struct *fsp,
    212563                       int flags, mode_t mode);
    213         NTSTATUS (*create_file)(struct vfs_handle_struct *handle,
    214                                 struct smb_request *req,
    215                                 uint16_t root_dir_fid,
    216                                 struct smb_filename *smb_fname,
    217                                 uint32_t access_mask,
    218                                 uint32_t share_access,
    219                                 uint32_t create_disposition,
    220                                 uint32_t create_options,
    221                                 uint32_t file_attributes,
    222                                 uint32_t oplock_request,
    223                                 uint64_t allocation_size,
    224                                 uint32_t private_flags,
    225                                 struct security_descriptor *sd,
    226                                 struct ea_list *ea_list,
    227                                 files_struct **result,
    228                                 int *pinfo);
     564        NTSTATUS (*create_file_fn)(struct vfs_handle_struct *handle,
     565                                   struct smb_request *req,
     566                                   uint16_t root_dir_fid,
     567                                   struct smb_filename *smb_fname,
     568                                   uint32_t access_mask,
     569                                   uint32_t share_access,
     570                                   uint32_t create_disposition,
     571                                   uint32_t create_options,
     572                                   uint32_t file_attributes,
     573                                   uint32_t oplock_request,
     574                                   struct smb2_lease *lease,
     575                                   uint64_t allocation_size,
     576                                   uint32_t private_flags,
     577                                   struct security_descriptor *sd,
     578                                   struct ea_list *ea_list,
     579                                   files_struct **result,
     580                                   int *pinfo,
     581                                   const struct smb2_create_blobs *in_context_blobs,
     582                                   struct smb2_create_blobs *out_context_blobs);
    229583        int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
    230         ssize_t (*vfs_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
    231         ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset);
    232         ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n);
    233         ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset);
    234         SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence);
    235         ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
    236         ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t count);
    237         int (*rename)(struct vfs_handle_struct *handle,
    238                       const struct smb_filename *smb_fname_src,
    239                       const struct smb_filename *smb_fname_dst);
    240         int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp);
    241         int (*stat)(struct vfs_handle_struct *handle, struct smb_filename *smb_fname);
    242         int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
    243         int (*lstat)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename);
    244         uint64_t (*get_alloc_size)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
    245         int (*unlink)(struct vfs_handle_struct *handle,
    246                       const struct smb_filename *smb_fname);
    247         int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
    248         int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
    249         int (*chown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
    250         int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, uid_t uid, gid_t gid);
    251         int (*lchown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
    252         int (*chdir)(struct vfs_handle_struct *handle, const char *path);
    253         char *(*getwd)(struct vfs_handle_struct *handle, char *buf);
    254         int (*ntimes)(struct vfs_handle_struct *handle,
    255                       const struct smb_filename *smb_fname,
    256                       struct smb_file_time *ft);
    257         int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset);
    258         int (*fallocate)(struct vfs_handle_struct *handle,
    259                                 struct files_struct *fsp,
    260                                 enum vfs_fallocate_mode mode,
    261                                 SMB_OFF_T offset,
    262                                 SMB_OFF_T len);
    263         bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
    264         int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp,
    265                             uint32 share_mode, uint32_t access_mask);
    266         int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype);
    267         bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
    268         int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
    269         int (*vfs_readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz);
    270         int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
    271         int (*mknod)(struct vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev);
    272         char *(*realpath)(struct vfs_handle_struct *handle, const char *path);
    273         NTSTATUS (*notify_watch)(struct vfs_handle_struct *handle,
    274                                  struct sys_notify_context *ctx,
    275                                  struct notify_entry *e,
    276                                  void (*callback)(struct sys_notify_context *ctx,
    277                                                   void *private_data,
    278                                                   struct notify_event *ev),
    279                                  void *private_data, void *handle_p);
    280         int (*chflags)(struct vfs_handle_struct *handle, const char *path, unsigned int flags);
    281         struct file_id (*file_id_create)(struct vfs_handle_struct *handle,
    282                                          const SMB_STRUCT_STAT *sbuf);
    283 
    284         NTSTATUS (*streaminfo)(struct vfs_handle_struct *handle,
     584        ssize_t (*read_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
     585        ssize_t (*pread_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, off_t offset);
     586        struct tevent_req *(*pread_send_fn)(struct vfs_handle_struct *handle,
     587                                            TALLOC_CTX *mem_ctx,
     588                                            struct tevent_context *ev,
     589                                            struct files_struct *fsp,
     590                                            void *data,
     591                                            size_t n, off_t offset);
     592        ssize_t (*pread_recv_fn)(struct tevent_req *req, int *err);
     593        ssize_t (*write_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n);
     594        ssize_t (*pwrite_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, off_t offset);
     595        struct tevent_req *(*pwrite_send_fn)(struct vfs_handle_struct *handle,
     596                                             TALLOC_CTX *mem_ctx,
     597                                             struct tevent_context *ev,
     598                                             struct files_struct *fsp,
     599                                             const void *data,
     600                                             size_t n, off_t offset);
     601        ssize_t (*pwrite_recv_fn)(struct tevent_req *req, int *err);
     602        off_t (*lseek_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset, int whence);
     603        ssize_t (*sendfile_fn)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, off_t offset, size_t count);
     604        ssize_t (*recvfile_fn)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t count);
     605        int (*rename_fn)(struct vfs_handle_struct *handle,
     606                         const struct smb_filename *smb_fname_src,
     607                         const struct smb_filename *smb_fname_dst);
     608        int (*fsync_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
     609        struct tevent_req *(*fsync_send_fn)(struct vfs_handle_struct *handle,
     610                                            TALLOC_CTX *mem_ctx,
     611                                            struct tevent_context *ev,
     612                                            struct files_struct *fsp);
     613        int (*fsync_recv_fn)(struct tevent_req *req, int *err);
     614        int (*stat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_fname);
     615        int (*fstat_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
     616        int (*lstat_fn)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename);
     617        uint64_t (*get_alloc_size_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
     618        int (*unlink_fn)(struct vfs_handle_struct *handle,
     619                         const struct smb_filename *smb_fname);
     620        int (*chmod_fn)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
     621        int (*fchmod_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
     622        int (*chown_fn)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
     623        int (*fchown_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, uid_t uid, gid_t gid);
     624        int (*lchown_fn)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid);
     625        int (*chdir_fn)(struct vfs_handle_struct *handle, const char *path);
     626        char *(*getwd_fn)(struct vfs_handle_struct *handle);
     627        int (*ntimes_fn)(struct vfs_handle_struct *handle,
     628                         const struct smb_filename *smb_fname,
     629                         struct smb_file_time *ft);
     630        int (*ftruncate_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset);
     631        int (*fallocate_fn)(struct vfs_handle_struct *handle,
     632                            struct files_struct *fsp,
     633                            uint32_t mode,
     634                            off_t offset,
     635                            off_t len);
     636        bool (*lock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, off_t offset, off_t count, int type);
     637        int (*kernel_flock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp,
     638                               uint32_t share_mode, uint32_t access_mask);
     639        int (*linux_setlease_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype);
     640        bool (*getlock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
     641        int (*symlink_fn)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
     642        int (*readlink_fn)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz);
     643        int (*link_fn)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
     644        int (*mknod_fn)(struct vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev);
     645        char *(*realpath_fn)(struct vfs_handle_struct *handle, const char *path);
     646        int (*chflags_fn)(struct vfs_handle_struct *handle, const char *path, unsigned int flags);
     647        struct file_id (*file_id_create_fn)(struct vfs_handle_struct *handle,
     648                                            const SMB_STRUCT_STAT *sbuf);
     649        struct tevent_req *(*copy_chunk_send_fn)(struct vfs_handle_struct *handle,
     650                                                 TALLOC_CTX *mem_ctx,
     651                                                 struct tevent_context *ev,
     652                                                 struct files_struct *src_fsp,
     653                                                 off_t src_off,
     654                                                 struct files_struct *dest_fsp,
     655                                                 off_t dest_off,
     656                                                 off_t num);
     657        NTSTATUS (*copy_chunk_recv_fn)(struct vfs_handle_struct *handle,
     658                                       struct tevent_req *req,
     659                                       off_t *copied);
     660        NTSTATUS (*get_compression_fn)(struct vfs_handle_struct *handle,
     661                                       TALLOC_CTX *mem_ctx,
     662                                       struct files_struct *fsp,
     663                                       struct smb_filename *smb_fname,
     664                                       uint16_t *_compression_fmt);
     665        NTSTATUS (*set_compression_fn)(struct vfs_handle_struct *handle,
     666                                       TALLOC_CTX *mem_ctx,
     667                                       struct files_struct *fsp,
     668                                       uint16_t compression_fmt);
     669        NTSTATUS (*snap_check_path_fn)(struct vfs_handle_struct *handle,
     670                                       TALLOC_CTX *mem_ctx,
     671                                       const char *service_path,
     672                                       char **base_volume);
     673        NTSTATUS (*snap_create_fn)(struct vfs_handle_struct *handle,
     674                                   TALLOC_CTX *mem_ctx,
     675                                   const char *base_volume,
     676                                   time_t *tstamp,
     677                                   bool rw,
     678                                   char **base_path,
     679                                   char **snap_path);
     680        NTSTATUS (*snap_delete_fn)(struct vfs_handle_struct *handle,
     681                                   TALLOC_CTX *mem_ctx,
     682                                   char *base_path,
     683                                   char *snap_path);
     684
     685        NTSTATUS (*streaminfo_fn)(struct vfs_handle_struct *handle,
     686                                  struct files_struct *fsp,
     687                                  const char *fname,
     688                                  TALLOC_CTX *mem_ctx,
     689                                  unsigned int *num_streams,
     690                                  struct stream_struct **streams);
     691
     692        int (*get_real_filename_fn)(struct vfs_handle_struct *handle,
     693                                    const char *path,
     694                                    const char *name,
     695                                    TALLOC_CTX *mem_ctx,
     696                                    char **found_name);
     697
     698        const char *(*connectpath_fn)(struct vfs_handle_struct *handle,
     699                                      const char *filename);
     700
     701        NTSTATUS (*brl_lock_windows_fn)(struct vfs_handle_struct *handle,
     702                                        struct byte_range_lock *br_lck,
     703                                        struct lock_struct *plock,
     704                                        bool blocking_lock);
     705
     706        bool (*brl_unlock_windows_fn)(struct vfs_handle_struct *handle,
     707                                      struct messaging_context *msg_ctx,
     708                                      struct byte_range_lock *br_lck,
     709                                      const struct lock_struct *plock);
     710
     711        bool (*brl_cancel_windows_fn)(struct vfs_handle_struct *handle,
     712                                      struct byte_range_lock *br_lck,
     713                                      struct lock_struct *plock);
     714
     715        bool (*strict_lock_fn)(struct vfs_handle_struct *handle,
    285716                               struct files_struct *fsp,
    286                                const char *fname,
    287                                TALLOC_CTX *mem_ctx,
    288                                unsigned int *num_streams,
    289                                struct stream_struct **streams);
    290 
    291         int (*get_real_filename)(struct vfs_handle_struct *handle,
    292                                  const char *path,
    293                                  const char *name,
    294                                  TALLOC_CTX *mem_ctx,
    295                                  char **found_name);
    296 
    297         const char *(*connectpath)(struct vfs_handle_struct *handle,
    298                                    const char *filename);
    299 
    300         NTSTATUS (*brl_lock_windows)(struct vfs_handle_struct *handle,
    301                                      struct byte_range_lock *br_lck,
    302                                      struct lock_struct *plock,
    303                                      bool blocking_lock,
    304                                      struct blocking_lock_record *blr);
    305 
    306         bool (*brl_unlock_windows)(struct vfs_handle_struct *handle,
    307                                    struct messaging_context *msg_ctx,
    308                                    struct byte_range_lock *br_lck,
    309                                    const struct lock_struct *plock);
    310 
    311         bool (*brl_cancel_windows)(struct vfs_handle_struct *handle,
    312                                    struct byte_range_lock *br_lck,
    313                                    struct lock_struct *plock,
    314                                    struct blocking_lock_record *blr);
    315 
    316         bool (*strict_lock)(struct vfs_handle_struct *handle,
    317                             struct files_struct *fsp,
    318                             struct lock_struct *plock);
    319 
    320         void (*strict_unlock)(struct vfs_handle_struct *handle,
    321                               struct files_struct *fsp,
    322                               struct lock_struct *plock);
    323 
    324         NTSTATUS (*translate_name)(struct vfs_handle_struct *handle,
    325                                    const char *name,
    326                                    enum vfs_translate_direction direction,
     717                               struct lock_struct *plock);
     718
     719        void (*strict_unlock_fn)(struct vfs_handle_struct *handle,
     720                                 struct files_struct *fsp,
     721                                 struct lock_struct *plock);
     722
     723        NTSTATUS (*translate_name_fn)(struct vfs_handle_struct *handle,
     724                                      const char *name,
     725                                      enum vfs_translate_direction direction,
     726                                      TALLOC_CTX *mem_ctx,
     727                                      char **mapped_name);
     728
     729        NTSTATUS (*fsctl_fn)(struct vfs_handle_struct *handle,
     730                             struct files_struct *fsp,
     731                             TALLOC_CTX *ctx,
     732                             uint32_t function,
     733                             uint16_t req_flags,
     734                             const uint8_t *_in_data,
     735                             uint32_t in_len,
     736                             uint8_t **_out_data,
     737                             uint32_t max_out_len,
     738                             uint32_t *out_len);
     739
     740        /* NT ACL operations. */
     741
     742        NTSTATUS (*fget_nt_acl_fn)(struct vfs_handle_struct *handle,
     743                                   struct files_struct *fsp,
     744                                   uint32_t security_info,
    327745                                   TALLOC_CTX *mem_ctx,
    328                                    char **mapped_name);
    329 
    330         /* NT ACL operations. */
    331 
    332         NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle,
    333                                 struct files_struct *fsp,
    334                                 uint32 security_info,
    335                                 struct security_descriptor **ppdesc);
    336         NTSTATUS (*get_nt_acl)(struct vfs_handle_struct *handle,
    337                                const char *name,
    338                                uint32 security_info,
    339                                struct security_descriptor **ppdesc);
    340         NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle,
    341                                 struct files_struct *fsp,
    342                                 uint32 security_info_sent,
    343                                 const struct security_descriptor *psd);
     746                                   struct security_descriptor **ppdesc);
     747        NTSTATUS (*get_nt_acl_fn)(struct vfs_handle_struct *handle,
     748                                  const char *name,
     749                                  uint32_t security_info,
     750                                   TALLOC_CTX *mem_ctx,
     751                                  struct security_descriptor **ppdesc);
     752        NTSTATUS (*fset_nt_acl_fn)(struct vfs_handle_struct *handle,
     753                                   struct files_struct *fsp,
     754                                   uint32_t security_info_sent,
     755                                   const struct security_descriptor *psd);
     756
     757        NTSTATUS (*audit_file_fn)(struct vfs_handle_struct *handle,
     758                                  struct smb_filename *file,
     759                                  struct security_acl *sacl,
     760                                  uint32_t access_requested,
     761                                  uint32_t access_denied);
    344762
    345763        /* POSIX ACL operations. */
    346764
    347         int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode);
    348         int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
    349 
    350         int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
    351         int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
    352         int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
    353         void * (*sys_acl_get_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d);
    354         SMB_ACL_T (*sys_acl_get_file)(struct vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type);
    355         SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp);
    356         int (*sys_acl_clear_perms)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset);
    357         int (*sys_acl_add_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
    358         char * (*sys_acl_to_text)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen);
    359         SMB_ACL_T (*sys_acl_init)(struct vfs_handle_struct *handle, int count);
    360         int (*sys_acl_create_entry)(struct vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
    361         int (*sys_acl_set_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
    362         int (*sys_acl_set_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual);
    363         int (*sys_acl_set_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
    364         int (*sys_acl_valid)(struct vfs_handle_struct *handle, SMB_ACL_T theacl );
    365         int (*sys_acl_set_file)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
    366         int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
    367         int (*sys_acl_delete_def_file)(struct vfs_handle_struct *handle, const char *path);
    368         int (*sys_acl_get_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
    369         int (*sys_acl_free_text)(struct vfs_handle_struct *handle, char *text);
    370         int (*sys_acl_free_acl)(struct vfs_handle_struct *handle, SMB_ACL_T posix_acl);
    371         int (*sys_acl_free_qualifier)(struct vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype);
     765        int (*chmod_acl_fn)(struct vfs_handle_struct *handle, const char *name, mode_t mode);
     766        int (*fchmod_acl_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode);
     767
     768        SMB_ACL_T (*sys_acl_get_file_fn)(struct vfs_handle_struct *handle,
     769                                         const char *path_p,
     770                                         SMB_ACL_TYPE_T type,
     771                                         TALLOC_CTX *mem_ctx);
     772        SMB_ACL_T (*sys_acl_get_fd_fn)(struct vfs_handle_struct *handle,
     773                                       struct files_struct *fsp,
     774                                       TALLOC_CTX *mem_ctx);
     775        int (*sys_acl_blob_get_file_fn)(struct vfs_handle_struct *handle,
     776                                        const char *path_p,
     777                                        TALLOC_CTX *mem_ctx,
     778                                        char **blob_description,
     779                                        DATA_BLOB *blob);
     780        int (*sys_acl_blob_get_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp,
     781                                      TALLOC_CTX *mem_ctx, char **blob_description,
     782                                      DATA_BLOB *blob);
     783        int (*sys_acl_set_file_fn)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
     784        int (*sys_acl_set_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
     785        int (*sys_acl_delete_def_file_fn)(struct vfs_handle_struct *handle, const char *path);
    372786
    373787        /* EA operations. */
    374         ssize_t (*getxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
    375         ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
    376         ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size);
    377         ssize_t (*listxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
    378         ssize_t (*llistxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
    379         ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
    380         int (*removexattr)(struct vfs_handle_struct *handle, const char *path, const char *name);
    381         int (*lremovexattr)(struct vfs_handle_struct *handle, const char *path, const char *name);
    382         int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name);
    383         int (*setxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
    384         int (*lsetxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
    385         int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags);
     788        ssize_t (*getxattr_fn)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
     789        ssize_t (*fgetxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size);
     790        ssize_t (*listxattr_fn)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
     791        ssize_t (*flistxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
     792        int (*removexattr_fn)(struct vfs_handle_struct *handle, const char *path, const char *name);
     793        int (*fremovexattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name);
     794        int (*setxattr_fn)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags);
     795        int (*fsetxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags);
    386796
    387797        /* aio operations */
    388         int (*aio_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
    389         int (*aio_write)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
    390         ssize_t (*aio_return_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
    391         int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
    392         int (*aio_error_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
    393         int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb);
    394         int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout);
    395         bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp);
     798        bool (*aio_force_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
    396799
    397800        /* offline operations */
    398         bool (*is_offline)(struct vfs_handle_struct *handle,
     801        bool (*is_offline_fn)(struct vfs_handle_struct *handle,
    399802                           const struct smb_filename *fname,
    400803                           SMB_STRUCT_STAT *sbuf);
    401         int (*set_offline)(struct vfs_handle_struct *handle,
     804        int (*set_offline_fn)(struct vfs_handle_struct *handle,
    402805                           const struct smb_filename *fname);
     806
     807        /* durable handle operations */
     808        NTSTATUS (*durable_cookie_fn)(struct vfs_handle_struct *handle,
     809                                      struct files_struct *fsp,
     810                                      TALLOC_CTX *mem_ctx,
     811                                      DATA_BLOB *cookie);
     812        NTSTATUS (*durable_disconnect_fn)(struct vfs_handle_struct *handle,
     813                                          struct files_struct *fsp,
     814                                          const DATA_BLOB old_cookie,
     815                                          TALLOC_CTX *mem_ctx,
     816                                          DATA_BLOB *new_cookie);
     817        NTSTATUS (*durable_reconnect_fn)(struct vfs_handle_struct *handle,
     818                                         struct smb_request *smb1req,
     819                                         struct smbXsrv_open *op,
     820                                         const DATA_BLOB old_cookie,
     821                                         TALLOC_CTX *mem_ctx,
     822                                         struct files_struct **fsp,
     823                                         DATA_BLOB *new_cookie);
     824
     825        NTSTATUS (*readdir_attr_fn)(struct vfs_handle_struct *handle,
     826                                    const struct smb_filename *fname,
     827                                    TALLOC_CTX *mem_ctx,
     828                                    struct readdir_attr_data **attr_data);
    403829};
    404830
     
    422848typedef struct vfs_statvfs_struct {
    423849        /* For undefined recommended transfer size return -1 in that field */
    424         uint32 OptimalTransferSize;  /* bsize on some os, iosize on other os */
    425         uint32 BlockSize;
     850        uint32_t OptimalTransferSize;  /* bsize on some os, iosize on other os */
     851        uint32_t BlockSize;
    426852
    427853        /*
     
    506932void smb_vfs_call_disconnect(struct vfs_handle_struct *handle);
    507933uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
    508                                 const char *path, bool small_query,
    509                                 uint64_t *bsize, uint64_t *dfree,
    510                                 uint64_t *dsize);
    511 int smb_vfs_call_get_quota(struct vfs_handle_struct *handle,
     934                                const char *path, uint64_t *bsize,
     935                                uint64_t *dfree, uint64_t *dsize);
     936int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, const char *path,
    512937                           enum SMB_QUOTA_TYPE qtype, unid_t id,
    513938                           SMB_DISK_QUOTA *qt);
     
    522947                         struct vfs_statvfs_struct *statbuf);
    523948uint32_t smb_vfs_call_fs_capabilities(struct vfs_handle_struct *handle,
    524                         enum timestamp_set_resolution *p_ts_res);
    525 SMB_STRUCT_DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
     949                                      enum timestamp_set_resolution *p_ts_res);
     950/*
     951 * Note: that "struct dfs_GetDFSReferral *r" needs to be a valid TALLOC_CTX
     952 */
     953NTSTATUS smb_vfs_call_get_dfs_referrals(struct vfs_handle_struct *handle,
     954                                        struct dfs_GetDFSReferral *r);
     955DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
    526956                                     const char *fname, const char *mask,
    527                                      uint32 attributes);
    528 SMB_STRUCT_DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
     957                                     uint32_t attributes);
     958DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
    529959                                        struct files_struct *fsp,
    530960                                        const char *mask,
    531                                         uint32 attributes);
    532 SMB_STRUCT_DIRENT *smb_vfs_call_readdir(struct vfs_handle_struct *handle,
    533                                         SMB_STRUCT_DIR *dirp,
     961                                        uint32_t attributes);
     962struct dirent *smb_vfs_call_readdir(struct vfs_handle_struct *handle,
     963                                        DIR *dirp,
    534964                                        SMB_STRUCT_STAT *sbuf);
    535965void smb_vfs_call_seekdir(struct vfs_handle_struct *handle,
    536                           SMB_STRUCT_DIR *dirp, long offset);
     966                          DIR *dirp, long offset);
    537967long smb_vfs_call_telldir(struct vfs_handle_struct *handle,
    538                           SMB_STRUCT_DIR *dirp);
     968                          DIR *dirp);
    539969void smb_vfs_call_rewind_dir(struct vfs_handle_struct *handle,
    540                              SMB_STRUCT_DIR *dirp);
     970                             DIR *dirp);
    541971int smb_vfs_call_mkdir(struct vfs_handle_struct *handle, const char *path,
    542972                       mode_t mode);
    543973int smb_vfs_call_rmdir(struct vfs_handle_struct *handle, const char *path);
    544974int smb_vfs_call_closedir(struct vfs_handle_struct *handle,
    545                           SMB_STRUCT_DIR *dir);
     975                          DIR *dir);
    546976void smb_vfs_call_init_search_op(struct vfs_handle_struct *handle,
    547                                  SMB_STRUCT_DIR *dirp);
     977                                 DIR *dirp);
    548978int smb_vfs_call_open(struct vfs_handle_struct *handle,
    549979                      struct smb_filename *smb_fname, struct files_struct *fsp,
     
    559989                                  uint32_t file_attributes,
    560990                                  uint32_t oplock_request,
     991                                  struct smb2_lease *lease,
    561992                                  uint64_t allocation_size,
    562993                                  uint32_t private_flags,
     
    564995                                  struct ea_list *ea_list,
    565996                                  files_struct **result,
    566                                   int *pinfo);
    567 int smb_vfs_call_close_fn(struct vfs_handle_struct *handle,
    568                           struct files_struct *fsp);
    569 ssize_t smb_vfs_call_vfs_read(struct vfs_handle_struct *handle,
    570                               struct files_struct *fsp, void *data, size_t n);
     997                                  int *pinfo,
     998                                  const struct smb2_create_blobs *in_context_blobs,
     999                                  struct smb2_create_blobs *out_context_blobs);
     1000int smb_vfs_call_close(struct vfs_handle_struct *handle,
     1001                       struct files_struct *fsp);
     1002ssize_t smb_vfs_call_read(struct vfs_handle_struct *handle,
     1003                          struct files_struct *fsp, void *data, size_t n);
    5711004ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle,
    5721005                           struct files_struct *fsp, void *data, size_t n,
    573                            SMB_OFF_T offset);
     1006                           off_t offset);
     1007struct tevent_req *smb_vfs_call_pread_send(struct vfs_handle_struct *handle,
     1008                                           TALLOC_CTX *mem_ctx,
     1009                                           struct tevent_context *ev,
     1010                                           struct files_struct *fsp,
     1011                                           void *data,
     1012                                           size_t n, off_t offset);
     1013ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, int *perrno);
     1014
    5741015ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle,
    5751016                           struct files_struct *fsp, const void *data,
     
    5771018ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle,
    5781019                            struct files_struct *fsp, const void *data,
    579                             size_t n, SMB_OFF_T offset);
    580 SMB_OFF_T smb_vfs_call_lseek(struct vfs_handle_struct *handle,
    581                              struct files_struct *fsp, SMB_OFF_T offset,
     1020                            size_t n, off_t offset);
     1021struct tevent_req *smb_vfs_call_pwrite_send(struct vfs_handle_struct *handle,
     1022                                            TALLOC_CTX *mem_ctx,
     1023                                            struct tevent_context *ev,
     1024                                            struct files_struct *fsp,
     1025                                            const void *data,
     1026                                            size_t n, off_t offset);
     1027ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, int *perrno);
     1028
     1029off_t smb_vfs_call_lseek(struct vfs_handle_struct *handle,
     1030                             struct files_struct *fsp, off_t offset,
    5821031                             int whence);
    5831032ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd,
    5841033                              files_struct *fromfsp, const DATA_BLOB *header,
    585                               SMB_OFF_T offset, size_t count);
     1034                              off_t offset, size_t count);
    5861035ssize_t smb_vfs_call_recvfile(struct vfs_handle_struct *handle, int fromfd,
    587                               files_struct *tofsp, SMB_OFF_T offset,
     1036                              files_struct *tofsp, off_t offset,
    5881037                              size_t count);
    5891038int smb_vfs_call_rename(struct vfs_handle_struct *handle,
     
    5921041int smb_vfs_call_fsync(struct vfs_handle_struct *handle,
    5931042                       struct files_struct *fsp);
     1043
     1044struct tevent_req *smb_vfs_call_fsync_send(struct vfs_handle_struct *handle,
     1045                                           TALLOC_CTX *mem_ctx,
     1046                                           struct tevent_context *ev,
     1047                                           struct files_struct *fsp);
     1048int SMB_VFS_FSYNC_RECV(struct tevent_req *req, int *perrno);
     1049
    5941050int smb_vfs_call_stat(struct vfs_handle_struct *handle,
    5951051                      struct smb_filename *smb_fname);
     
    6141070                        uid_t uid, gid_t gid);
    6151071int smb_vfs_call_chdir(struct vfs_handle_struct *handle, const char *path);
    616 char *smb_vfs_call_getwd(struct vfs_handle_struct *handle, char *buf);
     1072char *smb_vfs_call_getwd(struct vfs_handle_struct *handle);
    6171073int smb_vfs_call_ntimes(struct vfs_handle_struct *handle,
    6181074                        const struct smb_filename *smb_fname,
    6191075                        struct smb_file_time *ft);
    6201076int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle,
    621                            struct files_struct *fsp, SMB_OFF_T offset);
     1077                           struct files_struct *fsp, off_t offset);
    6221078int smb_vfs_call_fallocate(struct vfs_handle_struct *handle,
    623                         struct files_struct *fsp,
    624                         enum vfs_fallocate_mode mode,
    625                         SMB_OFF_T offset,
    626                         SMB_OFF_T len);
     1079                           struct files_struct *fsp,
     1080                           uint32_t mode,
     1081                           off_t offset,
     1082                           off_t len);
    6271083bool smb_vfs_call_lock(struct vfs_handle_struct *handle,
    628                        struct files_struct *fsp, int op, SMB_OFF_T offset,
    629                        SMB_OFF_T count, int type);
     1084                       struct files_struct *fsp, int op, off_t offset,
     1085                       off_t count, int type);
    6301086int smb_vfs_call_kernel_flock(struct vfs_handle_struct *handle,
    631                               struct files_struct *fsp, uint32 share_mode,
     1087                              struct files_struct *fsp, uint32_t share_mode,
    6321088                              uint32_t access_mask);
    6331089int smb_vfs_call_linux_setlease(struct vfs_handle_struct *handle,
    6341090                                struct files_struct *fsp, int leasetype);
    6351091bool smb_vfs_call_getlock(struct vfs_handle_struct *handle,
    636                           struct files_struct *fsp, SMB_OFF_T *poffset,
    637                           SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
     1092                          struct files_struct *fsp, off_t *poffset,
     1093                          off_t *pcount, int *ptype, pid_t *ppid);
    6381094int smb_vfs_call_symlink(struct vfs_handle_struct *handle, const char *oldpath,
    6391095                         const char *newpath);
    640 int smb_vfs_call_vfs_readlink(struct vfs_handle_struct *handle,
    641                               const char *path, char *buf, size_t bufsiz);
     1096int smb_vfs_call_readlink(struct vfs_handle_struct *handle,
     1097                          const char *path, char *buf, size_t bufsiz);
    6421098int smb_vfs_call_link(struct vfs_handle_struct *handle, const char *oldpath,
    6431099                      const char *newpath);
     
    6451101                       mode_t mode, SMB_DEV_T dev);
    6461102char *smb_vfs_call_realpath(struct vfs_handle_struct *handle, const char *path);
    647 NTSTATUS smb_vfs_call_notify_watch(struct vfs_handle_struct *handle,
    648                                    struct sys_notify_context *ctx,
    649                                    struct notify_entry *e,
    650                                    void (*callback)(struct sys_notify_context *ctx,
    651                                                     void *private_data,
    652                                                     struct notify_event *ev),
    653                                    void *private_data, void *handle_p);
    6541103int smb_vfs_call_chflags(struct vfs_handle_struct *handle, const char *path,
    6551104                         unsigned int flags);
     
    6701119                                       struct byte_range_lock *br_lck,
    6711120                                       struct lock_struct *plock,
    672                                        bool blocking_lock,
    673                                        struct blocking_lock_record *blr);
     1121                                       bool blocking_lock);
    6741122bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle,
    6751123                                     struct messaging_context *msg_ctx,
     
    6781126bool smb_vfs_call_brl_cancel_windows(struct vfs_handle_struct *handle,
    6791127                                     struct byte_range_lock *br_lck,
    680                                      struct lock_struct *plock,
    681                                      struct blocking_lock_record *blr);
     1128                                     struct lock_struct *plock);
    6821129bool smb_vfs_call_strict_lock(struct vfs_handle_struct *handle,
    6831130                              struct files_struct *fsp,
     
    6911138                                     TALLOC_CTX *mem_ctx,
    6921139                                     char **mapped_name);
     1140NTSTATUS smb_vfs_call_fsctl(struct vfs_handle_struct *handle,
     1141                            struct files_struct *fsp,
     1142                            TALLOC_CTX *ctx,
     1143                            uint32_t function,
     1144                            uint16_t req_flags,
     1145                            const uint8_t *_in_data,
     1146                            uint32_t in_len,
     1147                            uint8_t **_out_data,
     1148                            uint32_t max_out_len,
     1149                            uint32_t *out_len);
     1150struct tevent_req *smb_vfs_call_copy_chunk_send(struct vfs_handle_struct *handle,
     1151                                                TALLOC_CTX *mem_ctx,
     1152                                                struct tevent_context *ev,
     1153                                                struct files_struct *src_fsp,
     1154                                                off_t src_off,
     1155                                                struct files_struct *dest_fsp,
     1156                                                off_t dest_off,
     1157                                                off_t num);
     1158NTSTATUS smb_vfs_call_copy_chunk_recv(struct vfs_handle_struct *handle,
     1159                                      struct tevent_req *req,
     1160                                      off_t *copied);
     1161NTSTATUS smb_vfs_call_get_compression(struct vfs_handle_struct *handle,
     1162                                      TALLOC_CTX *mem_ctx,
     1163                                      struct files_struct *fsp,
     1164                                      struct smb_filename *smb_fname,
     1165                                      uint16_t *_compression_fmt);
     1166NTSTATUS smb_vfs_call_set_compression(struct vfs_handle_struct *handle,
     1167                                      TALLOC_CTX *mem_ctx,
     1168                                      struct files_struct *fsp,
     1169                                      uint16_t compression_fmt);
     1170NTSTATUS smb_vfs_call_snap_check_path(vfs_handle_struct *handle,
     1171                                      TALLOC_CTX *mem_ctx,
     1172                                      const char *service_path,
     1173                                      char **base_volume);
     1174NTSTATUS smb_vfs_call_snap_create(struct vfs_handle_struct *handle,
     1175                                  TALLOC_CTX *mem_ctx,
     1176                                  const char *base_volume,
     1177                                  time_t *tstamp,
     1178                                  bool rw,
     1179                                  char **base_path,
     1180                                  char **snap_path);
     1181NTSTATUS smb_vfs_call_snap_delete(struct vfs_handle_struct *handle,
     1182                                  TALLOC_CTX *mem_ctx,
     1183                                  char *base_path,
     1184                                  char *snap_path);
    6931185NTSTATUS smb_vfs_call_fget_nt_acl(struct vfs_handle_struct *handle,
    6941186                                  struct files_struct *fsp,
    695                                   uint32 security_info,
     1187                                  uint32_t security_info,
     1188                                  TALLOC_CTX *mem_ctx,
    6961189                                  struct security_descriptor **ppdesc);
    6971190NTSTATUS smb_vfs_call_get_nt_acl(struct vfs_handle_struct *handle,
    6981191                                 const char *name,
    699                                  uint32 security_info,
     1192                                 uint32_t security_info,
     1193                                 TALLOC_CTX *mem_ctx,
    7001194                                 struct security_descriptor **ppdesc);
    7011195NTSTATUS smb_vfs_call_fset_nt_acl(struct vfs_handle_struct *handle,
    7021196                                  struct files_struct *fsp,
    703                                   uint32 security_info_sent,
     1197                                  uint32_t security_info_sent,
    7041198                                  const struct security_descriptor *psd);
     1199NTSTATUS smb_vfs_call_audit_file(struct vfs_handle_struct *handle,
     1200                                 struct smb_filename *file,
     1201                                 struct security_acl *sacl,
     1202                                 uint32_t access_requested,
     1203                                 uint32_t access_denied);
    7051204int smb_vfs_call_chmod_acl(struct vfs_handle_struct *handle, const char *name,
    7061205                           mode_t mode);
    7071206int smb_vfs_call_fchmod_acl(struct vfs_handle_struct *handle,
    7081207                            struct files_struct *fsp, mode_t mode);
    709 int smb_vfs_call_sys_acl_get_entry(struct vfs_handle_struct *handle,
    710                                    SMB_ACL_T theacl, int entry_id,
    711                                    SMB_ACL_ENTRY_T *entry_p);
    712 int smb_vfs_call_sys_acl_get_tag_type(struct vfs_handle_struct *handle,
    713                                       SMB_ACL_ENTRY_T entry_d,
    714                                       SMB_ACL_TAG_T *tag_type_p);
    715 int smb_vfs_call_sys_acl_get_permset(struct vfs_handle_struct *handle,
    716                                      SMB_ACL_ENTRY_T entry_d,
    717                                      SMB_ACL_PERMSET_T *permset_p);
    718 void * smb_vfs_call_sys_acl_get_qualifier(struct vfs_handle_struct *handle,
    719                                           SMB_ACL_ENTRY_T entry_d);
    7201208SMB_ACL_T smb_vfs_call_sys_acl_get_file(struct vfs_handle_struct *handle,
    7211209                                        const char *path_p,
    722                                         SMB_ACL_TYPE_T type);
     1210                                        SMB_ACL_TYPE_T type,
     1211                                        TALLOC_CTX *mem_ctx);
    7231212SMB_ACL_T smb_vfs_call_sys_acl_get_fd(struct vfs_handle_struct *handle,
    724                                       struct files_struct *fsp);
    725 int smb_vfs_call_sys_acl_clear_perms(struct vfs_handle_struct *handle,
    726                                      SMB_ACL_PERMSET_T permset);
    727 int smb_vfs_call_sys_acl_add_perm(struct vfs_handle_struct *handle,
    728                                   SMB_ACL_PERMSET_T permset,
    729                                   SMB_ACL_PERM_T perm);
    730 char * smb_vfs_call_sys_acl_to_text(struct vfs_handle_struct *handle,
    731                                     SMB_ACL_T theacl, ssize_t *plen);
    732 SMB_ACL_T smb_vfs_call_sys_acl_init(struct vfs_handle_struct *handle,
    733                                     int count);
    734 int smb_vfs_call_sys_acl_create_entry(struct vfs_handle_struct *handle,
    735                                       SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
    736 int smb_vfs_call_sys_acl_set_tag_type(struct vfs_handle_struct *handle,
    737                                       SMB_ACL_ENTRY_T entry,
    738                                       SMB_ACL_TAG_T tagtype);
    739 int smb_vfs_call_sys_acl_set_qualifier(struct vfs_handle_struct *handle,
    740                                        SMB_ACL_ENTRY_T entry, void *qual);
    741 int smb_vfs_call_sys_acl_set_permset(struct vfs_handle_struct *handle,
    742                                      SMB_ACL_ENTRY_T entry,
    743                                      SMB_ACL_PERMSET_T permset);
    744 int smb_vfs_call_sys_acl_valid(struct vfs_handle_struct *handle,
    745                                SMB_ACL_T theacl);
     1213                                      struct files_struct *fsp,
     1214                                      TALLOC_CTX *mem_ctx);
     1215int smb_vfs_call_sys_acl_blob_get_file(struct vfs_handle_struct *handle,
     1216                                       const char *path_p,
     1217                                       TALLOC_CTX *mem_ctx,
     1218                                       char **blob_description,
     1219                                       DATA_BLOB *blob);
     1220int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle,
     1221                                     struct files_struct *fsp, 
     1222                                     TALLOC_CTX *mem_ctx,
     1223                                     char **blob_description,
     1224                                     DATA_BLOB *blob);
    7461225int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
    7471226                                  const char *name, SMB_ACL_TYPE_T acltype,
     
    7511230int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
    7521231                                         const char *path);
    753 int smb_vfs_call_sys_acl_get_perm(struct vfs_handle_struct *handle,
    754                                   SMB_ACL_PERMSET_T permset,
    755                                   SMB_ACL_PERM_T perm);
    756 int smb_vfs_call_sys_acl_free_text(struct vfs_handle_struct *handle,
    757                                    char *text);
    758 int smb_vfs_call_sys_acl_free_acl(struct vfs_handle_struct *handle,
    759                                   SMB_ACL_T posix_acl);
    760 int smb_vfs_call_sys_acl_free_qualifier(struct vfs_handle_struct *handle,
    761                                         void *qualifier, SMB_ACL_TAG_T tagtype);
    7621232ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
    7631233                              const char *path, const char *name, void *value,
    7641234                              size_t size);
    765 ssize_t smb_vfs_call_lgetxattr(struct vfs_handle_struct *handle,
    766                                const char *path, const char *name, void *value,
    767                                size_t size);
    7681235ssize_t smb_vfs_call_fgetxattr(struct vfs_handle_struct *handle,
    7691236                               struct files_struct *fsp, const char *name,
     
    7781245int smb_vfs_call_removexattr(struct vfs_handle_struct *handle,
    7791246                             const char *path, const char *name);
    780 int smb_vfs_call_lremovexattr(struct vfs_handle_struct *handle,
    781                               const char *path, const char *name);
    7821247int smb_vfs_call_fremovexattr(struct vfs_handle_struct *handle,
    7831248                              struct files_struct *fsp, const char *name);
     
    7911256                           struct files_struct *fsp, const char *name,
    7921257                           const void *value, size_t size, int flags);
    793 int smb_vfs_call_aio_read(struct vfs_handle_struct *handle,
    794                           struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
    795 int smb_vfs_call_aio_write(struct vfs_handle_struct *handle,
    796                            struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
    797 ssize_t smb_vfs_call_aio_return_fn(struct vfs_handle_struct *handle,
    798                                    struct files_struct *fsp,
    799                                    SMB_STRUCT_AIOCB *aiocb);
    800 int smb_vfs_call_aio_cancel(struct vfs_handle_struct *handle,
    801                             struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb);
    802 int smb_vfs_call_aio_error_fn(struct vfs_handle_struct *handle,
    803                               struct files_struct *fsp,
    804                               SMB_STRUCT_AIOCB *aiocb);
    805 int smb_vfs_call_aio_fsync(struct vfs_handle_struct *handle,
    806                            struct files_struct *fsp, int op,
    807                            SMB_STRUCT_AIOCB *aiocb);
    808 int smb_vfs_call_aio_suspend(struct vfs_handle_struct *handle,
    809                              struct files_struct *fsp,
    810                              const SMB_STRUCT_AIOCB * const aiocb[], int n,
    811                              const struct timespec *timeout);
    8121258bool smb_vfs_call_aio_force(struct vfs_handle_struct *handle,
    8131259                            struct files_struct *fsp);
     
    8171263int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
    8181264                             const struct smb_filename *fname);
     1265NTSTATUS smb_vfs_call_durable_cookie(struct vfs_handle_struct *handle,
     1266                                     struct files_struct *fsp,
     1267                                     TALLOC_CTX *mem_ctx,
     1268                                     DATA_BLOB *cookie);
     1269NTSTATUS smb_vfs_call_durable_disconnect(struct vfs_handle_struct *handle,
     1270                                         struct files_struct *fsp,
     1271                                         const DATA_BLOB old_cookie,
     1272                                         TALLOC_CTX *mem_ctx,
     1273                                         DATA_BLOB *new_cookie);
     1274NTSTATUS smb_vfs_call_durable_reconnect(struct vfs_handle_struct *handle,
     1275                                        struct smb_request *smb1req,
     1276                                        struct smbXsrv_open *op,
     1277                                        const DATA_BLOB old_cookie,
     1278                                        TALLOC_CTX *mem_ctx,
     1279                                        struct files_struct **fsp,
     1280                                        DATA_BLOB *new_cookie);
     1281NTSTATUS smb_vfs_call_readdir_attr(struct vfs_handle_struct *handle,
     1282                                   const struct smb_filename *fname,
     1283                                   TALLOC_CTX *mem_ctx,
     1284                                   struct readdir_attr_data **attr_data);
     1285
     1286NTSTATUS smb_register_vfs(int version, const char *name,
     1287                          const struct vfs_fn_pointers *fns);
     1288void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
     1289                                   files_struct *fsp, size_t ext_size,
     1290                                   void (*destroy_fn)(void *p_data));
     1291void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
     1292void vfs_remove_all_fsp_extensions(struct files_struct *fsp);
     1293void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
     1294void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    8191295
    8201296#endif /* _VFS_H */
  • vendor/current/source3/include/vfs_macros.h

    r740 r988  
    2222#define _VFS_MACROS_H
    2323
    24 /*******************************************************************
    25  Don't access conn->vfs.ops.* directly!!!
    26  Use this macros!
    27  (Fixes should go also into the vfs_opaque_* and vfs_next_* macros!)
    28 ********************************************************************/
     24/*
     25 * These macros SMB_VFS_<FOO> (and SMB_VFS_NEXT_<FOO>) are our
     26 * interface for the VFS.
     27 *
     28 * Don't access conn->vfs_handles[->next]->fns->* directly!
     29 */
    2930
    3031/* Disk operations */
     
    3940        smb_vfs_call_disconnect((handle)->next)
    4041
    41 #define SMB_VFS_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) \
    42         smb_vfs_call_disk_free((conn)->vfs_handles, (path), (small_query), (bsize), (dfree), (dsize))
    43 #define SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, dfree ,dsize)\
    44         smb_vfs_call_disk_free((handle)->next, (path), (small_query), (bsize), (dfree), (dsize))
    45 
    46 #define SMB_VFS_GET_QUOTA(conn, qtype, id, qt) \
    47         smb_vfs_call_get_quota((conn)->vfs_handles, (qtype), (id), (qt))
    48 #define SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt) \
    49         smb_vfs_call_get_quota((handle)->next, (qtype), (id), (qt))
     42#define SMB_VFS_DISK_FREE(conn, path, bsize, dfree ,dsize) \
     43        smb_vfs_call_disk_free((conn)->vfs_handles, (path), (bsize), (dfree), (dsize))
     44#define SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree ,dsize)\
     45        smb_vfs_call_disk_free((handle)->next, (path), (bsize), (dfree), (dsize))
     46
     47#define SMB_VFS_GET_QUOTA(conn, path, qtype, id, qt)                          \
     48        smb_vfs_call_get_quota((conn)->vfs_handles, (path), (qtype), (id), (qt))
     49#define SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt)                    \
     50        smb_vfs_call_get_quota((handle)->next, (path), (qtype), (id), (qt))
    5051
    5152#define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) \
     
    6869#define SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res) \
    6970        smb_vfs_call_fs_capabilities((handle)->next, (p_ts_res))
     71
     72/*
     73 * Note: that "struct dfs_GetDFSReferral *r"
     74 * needs to be a valid TALLOC_CTX
     75 */
     76#define SMB_VFS_GET_DFS_REFERRALS(conn, r) \
     77        smb_vfs_call_get_dfs_referrals((conn)->vfs_handles, (r))
     78#define SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r) \
     79        smb_vfs_call_get_dfs_referrals((handle)->next, (r))
    7080
    7181/* Directory operations */
     
    127137
    128138#define SMB_VFS_CREATE_FILE(conn, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \
    129         create_options, file_attributes, oplock_request, allocation_size, private_flags, sd, ea_list, result, pinfo) \
    130         smb_vfs_call_create_file((conn)->vfs_handles, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \
    131         (create_options), (file_attributes), (oplock_request), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo))
     139        create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \
     140        smb_vfs_call_create_file((conn)->vfs_handles, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \
     141        (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo), \
     142        (in_context_blobs), (out_context_blobs))
    132143#define SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \
    133         create_options, file_attributes, oplock_request, allocation_size, private_flags, sd, ea_list, result, pinfo) \
     144        create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \
    134145        smb_vfs_call_create_file((handle)->next, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \
    135         (create_options), (file_attributes), (oplock_request), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo))
     146        (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo), \
     147        (in_context_blobs), (out_context_blobs))
    136148
    137149#define SMB_VFS_CLOSE(fsp) \
    138         smb_vfs_call_close_fn((fsp)->conn->vfs_handles, (fsp))
     150        smb_vfs_call_close((fsp)->conn->vfs_handles, (fsp))
    139151#define SMB_VFS_NEXT_CLOSE(handle, fsp) \
    140         smb_vfs_call_close_fn((handle)->next, (fsp))
     152        smb_vfs_call_close((handle)->next, (fsp))
    141153
    142154#define SMB_VFS_READ(fsp, data, n) \
    143         smb_vfs_call_vfs_read((fsp)->conn->vfs_handles, (fsp), (data), (n))
     155        smb_vfs_call_read((fsp)->conn->vfs_handles, (fsp), (data), (n))
    144156#define SMB_VFS_NEXT_READ(handle, fsp, data, n) \
    145         smb_vfs_call_vfs_read((handle)->next, (fsp), (data), (n))
     157        smb_vfs_call_read((handle)->next, (fsp), (data), (n))
    146158
    147159#define SMB_VFS_PREAD(fsp, data, n, off) \
     
    150162        smb_vfs_call_pread((handle)->next, (fsp), (data), (n), (off))
    151163
     164#define SMB_VFS_PREAD_SEND(mem_ctx, ev, fsp, data, n, off) \
     165        smb_vfs_call_pread_send((fsp)->conn->vfs_handles, (mem_ctx), (ev), \
     166                                (fsp), (data), (n), (off))
     167#define SMB_VFS_NEXT_PREAD_SEND(mem_ctx, ev, handle, fsp, data, n, off) \
     168        smb_vfs_call_pread_send((handle)->next, (mem_ctx), (ev), (fsp), \
     169                                (data), (n), (off))
     170
    152171#define SMB_VFS_WRITE(fsp, data, n) \
    153172        smb_vfs_call_write((fsp)->conn->vfs_handles, (fsp), (data), (n))
     
    160179        smb_vfs_call_pwrite((handle)->next, (fsp), (data), (n), (off))
    161180
     181#define SMB_VFS_PWRITE_SEND(mem_ctx, ev, fsp, data, n, off) \
     182        smb_vfs_call_pwrite_send((fsp)->conn->vfs_handles, (mem_ctx), (ev), \
     183                                (fsp), (data), (n), (off))
     184#define SMB_VFS_NEXT_PWRITE_SEND(mem_ctx, ev, handle, fsp, data, n, off) \
     185        smb_vfs_call_pwrite_send((handle)->next, (mem_ctx), (ev), (fsp), \
     186                                (data), (n), (off))
     187
    162188#define SMB_VFS_LSEEK(fsp, offset, whence) \
    163189        smb_vfs_call_lseek((fsp)->conn->vfs_handles, (fsp), (offset), (whence))
     
    185211        smb_vfs_call_fsync((handle)->next, (fsp))
    186212
     213#define SMB_VFS_FSYNC_SEND(mem_ctx, ev, fsp) \
     214        smb_vfs_call_fsync_send((fsp)->conn->vfs_handles, (mem_ctx), (ev), \
     215                                (fsp))
     216#define SMB_VFS_NEXT_FSYNC_SEND(mem_ctx, ev, handle, fsp)               \
     217        smb_vfs_call_fsync_send((handle)->next, (mem_ctx), (ev), (fsp))
     218
    187219#define SMB_VFS_STAT(conn, smb_fname) \
    188220        smb_vfs_call_stat((conn)->vfs_handles, (smb_fname))
     
    240272        smb_vfs_call_chdir((handle)->next, (path))
    241273
    242 #define SMB_VFS_GETWD(conn, buf) \
    243         smb_vfs_call_getwd((conn)->vfs_handles, (buf))
    244 #define SMB_VFS_NEXT_GETWD(handle, buf) \
    245         smb_vfs_call_getwd((handle)->next, (buf))
     274#define SMB_VFS_GETWD(conn) \
     275        smb_vfs_call_getwd((conn)->vfs_handles)
     276#define SMB_VFS_NEXT_GETWD(handle) \
     277        smb_vfs_call_getwd((handle)->next)
    246278
    247279#define SMB_VFS_NTIMES(conn, path, ts) \
     
    286318
    287319#define SMB_VFS_READLINK(conn, path, buf, bufsiz) \
    288         smb_vfs_call_vfs_readlink((conn)->vfs_handles, (path), (buf), (bufsiz))
     320        smb_vfs_call_readlink((conn)->vfs_handles, (path), (buf), (bufsiz))
    289321#define SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz) \
    290         smb_vfs_call_vfs_readlink((handle)->next, (path), (buf), (bufsiz))
     322        smb_vfs_call_readlink((handle)->next, (path), (buf), (bufsiz))
    291323
    292324#define SMB_VFS_LINK(conn, oldpath, newpath) \
     
    305337        smb_vfs_call_realpath((handle)->next, (path))
    306338
    307 #define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) \
    308         smb_vfs_call_notify_watch((conn)->vfs_handles, (ctx), (e), (callback), (private_data), (handle_p))
    309 #define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) \
    310         smb_vfs_call_notify_watch((conn)->next, (ctx), (e), (callback), (private_data), (handle_p))
    311 
    312339#define SMB_VFS_CHFLAGS(conn, path, flags) \
    313340        smb_vfs_call_chflags((conn)->vfs_handles, (path), (flags))
     
    335362        smb_vfs_call_connectpath((conn)->next, (fname))
    336363
    337 #define SMB_VFS_BRL_LOCK_WINDOWS(conn, br_lck, plock, blocking_lock, blr) \
    338         smb_vfs_call_brl_lock_windows((conn)->vfs_handles, (br_lck), (plock), (blocking_lock), (blr))
    339 #define SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock, blocking_lock, blr) \
    340         smb_vfs_call_brl_lock_windows((handle)->next, (br_lck), (plock), (blocking_lock), (blr))
     364#define SMB_VFS_BRL_LOCK_WINDOWS(conn, br_lck, plock, blocking_lock) \
     365        smb_vfs_call_brl_lock_windows((conn)->vfs_handles, (br_lck), (plock), (blocking_lock))
     366#define SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock, blocking_lock) \
     367        smb_vfs_call_brl_lock_windows((handle)->next, (br_lck), (plock), (blocking_lock))
    341368
    342369#define SMB_VFS_BRL_UNLOCK_WINDOWS(conn, msg_ctx, br_lck, plock) \
     
    345372        smb_vfs_call_brl_unlock_windows((handle)->next, (msg_ctx), (br_lck), (plock))
    346373
    347 #define SMB_VFS_BRL_CANCEL_WINDOWS(conn, br_lck, plock, blr) \
    348         smb_vfs_call_brl_cancel_windows((conn)->vfs_handles, (br_lck), (plock), (blr))
    349 #define SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr) \
    350         smb_vfs_call_brl_cancel_windows((handle)->next, (br_lck), (plock), (blr))
     374#define SMB_VFS_BRL_CANCEL_WINDOWS(conn, br_lck, plock) \
     375        smb_vfs_call_brl_cancel_windows((conn)->vfs_handles, (br_lck), (plock))
     376#define SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock) \
     377        smb_vfs_call_brl_cancel_windows((handle)->next, (br_lck), (plock))
    351378
    352379#define SMB_VFS_STRICT_LOCK(conn, fsp, plock) \
     
    365392        smb_vfs_call_translate_name((handle)->next, (name), (direction), (mem_ctx), (mapped_name))
    366393
    367 #define SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock) \
    368         smb_vfs_call_strict_unlock((handle)->next, (fsp), (plock))
    369 
    370 #define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) \
    371         smb_vfs_call_fget_nt_acl((fsp)->conn->vfs_handles, (fsp), (security_info), (ppdesc))
    372 #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) \
    373         smb_vfs_call_fget_nt_acl((handle)->next, (fsp), (security_info), (ppdesc))
    374 
    375 #define SMB_VFS_GET_NT_ACL(conn, name, security_info, ppdesc) \
    376         smb_vfs_call_get_nt_acl((conn)->vfs_handles, (name), (security_info), (ppdesc))
    377 #define SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc) \
    378         smb_vfs_call_get_nt_acl((handle)->next, (name), (security_info), (ppdesc))
     394#define SMB_VFS_FSCTL(fsp, ctx, function, req_flags, in_data, in_len, out_data, max_out_len, out_len) \
     395        smb_vfs_call_fsctl((fsp)->conn->vfs_handles, (fsp), (ctx), (function), (req_flags), (in_data), (in_len), (out_data), (max_out_len), (out_len))
     396
     397#define SMB_VFS_NEXT_FSCTL(handle, fsp, ctx, function, req_flags, in_data, in_len, out_data, max_out_len, out_len) \
     398        smb_vfs_call_fsctl((handle)->next, (fsp), (ctx), (function), (req_flags), (in_data), (in_len), (out_data), (max_out_len), (out_len))
     399
     400#define SMB_VFS_COPY_CHUNK_SEND(conn, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num) \
     401        smb_vfs_call_copy_chunk_send((conn)->vfs_handles, (mem_ctx), (ev), (src_fsp), (src_off), (dest_fsp), (dest_off), (num))
     402#define SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, mem_ctx, ev, src_fsp, src_off, dest_fsp, dest_off, num) \
     403        smb_vfs_call_copy_chunk_send((handle)->next, (mem_ctx), (ev), (src_fsp), (src_off), (dest_fsp), (dest_off), (num))
     404
     405#define SMB_VFS_COPY_CHUNK_RECV(conn, req, copied) \
     406        smb_vfs_call_copy_chunk_recv((conn)->vfs_handles, (req), (copied))
     407#define SMB_VFS_NEXT_COPY_CHUNK_RECV(handle, req, copied) \
     408        smb_vfs_call_copy_chunk_recv((handle)->next, (req), (copied))
     409
     410#define SMB_VFS_GET_COMPRESSION(conn, mem_ctx, fsp, smb_fname, _compression_fmt)                \
     411        smb_vfs_call_get_compression((conn)->vfs_handles, (mem_ctx), (fsp), (smb_fname), (_compression_fmt))
     412#define SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname, _compression_fmt)         \
     413        smb_vfs_call_get_compression((handle)->next, (mem_ctx), (fsp), (smb_fname), (_compression_fmt))
     414
     415#define SMB_VFS_SET_COMPRESSION(conn, mem_ctx, fsp, compression_fmt)            \
     416        smb_vfs_call_set_compression((conn)->vfs_handles, (mem_ctx), (fsp), (compression_fmt))
     417#define SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp, compression_fmt)             \
     418        smb_vfs_call_set_compression((handle)->next, (mem_ctx), (fsp), (compression_fmt))
     419
     420#define SMB_VFS_SNAP_CHECK_PATH(conn, mem_ctx, service_path, base_volume) \
     421        smb_vfs_call_snap_check_path((conn)->vfs_handles, (mem_ctx), (service_path), (base_volume))
     422#define SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path, base_volume) \
     423        smb_vfs_call_snap_check_path((handle)->next, (mem_ctx), (service_path), (base_volume))
     424
     425#define SMB_VFS_SNAP_CREATE(conn, mem_ctx, base_volume, tstamp, rw, base_path, snap_path) \
     426        smb_vfs_call_snap_create((conn)->vfs_handles, (mem_ctx), (base_volume), (tstamp), (rw), (base_path), (snap_path))
     427#define SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp, rw, base_path, snap_path) \
     428        smb_vfs_call_snap_create((handle)->next, (mem_ctx), (base_volume), (tstamp), (rw), (base_path), (snap_path))
     429
     430#define SMB_VFS_SNAP_DELETE(conn, mem_ctx, base_path, snap_path) \
     431        smb_vfs_call_snap_delete((conn)->vfs_handles, (mem_ctx), (base_path), (snap_path))
     432#define SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path, snap_path) \
     433        smb_vfs_call_snap_delete((handle)->next, (mem_ctx), (base_path), (snap_path))
     434
     435#define SMB_VFS_FGET_NT_ACL(fsp, security_info, mem_ctx, ppdesc)                \
     436        smb_vfs_call_fget_nt_acl((fsp)->conn->vfs_handles, (fsp), (security_info), (mem_ctx), (ppdesc))
     437#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, mem_ctx, ppdesc) \
     438        smb_vfs_call_fget_nt_acl((handle)->next, (fsp), (security_info), (mem_ctx), (ppdesc))
     439
     440#define SMB_VFS_GET_NT_ACL(conn, name, security_info, mem_ctx, ppdesc)  \
     441        smb_vfs_call_get_nt_acl((conn)->vfs_handles, (name), (security_info), (mem_ctx), (ppdesc))
     442#define SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, mem_ctx, ppdesc) \
     443        smb_vfs_call_get_nt_acl((handle)->next, (name), (security_info), (mem_ctx), (ppdesc))
     444
     445#define SMB_VFS_AUDIT_FILE(conn, name, sacl, access_requested, access_denied) \
     446        smb_vfs_call_audit_file((conn)->vfs_handles, (name), (sacl), (access_requested), (access_denied))
     447#define SMB_VFS_NEXT_AUDIT_FILE(handle, name, sacl, access_requested, access_denied) \
     448        smb_vfs_call_audit_file((handle)->next, (name), (sacl), (access_requested), (access_denied))
    379449
    380450#define SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd) \
     
    393463        smb_vfs_call_fchmod_acl((handle)->next, (fsp), (mode))
    394464
    395 #define SMB_VFS_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) \
    396         smb_vfs_call_sys_acl_get_entry((conn)->vfs_handles, (theacl), (entry_id), (entry_p))
    397 #define SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p) \
    398         smb_vfs_call_sys_acl_get_entry((handle)->next, (theacl), (entry_id), (entry_p))
    399 
    400 #define SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) \
    401         smb_vfs_call_sys_acl_get_tag_type((conn)->vfs_handles, (entry_d), (tag_type_p))
    402 #define SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p) \
    403         smb_vfs_call_sys_acl_get_tag_type((handle)->next, (entry_d), (tag_type_p))
    404 
    405 #define SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) \
    406         smb_vfs_call_sys_acl_get_permset((conn)->vfs_handles, (entry_d), (permset_p))
    407 #define SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p) \
    408         smb_vfs_call_sys_acl_get_permset((handle)->next, (entry_d), (permset_p))
    409 
    410 #define SMB_VFS_SYS_ACL_GET_QUALIFIER(conn, entry_d) \
    411         smb_vfs_call_sys_acl_get_qualifier((conn)->vfs_handles, (entry_d))
    412 #define SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d) \
    413         smb_vfs_call_sys_acl_get_qualifier((handle)->next, (entry_d))
    414 
    415 #define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type) \
    416         smb_vfs_call_sys_acl_get_file((conn)->vfs_handles, (path_p), (type))
    417 #define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type) \
    418         smb_vfs_call_sys_acl_get_file((handle)->next, (path_p), (type))
    419 
    420 #define SMB_VFS_SYS_ACL_GET_FD(fsp) \
    421         smb_vfs_call_sys_acl_get_fd((fsp)->conn->vfs_handles, (fsp))
    422 #define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp) \
    423         smb_vfs_call_sys_acl_get_fd((handle)->next, (fsp))
    424 
    425 #define SMB_VFS_SYS_ACL_CLEAR_PERMS(conn, permset) \
    426         smb_vfs_call_sys_acl_clear_perms((conn)->vfs_handles, (permset))
    427 #define SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset) \
    428         smb_vfs_call_sys_acl_clear_perms((handle)->next, (permset))
    429 
    430 #define SMB_VFS_SYS_ACL_ADD_PERM(conn, permset, perm) \
    431         smb_vfs_call_sys_acl_add_perm((conn)->vfs_handles, (permset), (perm))
    432 #define SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm) \
    433         smb_vfs_call_sys_acl_add_perm((handle)->next, (permset), (perm))
    434 
    435 #define SMB_VFS_SYS_ACL_TO_TEXT(conn, theacl, plen) \
    436         smb_vfs_call_sys_acl_to_text((conn)->vfs_handles, (theacl), (plen))
    437 #define SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen) \
    438         smb_vfs_call_sys_acl_to_text((handle)->next, (theacl), (plen))
    439 
    440 #define SMB_VFS_SYS_ACL_INIT(conn, count) \
    441         smb_vfs_call_sys_acl_init((conn)->vfs_handles, (count))
    442 #define SMB_VFS_NEXT_SYS_ACL_INIT(handle, count) \
    443         smb_vfs_call_sys_acl_init((handle)->next, (count))
    444 
    445 #define SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, pacl, pentry) \
    446         smb_vfs_call_sys_acl_create_entry((conn)->vfs_handles, (pacl), (pentry))
    447 #define SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry) \
    448         smb_vfs_call_sys_acl_create_entry((handle)->next, (pacl), (pentry))
    449 
    450 #define SMB_VFS_SYS_ACL_SET_TAG_TYPE(conn, entry, tagtype) \
    451         smb_vfs_call_sys_acl_set_tag_type((conn)->vfs_handles, (entry), (tagtype))
    452 #define SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry, tagtype) \
    453         smb_vfs_call_sys_acl_set_tag_type((handle)->next, (entry), (tagtype))
    454 
    455 #define SMB_VFS_SYS_ACL_SET_QUALIFIER(conn, entry, qual) \
    456         smb_vfs_call_sys_acl_set_qualifier((conn)->vfs_handles, (entry), (qual))
    457 #define SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual) \
    458         smb_vfs_call_sys_acl_set_qualifier((handle)->next, (entry), (qual))
    459 
    460 #define SMB_VFS_SYS_ACL_SET_PERMSET(conn, entry, permset) \
    461         smb_vfs_call_sys_acl_set_permset((conn)->vfs_handles, (entry), (permset))
    462 #define SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset) \
    463         smb_vfs_call_sys_acl_set_permset((handle)->next, (entry), (permset))
    464 
    465 #define SMB_VFS_SYS_ACL_VALID(conn, theacl) \
    466         smb_vfs_call_sys_acl_valid((conn)->vfs_handles, (theacl))
    467 #define SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl) \
    468         smb_vfs_call_sys_acl_valid((handle)->next, (theacl))
     465#define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type, mem_ctx)           \
     466        smb_vfs_call_sys_acl_get_file((conn)->vfs_handles, (path_p), (type), (mem_ctx))
     467#define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx)            \
     468        smb_vfs_call_sys_acl_get_file((handle)->next, (path_p), (type), (mem_ctx))
     469
     470#define SMB_VFS_SYS_ACL_GET_FD(fsp, mem_ctx) \
     471        smb_vfs_call_sys_acl_get_fd((fsp)->conn->vfs_handles, (fsp), (mem_ctx))
     472#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx) \
     473        smb_vfs_call_sys_acl_get_fd((handle)->next, (fsp), (mem_ctx))
     474
     475#define SMB_VFS_SYS_ACL_BLOB_GET_FILE(conn, path_p, mem_ctx, blob_description, blob)    \
     476        smb_vfs_call_sys_acl_blob_get_file((conn)->vfs_handles, (path_p), (mem_ctx), (blob_description), (blob))
     477#define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, blob_description, blob) \
     478        smb_vfs_call_sys_acl_blob_get_file((handle)->next, (path_p), (mem_ctx), (blob_description), (blob))
     479
     480#define SMB_VFS_SYS_ACL_BLOB_GET_FD(fsp, mem_ctx, blob_description, blob)                       \
     481        smb_vfs_call_sys_acl_blob_get_fd((fsp)->conn->vfs_handles, (fsp), (mem_ctx), (blob_description), (blob))
     482#define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob)  \
     483        smb_vfs_call_sys_acl_blob_get_fd((handle)->next, (fsp), mem_ctx, (blob_description), (blob))
    469484
    470485#define SMB_VFS_SYS_ACL_SET_FILE(conn, name, acltype, theacl) \
     
    483498        smb_vfs_call_sys_acl_delete_def_file((handle)->next, (path))
    484499
    485 #define SMB_VFS_SYS_ACL_GET_PERM(conn, permset, perm) \
    486         smb_vfs_call_sys_acl_get_perm((conn)->vfs_handles, (permset), (perm))
    487 #define SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm) \
    488         smb_vfs_call_sys_acl_get_perm((handle)->next, (permset), (perm))
    489 
    490 #define SMB_VFS_SYS_ACL_FREE_TEXT(conn, text) \
    491         smb_vfs_call_sys_acl_free_text((conn)->vfs_handles, (text))
    492 #define SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text) \
    493         smb_vfs_call_sys_acl_free_text((handle)->next, (text))
    494 
    495 #define SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl) \
    496         smb_vfs_call_sys_acl_free_acl((conn)->vfs_handles, (posix_acl))
    497 #define SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl) \
    498         smb_vfs_call_sys_acl_free_acl((handle)->next, (posix_acl))
    499 
    500 #define SMB_VFS_SYS_ACL_FREE_QUALIFIER(conn, qualifier, tagtype) \
    501         smb_vfs_call_sys_acl_free_qualifier((conn)->vfs_handles, (qualifier), (tagtype))
    502 #define SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier, tagtype) \
    503         smb_vfs_call_sys_acl_free_qualifier((handle)->next, (qualifier), (tagtype))
    504 
    505500#define SMB_VFS_GETXATTR(conn,path,name,value,size) \
    506501        smb_vfs_call_getxattr((conn)->vfs_handles,(path),(name),(value),(size))
     
    508503        smb_vfs_call_getxattr((handle)->next,(path),(name),(value),(size))
    509504
    510 #define SMB_VFS_LGETXATTR(conn,path,name,value,size) \
    511         smb_vfs_call_lgetxattr((conn)->vfs_handles,(path),(name),(value),(size))
    512 #define SMB_VFS_NEXT_LGETXATTR(handle,path,name,value,size) \
    513         smb_vfs_call_lgetxattr((handle)->next,(path),(name),(value),(size))
    514 
    515505#define SMB_VFS_FGETXATTR(fsp,name,value,size) \
    516506        smb_vfs_call_fgetxattr((fsp)->conn->vfs_handles, (fsp), (name),(value),(size))
     
    523513        smb_vfs_call_listxattr((handle)->next,(path),(list),(size))
    524514
    525 #define SMB_VFS_LLISTXATTR(conn,path,list,size) \
    526         smb_vfs_call_llistxattr((conn)->vfs_handles,(path),(list),(size))
    527 #define SMB_VFS_NEXT_LLISTXATTR(handle,path,list,size) \
    528         smb_vfs_call_llistxattr((handle)->next,(path),(list),(size))
    529 
    530515#define SMB_VFS_FLISTXATTR(fsp,list,size) \
    531516        smb_vfs_call_flistxattr((fsp)->conn->vfs_handles, (fsp), (list),(size))
     
    538523        smb_vfs_call_removexattr((handle)->next,(path),(name))
    539524
    540 #define SMB_VFS_LREMOVEXATTR(conn,path,name) \
    541         smb_vfs_call_lremovexattr((conn)->vfs_handles,(path),(name))
    542 #define SMB_VFS_NEXT_LREMOVEXATTR(handle,path,name) \
    543         smb_vfs_call_lremovexattr((handle)->next,(path),(name))
    544 
    545525#define SMB_VFS_FREMOVEXATTR(fsp,name) \
    546526        smb_vfs_call_fremovexattr((fsp)->conn->vfs_handles, (fsp), (name))
     
    553533        smb_vfs_call_setxattr((handle)->next,(path),(name),(value),(size),(flags))
    554534
    555 #define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) \
    556         smb_vfs_call_lsetxattr((conn)->vfs_handles,(path),(name),(value),(size),(flags))
    557 #define SMB_VFS_NEXT_LSETXATTR(handle,path,name,value,size,flags) \
    558         smb_vfs_call_lsetxattr((handle)->next,(path),(name),(value),(size),(flags))
    559 
    560535#define SMB_VFS_FSETXATTR(fsp,name,value,size,flags) \
    561536        smb_vfs_call_fsetxattr((fsp)->conn->vfs_handles, (fsp), (name),(value),(size),(flags))
     
    563538        smb_vfs_call_fsetxattr((handle)->next,(fsp),(name),(value),(size),(flags))
    564539
    565 #define SMB_VFS_AIO_READ(fsp,aiocb) \
    566         smb_vfs_call_aio_read((fsp)->conn->vfs_handles, (fsp), (aiocb))
    567 #define SMB_VFS_NEXT_AIO_READ(handle,fsp,aiocb) \
    568         smb_vfs_call_aio_read((handle)->next,(fsp),(aiocb))
    569 
    570 #define SMB_VFS_AIO_WRITE(fsp,aiocb) \
    571         smb_vfs_call_aio_write((fsp)->conn->vfs_handles, (fsp), (aiocb))
    572 #define SMB_VFS_NEXT_AIO_WRITE(handle,fsp,aiocb) \
    573         smb_vfs_call_aio_write((handle)->next,(fsp),(aiocb))
    574 
    575 #define SMB_VFS_AIO_RETURN(fsp,aiocb) \
    576         smb_vfs_call_aio_return_fn((fsp)->conn->vfs_handles, (fsp), (aiocb))
    577 #define SMB_VFS_NEXT_AIO_RETURN(handle,fsp,aiocb) \
    578         smb_vfs_call_aio_return_fn((handle)->next,(fsp),(aiocb))
    579 
    580 #define SMB_VFS_AIO_CANCEL(fsp,aiocb) \
    581         smb_vfs_call_aio_cancel((fsp)->conn->vfs_handles, (fsp), (aiocb))
    582 #define SMB_VFS_NEXT_AIO_CANCEL(handle,fsp,aiocb) \
    583         smb_vfs_call_aio_cancel((handle)->next,(fsp),(aiocb))
    584 
    585 #define SMB_VFS_AIO_ERROR(fsp,aiocb) \
    586         smb_vfs_call_aio_error_fn((fsp)->conn->vfs_handles, (fsp),(aiocb))
    587 #define SMB_VFS_NEXT_AIO_ERROR(handle,fsp,aiocb) \
    588         smb_vfs_call_aio_error_fn((handle)->next,(fsp),(aiocb))
    589 
    590 #define SMB_VFS_AIO_FSYNC(fsp,op,aiocb) \
    591         smb_vfs_call_aio_fsync((fsp)->conn->vfs_handles, (fsp), (op),(aiocb))
    592 #define SMB_VFS_NEXT_AIO_FSYNC(handle,fsp,op,aiocb) \
    593         smb_vfs_call_aio_fsync((handle)->next,(fsp),(op),(aiocb))
    594 
    595 #define SMB_VFS_AIO_SUSPEND(fsp,aiocb,n,ts) \
    596         smb_vfs_call_aio_suspend((fsp)->conn->vfs_handles, (fsp),(aiocb),(n),(ts))
    597 #define SMB_VFS_NEXT_AIO_SUSPEND(handle,fsp,aiocb,n,ts) \
    598         smb_vfs_call_aio_suspend((handle)->next,(fsp),(aiocb),(n),(ts))
    599 
    600540#define SMB_VFS_AIO_FORCE(fsp) \
    601541        smb_vfs_call_aio_force((fsp)->conn->vfs_handles, (fsp))
     
    613553        smb_vfs_call_set_offline((handle)->next, (fname))
    614554
     555/* durable handle operations */
     556
     557#define SMB_VFS_DURABLE_COOKIE(fsp, mem_ctx, cookie) \
     558        smb_vfs_call_durable_cookie((fsp)->conn->vfs_handles, \
     559                                    (fsp), (mem_ctx), (cookie))
     560#define SMB_VFS_NEXT_DURABLE_COOKIE(handle, fsp, mem_ctx, cookie) \
     561        smb_vfs_call_durable_cookie((handle)->next, \
     562                                    (fsp), (mem_ctx), (cookie))
     563
     564#define SMB_VFS_DURABLE_DISCONNECT(fsp, old_cookie, mem_ctx, new_cookie) \
     565        smb_vfs_call_durable_disconnect((fsp)->conn->vfs_handles, \
     566                                        (fsp), (old_cookie), (mem_ctx), (new_cookie))
     567#define SMB_VFS_NEXT_DURABLE_DISCONNECT(handle, fsp, old_cookie, mem_ctx, new_cookie) \
     568        smb_vfs_call_durable_disconnect((handle)->next, \
     569                                        (fsp), (old_cookie), (mem_ctx), (new_cookie))
     570
     571#define SMB_VFS_DURABLE_RECONNECT(conn, smb1req, op, old_cookie, mem_ctx, fsp, new_cookie) \
     572        smb_vfs_call_durable_reconnect((conn)->vfs_handles, \
     573                                       (smb1req), (op), (old_cookie), \
     574                                       (mem_ctx), (fsp), (new_cookie))
     575#define SMB_VFS_NEXT_DURABLE_RECONNECT(handle, smb1req, op, old_cookie, mem_ctx, fsp, new_cookie) \
     576        smb_vfs_call_durable_reconnect((handle)->next, \
     577                                        (smb1req), (op), (old_cookie), \
     578                                        (mem_ctx), (fsp), (new_cookie))
     579
     580#define SMB_VFS_READDIR_ATTR(conn, fname, mem_ctx, attr_data) \
     581        smb_vfs_call_readdir_attr((conn)->vfs_handles, (fname), (mem_ctx), (attr_data))
     582#define SMB_VFS_NEXT_READDIR_ATTR(conn, fname, mem_ctx, attr_data) \
     583        smb_vfs_call_readdir_attr((handle)->next, (fname), (mem_ctx), (attr_data))
     584
    615585#endif /* _VFS_MACROS_H */
Note: See TracChangeset for help on using the changeset viewer.