Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
16 deleted
51 edited
6 copied

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/include/ads.h

    r414 r745  
    77*/
    88
    9 #include "../libds/common/flags.h"
    10 
    11 /*
    12  * This should be under the HAVE_KRB5 flag but since they're used
    13  * in lp_kerberos_method(), they ned to be always available
    14  */
    15 #define KERBEROS_VERIFY_SECRETS 0
    16 #define KERBEROS_VERIFY_SYSTEM_KEYTAB 1
    17 #define KERBEROS_VERIFY_DEDICATED_KEYTAB 2
    18 #define KERBEROS_VERIFY_SECRETS_AND_KEYTAB 3
    19 
    20 /*
    21  * If you add any entries to the above, please modify the below expressions
    22  * so they remain accurate.
    23  */
    24 #define USE_KERBEROS_KEYTAB (KERBEROS_VERIFY_SECRETS != lp_kerberos_method())
    25 #define USE_SYSTEM_KEYTAB \
    26     ((KERBEROS_VERIFY_SECRETS_AND_KEYTAB == lp_kerberos_method()) || \
    27      (KERBEROS_VERIFY_SYSTEM_KEYTAB == lp_kerberos_method()))
    28 
    29 #define TOK_ID_KRB_AP_REQ       ((const uint8_t *)"\x01\x00")
    30 #define TOK_ID_KRB_AP_REP       ((const uint8_t *)"\x02\x00")
    31 #define TOK_ID_KRB_ERROR        ((const uint8_t *)"\x03\x00")
    32 #define TOK_ID_GSS_GETMIC       ((const uint8_t *)"\x01\x01")
    33 #define TOK_ID_GSS_WRAP         ((const uint8_t *)"\x02\x01")
    34 
    35 enum wb_posix_mapping {
    36         WB_POSIX_MAP_UNKNOWN    = -1,
    37         WB_POSIX_MAP_TEMPLATE   = 0,
    38         WB_POSIX_MAP_SFU        = 1,
    39         WB_POSIX_MAP_SFU20      = 2,
    40         WB_POSIX_MAP_RFC2307    = 3,
    41         WB_POSIX_MAP_UNIXINFO   = 4
    42 };
    43 
    44 /* there are 5 possible types of errors the ads subsystem can produce */
    45 enum ads_error_type {ENUM_ADS_ERROR_KRB5, ENUM_ADS_ERROR_GSS,
    46                      ENUM_ADS_ERROR_LDAP, ENUM_ADS_ERROR_SYSTEM, ENUM_ADS_ERROR_NT};
    47 
    48 typedef struct {
    49         enum ads_error_type error_type;
    50         union err_state{               
    51                 int rc;
    52                 NTSTATUS nt_status;
    53         } err;
    54         /* For error_type = ENUM_ADS_ERROR_GSS minor_status describe GSS API error */
    55         /* Where rc represents major_status of GSS API error */
    56         int minor_status;
    57 } ADS_STATUS;
     9#include "libads/ads_status.h"
     10#include "smb_ldap.h"
    5811
    5912struct ads_struct;
     
    11669                LDAP *ld;
    11770                struct sockaddr_storage ss; /* the ip of the active connection, if any */
    118                 time_t last_attempt; /* last attempt to reconnect */
     71                time_t last_attempt; /* last attempt to reconnect, monotonic clock */
    11972                int port;
    12073
     
    150103} ADS_STRUCT;
    151104
    152 /* used to remember the names of the posix attributes in AD */
    153 /* see the rfc2307 & sfu nss backends */
    154 
    155 struct posix_schema {
    156         char *posix_homedir_attr;
    157         char *posix_shell_attr;
    158         char *posix_uidnumber_attr;
    159         char *posix_gidnumber_attr;
    160         char *posix_gecos_attr;
    161         char *posix_uid_attr;
    162 };
    163 
    164 
    165 
    166105#ifdef HAVE_ADS
    167106typedef LDAPMod **ADS_MODLIST;
     
    169108typedef void **ADS_MODLIST;
    170109#endif
    171 
    172 /* macros to simplify error returning */
    173 #define ADS_ERROR(rc) ADS_ERROR_LDAP(rc)
    174 #define ADS_ERROR_LDAP(rc) ads_build_error(ENUM_ADS_ERROR_LDAP, rc, 0)
    175 #define ADS_ERROR_SYSTEM(rc) ads_build_error(ENUM_ADS_ERROR_SYSTEM, rc?rc:EINVAL, 0)
    176 #define ADS_ERROR_KRB5(rc) ads_build_error(ENUM_ADS_ERROR_KRB5, rc, 0)
    177 #define ADS_ERROR_GSS(rc, minor) ads_build_error(ENUM_ADS_ERROR_GSS, rc, minor)
    178 #define ADS_ERROR_NT(rc) ads_build_nt_error(ENUM_ADS_ERROR_NT,rc)
    179 
    180 #define ADS_ERR_OK(status) ((status.error_type == ENUM_ADS_ERROR_NT) ? NT_STATUS_IS_OK(status.err.nt_status):(status.err.rc == 0))
    181 #define ADS_SUCCESS ADS_ERROR(0)
    182 
    183 #define ADS_ERROR_HAVE_NO_MEMORY(x) do { \
    184         if (!(x)) {\
    185                 return ADS_ERROR(LDAP_NO_MEMORY);\
    186         }\
    187 } while (0)
    188 
    189110
    190111/* time between reconnect attempts */
     
    200121#define ADS_SD_FLAGS_OID        "1.2.840.113556.1.4.801"
    201122
    202 /* ldap attribute oids (Services for Unix 3.0, 3.5) */
    203 #define ADS_ATTR_SFU_UIDNUMBER_OID      "1.2.840.113556.1.6.18.1.310"
    204 #define ADS_ATTR_SFU_GIDNUMBER_OID      "1.2.840.113556.1.6.18.1.311"
    205 #define ADS_ATTR_SFU_HOMEDIR_OID        "1.2.840.113556.1.6.18.1.344"
    206 #define ADS_ATTR_SFU_SHELL_OID          "1.2.840.113556.1.6.18.1.312"
    207 #define ADS_ATTR_SFU_GECOS_OID          "1.2.840.113556.1.6.18.1.337"
    208 #define ADS_ATTR_SFU_UID_OID            "1.2.840.113556.1.6.18.1.309"
    209 
    210 /* ldap attribute oids (Services for Unix 2.0) */
    211 #define ADS_ATTR_SFU20_UIDNUMBER_OID    "1.2.840.113556.1.4.7000.187.70"
    212 #define ADS_ATTR_SFU20_GIDNUMBER_OID    "1.2.840.113556.1.4.7000.187.71"
    213 #define ADS_ATTR_SFU20_HOMEDIR_OID      "1.2.840.113556.1.4.7000.187.106"
    214 #define ADS_ATTR_SFU20_SHELL_OID        "1.2.840.113556.1.4.7000.187.72"
    215 #define ADS_ATTR_SFU20_GECOS_OID        "1.2.840.113556.1.4.7000.187.97"
    216 #define ADS_ATTR_SFU20_UID_OID          "1.2.840.113556.1.4.7000.187.102"
    217 
    218 
    219 /* ldap attribute oids (RFC2307) */
    220 #define ADS_ATTR_RFC2307_UIDNUMBER_OID  "1.3.6.1.1.1.1.0"
    221 #define ADS_ATTR_RFC2307_GIDNUMBER_OID  "1.3.6.1.1.1.1.1"
    222 #define ADS_ATTR_RFC2307_HOMEDIR_OID    "1.3.6.1.1.1.1.3"
    223 #define ADS_ATTR_RFC2307_SHELL_OID      "1.3.6.1.1.1.1.4"
    224 #define ADS_ATTR_RFC2307_GECOS_OID      "1.3.6.1.1.1.1.2"
    225 #define ADS_ATTR_RFC2307_UID_OID        "0.9.2342.19200300.100.1.1"
    226 
    227123/* ldap bitwise searches */
    228124#define ADS_LDAP_MATCHING_RULE_BIT_AND  "1.2.840.113556.1.4.803"
     
    230126
    231127#define ADS_PINGS          0x0000FFFF  /* Ping response */
    232 #define ADS_DNS_CONTROLLER 0x20000000  /* DomainControllerName is a DNS name*/
    233 #define ADS_DNS_DOMAIN     0x40000000  /* DomainName is a DNS name */
    234 #define ADS_DNS_FOREST     0x80000000  /* DnsForestName is a DNS name */
    235128
    236129/* ads auth control flags */
     
    244137#define ADS_AUTH_SASL_FORCE       0x0080
    245138#define ADS_AUTH_USER_CREDS       0x0100
    246 
    247 /* Kerberos environment variable names */
    248 #define KRB5_ENV_CCNAME "KRB5CCNAME"
    249 
    250 #define WELL_KNOWN_GUID_COMPUTERS       "AA312825768811D1ADED00C04FD8D5CD"
    251 #define WELL_KNOWN_GUID_USERS           "A9D1CA15768811D1ADED00C04FD8D5CD"
    252139
    253140enum ads_extended_dn_flags {
     
    265152} ads_control;
    266153
    267 #define ADS_IGNORE_PRINCIPAL "not_defined_in_RFC4178@please_ignore"
     154#include "libads/ads_proto.h"
     155
     156#ifdef HAVE_LDAP
     157#include "libads/ads_ldap_protos.h"
     158#endif
     159
     160#include "libads/kerberos_proto.h"
    268161
    269162#endif  /* _INCLUDE_ADS_H_ */
  • trunk/server/source3/include/adt_tree.h

    r414 r745  
    2121#define ADT_TREE_H
    2222
    23 /* data structure used to build the tree */
    24 
    25 typedef struct _tree_node {
    26         struct _tree_node       *parent;
    27         struct _tree_node       **children;
    28         int                     num_children;
    29         char                    *key;
    30         void                    *data_p;
    31 } TREE_NODE;
    32 
    33 typedef struct _tree_root {
    34         TREE_NODE       *root;
    35 
    36         /* not used currently (is it needed?) */
    37         int             (*compare)(void* x, void *y);
    38 } SORTED_TREE;
     23struct sorted_tree;
    3924
    4025/*
     
    4429/* create a new tree, talloc_free() to throw it away */
    4530
    46 SORTED_TREE*  pathtree_init( void *data_p, int (cmp_fn)(void*, void*) );
     31struct sorted_tree *pathtree_init(void *data_p);
    4732
    4833/* add a new path component */
    4934
    50 WERROR        pathtree_add( SORTED_TREE *tree, const char *path, void *data_p );
     35WERROR pathtree_add(struct sorted_tree *tree, const char *path, void *data_p );
    5136
    5237/* search path */
    5338
    54 void*         pathtree_find( SORTED_TREE *tree, char *key );
     39void *pathtree_find(struct sorted_tree *tree, char *key );
    5540
    5641/* debug (print) functions */
    5742
    58 void          pathtree_print_keys( SORTED_TREE *tree, int debug );
     43void pathtree_print_keys(struct sorted_tree *tree, int debug );
    5944
    6045
  • trunk/server/source3/include/async_smb.h

    r596 r745  
    2121#define __ASYNC_SMB_H__
    2222
    23 #include "includes.h"
     23struct cli_state;
    2424
    2525/*
     
    5252uint16_t cli_smb_req_mid(struct tevent_req *req);
    5353void cli_smb_req_set_mid(struct tevent_req *req, uint16_t mid);
     54uint32_t cli_smb_req_seqnum(struct tevent_req *req);
     55void cli_smb_req_set_seqnum(struct tevent_req *req, uint32_t seqnum);
    5456struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    5557                                struct cli_state *cli,
     
    5860                                uint32_t num_bytes,
    5961                                const uint8_t *bytes);
    60 NTSTATUS cli_smb_recv(struct tevent_req *req, uint8_t min_wct,
    61                       uint8_t *pwct, uint16_t **pvwv,
     62NTSTATUS cli_smb_recv(struct tevent_req *req,
     63                      TALLOC_CTX *mem_ctx, uint8_t **pinbuf,
     64                      uint8_t min_wct, uint8_t *pwct, uint16_t **pvwv,
    6265                      uint32_t *pnum_bytes, uint8_t **pbytes);
    6366
  • trunk/server/source3/include/auth.h

    r414 r745  
    2020*/
    2121
    22 typedef struct auth_usersupplied_info {
    23         DATA_BLOB lm_resp;
    24         DATA_BLOB nt_resp;
    25         DATA_BLOB lm_interactive_pwd;
    26         DATA_BLOB nt_interactive_pwd;
    27         DATA_BLOB plaintext_password;
     22#include "../auth/common_auth.h"
    2823
    29         bool encrypted;
     24struct extra_auth_info {
     25        struct dom_sid user_sid;
     26        struct dom_sid pgid_sid;
     27};
    3028
    31         bool was_mapped;              /* Did the username map actually match? */
    32         char *client_domain;          /* domain name string */
    33         char *domain;                 /* domain name after mapping */
    34         char *internal_username;      /* username after mapping */
    35         char *smb_name;               /* username before mapping */
    36         char *wksta_name;             /* workstation name (netbios calling
    37                                        * name) unicode string */
     29struct auth_serversupplied_info {
     30        bool guest;
     31        bool system;
    3832
    39         uint32 logon_parameters;
    40 
    41 } auth_usersupplied_info;
    42 
    43 typedef struct auth_serversupplied_info {
    44         bool guest;
    45 
    46         DOM_SID *sids;  /* These SIDs are preliminary between
    47                            check_ntlm_password and the token creation. */
    48         size_t num_sids;
    49 
    50         struct unix_user_token utok;
     33        struct security_unix_token utok;
    5134
    5235        /* NT group information taken from the info3 structure */
    5336
    54         NT_USER_TOKEN *ptok;
     37        struct security_token *security_token;
     38
     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.
     47         */
    5548
    5649        DATA_BLOB user_session_key;
    5750        DATA_BLOB lm_session_key;
    5851
    59         char *login_server; /* which server authorized the login? */
     52        struct netr_SamInfo3 *info3;
    6053
    61         struct samu *sam_account;
    62 
    63         void *pam_handle;
     54        /* this structure is filled *only* in pathological cases where the user
     55         * sid or the primary group sid are not sids of the domain. Normally
     56         * this happens only for unix accounts that have unix domain sids.
     57         * This is checked only when info3.rid and/or info3.primary_gid are set
     58         * to the special invalid value of 0xFFFFFFFF */
     59        struct extra_auth_info extra;
    6460
    6561        /*
     
    7874         */
    7975        char *sanitized_username;
    80 } auth_serversupplied_info;
     76};
    8177
    8278struct auth_context {
     
    9288        struct auth_methods *auth_method_list; 
    9389
    94         TALLOC_CTX *mem_ctx;
    95         void (*get_ntlm_challenge)(struct auth_context *auth_context,
    96                                    uint8_t chal[8]);
     90        NTSTATUS (*get_ntlm_challenge)(struct auth_context *auth_context,
     91                                       uint8_t chal[8]);
    9792        NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context,
    9893                                        const struct auth_usersupplied_info *user_info,
    9994                                        struct auth_serversupplied_info **server_info);
    10095        NTSTATUS (*nt_status_squash)(NTSTATUS nt_status);
    101         void (*free)(struct auth_context **auth_context);
    10296};
    10397
     
    111105                         TALLOC_CTX *mem_ctx,
    112106                         const struct auth_usersupplied_info *user_info,
    113                          auth_serversupplied_info **server_info);
     107                         struct auth_serversupplied_info **server_info);
    114108
    115109        /* If you are using this interface, then you are probably
     
    137131};
    138132
    139 typedef struct auth_ntlmssp_state {
    140         TALLOC_CTX *mem_ctx;
    141         struct auth_context *auth_context;
    142         struct auth_serversupplied_info *server_info;
    143         struct ntlmssp_state *ntlmssp_state;
    144 } AUTH_NTLMSSP_STATE;
     133struct auth_ntlmssp_state;
    145134
    146135/* Changed from 1 -> 2 to add the logon_parameters field. */
    147 #define AUTH_INTERFACE_VERSION 2
     136/* 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
     138
     139#include "auth/proto.h"
    148140
    149141#endif /* _SMBAUTH_H_ */
  • trunk/server/source3/include/client.h

    r429 r745  
    4747};
    4848
    49 struct cli_pipe_auth_data {
    50         enum pipe_auth_type auth_type; /* switch for the union below. Defined in ntdomain.h */
    51         enum dcerpc_AuthLevel auth_level; /* defined in ntdomain.h */
    52 
    53         char *domain;
    54         char *user_name;
    55         DATA_BLOB user_session_key;
    56 
    57         union {
    58                 struct schannel_state *schannel_auth;
    59                 NTLMSSP_STATE *ntlmssp_state;
    60                 struct kerberos_auth_struct *kerberos_auth;
    61         } a_u;
    62 };
    63 
    64 /**
    65  * rpc_cli_transport defines a transport mechanism to ship rpc requests
    66  * asynchronously to a server and receive replies
    67  */
    68 
    69 struct rpc_cli_transport {
    70 
    71         enum dcerpc_transport_t transport;
    72 
    73         /**
    74          * Trigger an async read from the server. May return a short read.
    75          */
    76         struct tevent_req *(*read_send)(TALLOC_CTX *mem_ctx,
    77                                         struct event_context *ev,
    78                                         uint8_t *data, size_t size,
    79                                         void *priv);
    80         /**
    81          * Get the result from the read_send operation.
    82          */
    83         NTSTATUS (*read_recv)(struct tevent_req *req, ssize_t *preceived);
    84 
    85         /**
    86          * Trigger an async write to the server. May return a short write.
    87          */
    88         struct tevent_req *(*write_send)(TALLOC_CTX *mem_ctx,
    89                                          struct event_context *ev,
    90                                          const uint8_t *data, size_t size,
    91                                          void *priv);
    92         /**
    93          * Get the result from the read_send operation.
    94          */
    95         NTSTATUS (*write_recv)(struct tevent_req *req, ssize_t *psent);
    96 
    97         /**
    98          * This is an optimization for the SMB transport. It models the
    99          * TransactNamedPipe API call: Send and receive data in one round
    100          * trip. The transport implementation is free to set this to NULL,
    101          * cli_pipe.c will fall back to the explicit write/read routines.
    102          */
    103         struct tevent_req *(*trans_send)(TALLOC_CTX *mem_ctx,
    104                                          struct event_context *ev,
    105                                          uint8_t *data, size_t data_len,
    106                                          uint32_t max_rdata_len,
    107                                          void *priv);
    108         /**
    109          * Get the result from the trans_send operation.
    110          */
    111         NTSTATUS (*trans_recv)(struct tevent_req *req, TALLOC_CTX *mem_ctx,
    112                                uint8_t **prdata, uint32_t *prdata_len);
    113 
    114         bool (*is_connected)(void *priv);
    115         unsigned int (*set_timeout)(void *priv, unsigned int timeout);
    116 
    117         void *priv;
    118 };
    119 
    120 struct rpc_pipe_client {
    121         struct rpc_pipe_client *prev, *next;
    122 
    123         struct rpc_cli_transport *transport;
    124 
    125         struct ndr_syntax_id abstract_syntax;
    126         struct ndr_syntax_id transfer_syntax;
    127 
    128         NTSTATUS (*dispatch) (struct rpc_pipe_client *cli,
    129                         TALLOC_CTX *mem_ctx,
    130                         const struct ndr_interface_table *table,
    131                         uint32_t opnum, void *r);
    132 
    133         struct tevent_req *(*dispatch_send)(
    134                 TALLOC_CTX *mem_ctx,
    135                 struct tevent_context *ev,
    136                 struct rpc_pipe_client *cli,
    137                 const struct ndr_interface_table *table,
    138                 uint32_t opnum,
    139                 void *r);
    140         NTSTATUS (*dispatch_recv)(struct tevent_req *req,
    141                                   TALLOC_CTX *mem_ctx);
    142 
    143 
    144         char *desthost;
    145         char *srv_name_slash;
    146 
    147         uint16 max_xmit_frag;
    148         uint16 max_recv_frag;
    149 
    150         struct cli_pipe_auth_data *auth;
    151 
    152         /* The following is only non-null on a netlogon client pipe. */
    153         struct netlogon_creds_CredentialState *dc;
    154 
    155         /* Used by internal rpc_pipe_client */
    156         pipes_struct *pipes_struct;
    157 };
    158 
    159 /* Transport encryption state. */
    160 enum smb_trans_enc_type {
    161                 SMB_TRANS_ENC_NTLM
    162 #if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
    163                 , SMB_TRANS_ENC_GSS
    164 #endif
    165 };
    166 
    167 #if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
    168 struct smb_tran_enc_state_gss {
    169         gss_ctx_id_t gss_ctx;
    170         gss_cred_id_t creds;
    171 };
    172 #endif
    173 
    174 struct smb_trans_enc_state {
    175         enum smb_trans_enc_type smb_enc_type;
    176         uint16 enc_ctx_num;
    177         bool enc_on;
    178         union {
    179                 NTLMSSP_STATE *ntlmssp_state;
    180 #if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
    181                 struct smb_tran_enc_state_gss *gss_state;
    182 #endif
    183         } s;
    184 };
    185 
    18649struct cli_state_seqnum {
    18750        struct cli_state_seqnum *prev, *next;
     
    20972        int privileges;
    21073
    211         fstring desthost;
     74        char *desthost;
    21275
    21376        /* The credentials used to open the cli_state connection. */
     
    22184         * the protocol > NT1.
    22285         */
    223         fstring server_type;
    224         fstring server_os;
    225         fstring server_domain;
     86        char *server_type;
     87        char *server_os;
     88        char *server_domain;
    22689
    227         fstring share;
    228         fstring dev;
     90        char *share;
     91        char *dev;
    22992        struct nmb_name called;
    23093        struct nmb_name calling;
    231         fstring full_dest_host_name;
    23294        struct sockaddr_storage dest_ss;
    23395
     
    248110        int win95;
    249111        bool is_samba;
     112        bool is_guestlogin;
    250113        uint32 capabilities;
    251         uint32 posix_capabilities;
     114        /* What the server offered. */
     115        uint32_t server_posix_capabilities;
     116        /* What the client requested. */
     117        uint32_t requested_posix_capabilities;
    252118        bool dfsroot;
    253 
    254 #if 0
    255         TALLOC_CTX *longterm_mem_ctx;
    256         TALLOC_CTX *call_mem_ctx;
    257 #endif
    258119
    259120        struct smb_signing_state *signing_state;
     
    290151};
    291152
    292 typedef struct file_info {
    293         struct cli_state *cli;
     153struct file_info {
    294154        uint64_t size;
    295155        uint16 mode;
     
    302162        char *name;
    303163        char short_name[13*3]; /* the *3 is to cope with multi-byte */
    304 } file_info;
     164};
    305165
    306166#define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001
  • trunk/server/source3/include/config.h.in

    r620 r745  
    6767#undef ENABLE_DMALLOC
    6868
    69 /* Whether we have gnutls support (SSL) */
    70 #undef ENABLE_GNUTLS
    71 
    72 /* Whether we have libnetapi on the host system */
    73 #undef ENABLE_LIBNETAPI
    74 
    7569/* Whether to use fully FHS-compatible paths */
    7670#undef FHS_COMPATIBLE
     
    163157#undef HAVE_ARPA_INET_H
    164158
    165 /* Define to 1 if you have the <arpa/nameser.h> header file. */
    166 #undef HAVE_ARPA_NAMESER_H
    167 
    168159/* check for <asm/types.h> */
    169160#undef HAVE_ASM_TYPES_H
     
    214205#undef HAVE_AVAHI_COMMON_WATCH_H
    215206
    216 /* Define to 1 if you have the `backtrace' function. */
    217 #undef HAVE_BACKTRACE
    218 
    219207/* Define to 1 if you have the `backtrace_symbols' function. */
    220208#undef HAVE_BACKTRACE_SYMBOLS
     
    238226#undef HAVE_BLKCNT_T
    239227
    240 /* Define to 1 if you have the <blkid/blkid.h> header file. */
    241 #undef HAVE_BLKID_BLKID_H
    242 
    243 /* Define to 1 if you have the `blkid_get_cache' function. */
    244 #undef HAVE_BLKID_GET_CACHE
    245 
    246228/* Define to 1 if the system has the type `blksize_t'. */
    247229#undef HAVE_BLKSIZE_T
     
    265247#undef HAVE_BROKEN_READLINK
    266248
    267 /* Define to 1 if you have the `bswap16' function. */
    268 #undef HAVE_BSWAP16
    269 
    270 /* Define to 1 if you have the `bswap32' function. */
    271 #undef HAVE_BSWAP32
    272 
    273249/* Define to 1 if you have the `bzero' function. */
    274250#undef HAVE_BZERO
     
    283259#undef HAVE_CFSTRINGENCODINGCONVERTER_H
    284260
    285 /* Define to 1 if you have the `cgetent' function. */
    286 #undef HAVE_CGETENT
    287 
    288261/* Whether the krb5_checksum struct has a checksum property */
    289262#undef HAVE_CHECKSUM_IN_KRB5_CHECKSUM
     
    304277#undef HAVE_CHSIZE
    305278
    306 /* Whether clock_gettime is available */
     279/* Define to 1 if there is support for clock_gettime */
    307280#undef HAVE_CLOCK_GETTIME
    308281
     
    319292#undef HAVE_CLOSEDIR64
    320293
    321 /* Define to 1 if you have the `closefrom' function. */
    322 #undef HAVE_CLOSEFROM
    323 
    324294/* Whether or not we have comparison_fn_t */
    325295#undef HAVE_COMPARISON_FN_T
     
    330300/* Whether the compiler will optimize out function calls */
    331301#undef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS
    332 
    333 /* Whether com_err is available */
    334 #undef HAVE_COM_ERR
    335302
    336303/* Define to 1 if you have the <com_err.h> header file. */
     
    350317#undef HAVE_CREAT64
    351318
    352 /* Define to 1 if you have the `crypt' function. */
     319/* Whether the system has the crypt() function */
    353320#undef HAVE_CRYPT
    354321
     
    359326#undef HAVE_CRYPT_H
    360327
     328/* Whether CTDB_CONTROL_SCHEDULE_FOR_DELETION() is available */
     329#undef HAVE_CTDB_CONTROL_SCHEDULE_FOR_DELETION_DECL
     330
    361331/* Whether CTDB_CONTROL_TRANS3_COMMIT() is available */
    362332#undef HAVE_CTDB_CONTROL_TRANS3_COMMIT_DECL
     
    379349/* Define to 1 if you have the <cups/language.h> header file. */
    380350#undef HAVE_CUPS_LANGUAGE_H
    381 
    382 /* Define to 1 if you have the <curses.h> header file. */
    383 #undef HAVE_CURSES_H
    384351
    385352/* Whether to use the Darwin-specific initgroups system call */
     
    390357#undef HAVE_DECL_ASPRINTF
    391358
    392 /* Define to 1 if you have the declaration of `h_errno', and to 0 if you
    393    don't. */
    394 #undef HAVE_DECL_H_ERRNO
    395 
    396359/* Define to 1 if you have the declaration of
    397360   `krb5_auth_con_set_req_cksumtype', and to 0 if you don't. */
     
    418381#undef HAVE_DECL_VSNPRINTF
    419382
    420 /* Define to 1 if you have the declaration of `_res', and to 0 if you don't.
    421    */
    422 #undef HAVE_DECL__RES
    423 
    424383/* Define to 1 if you have the `delproplist' function. */
    425384#undef HAVE_DELPROPLIST
     
    486445#undef HAVE_DNSSERVICEREGISTER
    487446
    488 /* Define to 1 if you have the <dns.h> header file. */
    489 #undef HAVE_DNS_H
    490 
    491447/* Define to 1 if you have the <dns_sd.h> header file. */
    492448#undef HAVE_DNS_SD_H
    493449
    494 /* Define to 1 if you have the `dns_search' function. */
    495 #undef HAVE_DNS_SEARCH
    496 
    497 /* Define to 1 if you have the `dn_expand' function. */
    498 #undef HAVE_DN_EXPAND
     450/* Define to 1 if you have the `dprintf' function. */
     451#undef HAVE_DPRINTF
    499452
    500453/* struct dqblk .dqb_fsoftlimit */
     
    504457#undef HAVE_DUP2
    505458
    506 /* Whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type is available */
     459/* Whether the ENCTYPE_ARCFOUR_HMAC key type definition is available */
     460#undef HAVE_ENCTYPE_ARCFOUR_HMAC
     461
     462/* Whether the ENCTYPE_ARCFOUR_HMAC_MD5 key type definition is available */
    507463#undef HAVE_ENCTYPE_ARCFOUR_HMAC_MD5
    508464
     
    513469#undef HAVE_ENDNETGRENT
    514470
     471/* If endnetgrent prototype is defined */
     472#undef HAVE_ENDNETGRENT_PROTOTYPE
     473
    515474/* Whether environ() is available */
    516475#undef HAVE_ENVIRON_DECL
     
    522481#undef HAVE_EPOLL_CREATE
    523482
    524 /* Define to 1 if you have the `err' function. */
    525 #undef HAVE_ERR
    526 
    527483/* Whether errno() is available */
    528484#undef HAVE_ERRNO_DECL
    529485
    530 /* Define to 1 if you have the <errno.h> header file. */
    531 #undef HAVE_ERRNO_H
    532 
    533 /* Define to 1 if you have the `errx' function. */
    534 #undef HAVE_ERRX
    535 
    536 /* Define to 1 if you have the <err.h> header file. */
    537 #undef HAVE_ERR_H
    538 
    539486/* Whether the EncryptedData struct has a etype property */
    540487#undef HAVE_ETYPE_IN_ENCRYPTEDDATA
     
    588535#undef HAVE_E_DATA_POINTER_IN_KRB5_ERROR
    589536
    590 /* Define to 1 if you have the `FAMOpen2' function. */
     537/* Define to 1 if you have the `fallocate' function. */
     538#undef HAVE_FALLOCATE
     539
     540/* Define to 1 if you have the `fallocate64' function. */
     541#undef HAVE_FALLOCATE64
     542
     543/* Define to 1 if there is support for FAMNoExists */
     544#undef HAVE_FAMNOEXISTS
     545
     546/* Define to 1 if there is support for FAMOpen2 */
    591547#undef HAVE_FAMOPEN2
    592548
     
    618574#undef HAVE_FDATASYNC
    619575
     576/* Whether fdatasync() is available */
     577#undef HAVE_FDATASYNC_DECL
     578
    620579/* Define to 1 if you have the `fdelproplist' function. */
    621580#undef HAVE_FDELPROPLIST
    622581
     582/* Define to 1 if you have the `fdopendir' function. */
     583#undef HAVE_FDOPENDIR
     584
     585/* Define to 1 if you have the `fdopendir64' function. */
     586#undef HAVE_FDOPENDIR64
     587
    623588/* Define to 1 if you have the `fgetea' function. */
    624589#undef HAVE_FGETEA
     
    639604#undef HAVE_FLOAT_H
    640605
    641 /* Define to 1 if you have the `flock' function. */
    642 #undef HAVE_FLOCK
    643 
    644606/* Define to 1 if you have the <fnmatch.h> header file. */
    645607#undef HAVE_FNMATCH_H
     
    651613#undef HAVE_FREEADDRINFO
    652614
    653 /* Define to 1 if you have the `freehostent' function. */
    654 #undef HAVE_FREEHOSTENT
     615/* Whether we have FreeBSD sunacl around */
     616#undef HAVE_FREEBSD_SUNACL_H
    655617
    656618/* Whether the system has freeifaddrs */
     
    714676#undef HAVE_FUNCTION_MACRO
    715677
    716 /* Whether F_SETLEASE() is available */
    717 #undef HAVE_F_SETLEASE_DECL
     678/* Define to 1 if you have the `futimens' function. */
     679#undef HAVE_FUTIMENS
     680
     681/* Define to 1 if you have the `futimes' function. */
     682#undef HAVE_FUTIMES
    718683
    719684/* Whether the system has gai_strerror */
    720685#undef HAVE_GAI_STRERROR
    721686
    722 /* Define to 1 if you have the <gcrypt.h> header file. */
    723 #undef HAVE_GCRYPT_H
    724 
    725 /* Define to 1 if you have the `gcry_control' function. */
    726 #undef HAVE_GCRY_CONTROL
    727 
    728687/* Whether the system has getaddrinfo */
    729688#undef HAVE_GETADDRINFO
     
    774733#undef HAVE_GETHOSTBYNAME
    775734
    776 /* Define to 1 if you have the `gethostname' function. */
    777 #undef HAVE_GETHOSTNAME
    778 
    779735/* Whether the system has getifaddrs */
    780736#undef HAVE_GETIFADDRS
    781737
    782 /* Define to 1 if you have the `getipnodebyaddr' function. */
    783 #undef HAVE_GETIPNODEBYADDR
    784 
    785 /* Define to 1 if you have the `getipnodebyname' function. */
    786 #undef HAVE_GETIPNODEBYNAME
    787 
    788738/* Define to 1 if you have the `getmntent' function. */
    789739#undef HAVE_GETMNTENT
    790740
    791 /* Define to 1 if you have the `getnameinfo' function. */
     741/* Whether the system has getnameinfo */
    792742#undef HAVE_GETNAMEINFO
    793743
     
    795745#undef HAVE_GETNETGRENT
    796746
     747/* If getnetgrent prototype is defined */
     748#undef HAVE_GETNETGRENT_PROTOTYPE
     749
    797750/* Define to 1 if you have the <getopt.h> header file. */
    798751#undef HAVE_GETOPT_H
     
    801754#undef HAVE_GETPAGESIZE
    802755
     756/* Whether we have getpeereid to get socket credentials */
     757#undef HAVE_GETPEEREID
     758
    803759/* Define to 1 if you have the `getpgrp' function. */
    804760#undef HAVE_GETPGRP
    805761
    806 /* Define to 1 if you have the `getprogname' function. */
    807 #undef HAVE_GETPROGNAME
    808 
    809762/* Define to 1 if you have the `getproplist' function. */
    810763#undef HAVE_GETPROPLIST
     
    849802#undef HAVE_GETXATTR
    850803
     804/* Define to 1 if you have the `get_current_dir_name' function. */
     805#undef HAVE_GET_CURRENT_DIR_NAME
     806
    851807/* Define to 1 if you have the `get_proplist_entry' function. */
    852808#undef HAVE_GET_PROPLIST_ENTRY
     
    855811#undef HAVE_GICONV
    856812
    857 /* Whether giconv.h is present */
    858 #undef HAVE_GICONV_H
    859 
    860813/* Define to 1 if you have the `glob' function. */
    861814#undef HAVE_GLOB
     
    864817#undef HAVE_GLOB_H
    865818
    866 /* Define to 1 if the system has the type `gnutls_datum'. */
    867 #undef HAVE_GNUTLS_DATUM
    868 
    869 /* Define to 1 if the system has the type `gnutls_datum_t'. */
    870 #undef HAVE_GNUTLS_DATUM_T
    871 
    872 /* Define to 1 if you have the `gnutls_global_init' function. */
    873 #undef HAVE_GNUTLS_GLOBAL_INIT
    874 
    875 /* Define to 1 if you have the <gnutls/gnutls.h> header file. */
    876 #undef HAVE_GNUTLS_GNUTLS_H
    877 
    878 /* gnutls subject_key */
    879 #undef HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID
    880 
    881 /* gnutls set_version */
    882 #undef HAVE_GNUTLS_X509_CRT_SET_VERSION
    883 
    884819/* Whether GPFS GPL headers are available */
    885820#undef HAVE_GPFS
     
    897832#undef HAVE_GSSAPI
    898833
     834/* Define to 1 if you have the <gssapi/gssapi_ext.h> header file. */
     835#undef HAVE_GSSAPI_GSSAPI_EXT_H
     836
    899837/* Define to 1 if you have the <gssapi/gssapi_generic.h> header file. */
    900838#undef HAVE_GSSAPI_GSSAPI_GENERIC_H
     
    909847#undef HAVE_GSS_DISPLAY_STATUS
    910848
     849/* Define to 1 if you have the `gss_get_name_attribute' function. */
     850#undef HAVE_GSS_GET_NAME_ATTRIBUTE
     851
     852/* Define to 1 if you have the `gss_wrap_iov' function. */
     853#undef HAVE_GSS_WRAP_IOV
     854
    911855/* Define to 1 if you have the <history.h> header file. */
    912856#undef HAVE_HISTORY_H
     
    927871#undef HAVE_HTTPCONNECTENCRYPT
    928872
    929 /* Define if you have the `h_errno' variable. */
    930 #undef HAVE_H_ERRNO
    931 
    932873/* What header to include for iconv() function: iconv.h */
    933874#undef HAVE_ICONV
    934875
    935 /* Whether iconv.h is present */
    936 #undef HAVE_ICONV_H
    937 
    938876/* Whether iface AIX is available */
    939877#undef HAVE_IFACE_AIX
     
    1008946#undef HAVE_IRIX_ACLS
    1009947
    1010 /* Whether IRIX specific capabilities are available */
    1011 #undef HAVE_IRIX_SPECIFIC_CAPABILITIES
    1012 
    1013 /* Define to 1 if you have the `iruserok' function. */
    1014 #undef HAVE_IRUSEROK
    1015 
    1016948/* Define to 1 if you have the `isatty' function. */
    1017949#undef HAVE_ISATTY
     
    1029961#undef HAVE_KERNEL_SHARE_MODES
    1030962
    1031 /* Define to 1 if you have the <keyutils.h> header file. */
    1032 #undef HAVE_KEYUTILS_H
    1033 
    1034 /* Whether kerberos is available */
     963/* Whether to have KRB5 support */
    1035964#undef HAVE_KRB5
    1036965
     
    12871216#undef HAVE_LDAP_SET_REBIND_PROC
    12881217
    1289 /* Whether ldb_sqlite3 is available */
    1290 #undef HAVE_LDB_SQLITE3
    1291 
    12921218/* Define to 1 if you have the `lgetea' function. */
    12931219#undef HAVE_LGETEA
     
    12991225#undef HAVE_LIBASN1
    13001226
    1301 /* Whether we have blkid support (e2fsprogs) */
    1302 #undef HAVE_LIBBLKID
    1303 
    13041227/* Define to 1 if you have the `com_err' library (-lcom_err). */
    13051228#undef HAVE_LIBCOM_ERR
    13061229
    1307 /* Define to 1 if you have the `crypt' library (-lcrypt). */
    1308 #undef HAVE_LIBCRYPT
    1309 
    13101230/* Define to 1 if you have the `crypto' library (-lcrypto). */
    13111231#undef HAVE_LIBCRYPTO
     
    13261246#undef HAVE_LIBFAM
    13271247
    1328 /* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
    1329 #undef HAVE_LIBGCRYPT
    1330 
    1331 /* Define to 1 if you have the `gnutls' library (-lgnutls). */
    1332 #undef HAVE_LIBGNUTLS
    1333 
    13341248/* Define to 1 if you have the `gssapi' library (-lgssapi). */
    13351249#undef HAVE_LIBGSSAPI
     
    13411255#undef HAVE_LIBINET
    13421256
    1343 /* Define to 1 if you have the `intl' library (-lintl). */
    1344 #undef HAVE_LIBINTL
    1345 
    13461257/* Define to 1 if you have the <libintl.h> header file. */
    13471258#undef HAVE_LIBINTL_H
     
    13621273#undef HAVE_LIBLDAP
    13631274
    1364 /* Define to 1 if you have the `netapi' library (-lnetapi). */
    1365 #undef HAVE_LIBNETAPI
    1366 
    1367 /* Define to 1 if you have the `libnetapi_init' function. */
    1368 #undef HAVE_LIBNETAPI_INIT
    1369 
    13701275/* Define to 1 if you have the `nscd' library (-lnscd). */
    13711276#undef HAVE_LIBNSCD
     
    13771282#undef HAVE_LIBNSL_S
    13781283
    1379 /* Define to 1 if you have the `pam' library (-lpam). */
     1284/* Whether libpam is available */
    13801285#undef HAVE_LIBPAM
    13811286
     
    13921297#undef HAVE_LIBRT
    13931298
    1394 /* Define to 1 if you have the `sasl2' library (-lsasl2). */
    1395 #undef HAVE_LIBSASL2
    1396 
    13971299/* Define to 1 if you have the `sendfile' library (-lsendfile). */
    13981300#undef HAVE_LIBSENDFILE
    13991301
    1400 /* Define to 1 if you have the `setproctitle' library (-lsetproctitle). */
    1401 #undef HAVE_LIBSETPROCTITLE
    1402 
    14031302/* Define to 1 if you have the `socket' library (-lsocket). */
    14041303#undef HAVE_LIBSOCKET
    14051304
    1406 /* Define to 1 if you have the `sqlite3' library (-lsqlite3). */
    1407 #undef HAVE_LIBSQLITE3
    1408 
    14091305/* Whether libunwind is available */
    14101306#undef HAVE_LIBUNWIND
     
    14191315#undef HAVE_LIBUNWIND_PTRACE_H
    14201316
    1421 /* Define to 1 if you have the `util' library (-lutil). */
    1422 #undef HAVE_LIBUTIL
    1423 
    1424 /* Define to 1 if you have the <libutil.h> header file. */
    1425 #undef HAVE_LIBUTIL_H
    1426 
    14271317/* Define to 1 if you have the `z' library (-lz). */
    14281318#undef HAVE_LIBZ
     
    14371327#undef HAVE_LINUX_DQBLK_XFS_H
    14381328
     1329/* Whether the Linux 'fallocate' function is available */
     1330#undef HAVE_LINUX_FALLOCATE
     1331
     1332/* Whether the Linux 'fallocate64' function is available */
     1333#undef HAVE_LINUX_FALLOCATE64
     1334
     1335/* Define to 1 if you have the <linux/falloc.h> header file. */
     1336#undef HAVE_LINUX_FALLOC_H
     1337
    14391338/* Define to 1 if you have the <linux/inotify.h> header file. */
    14401339#undef HAVE_LINUX_INOTIFY_H
     
    14431342#undef HAVE_LINUX_IPV6_V6ONLY_26
    14441343
     1344/* Define to 1 if you have the <linux/netlink.h> header file. */
     1345#undef HAVE_LINUX_NETLINK_H
     1346
    14451347/* Whether the Linux ptrace(2) interface is available. */
    14461348#undef HAVE_LINUX_PTRACE
     
    14491351#undef HAVE_LINUX_READAHEAD
    14501352
     1353/* Define to 1 if you have the <linux/rtnetlink.h> header file. */
     1354#undef HAVE_LINUX_RTNETLINK_H
     1355
    14511356/* Whether Linux splice is available */
    14521357#undef HAVE_LINUX_SPLICE
    14531358
     1359/* Define to 1 if you have the <linux/types.h> header file. */
     1360#undef HAVE_LINUX_TYPES_H
     1361
    14541362/* Whether Linux xfs quota support is available */
    14551363#undef HAVE_LINUX_XFS_QUOTAS
     
    15001408#undef HAVE_LSTAT64
    15011409
     1410/* Define to 1 if you have the `lutimes' function. */
     1411#undef HAVE_LUTIMES
     1412
    15021413/* Whether the krb5_address struct has a magic property */
    15031414#undef HAVE_MAGIC_IN_KRB5_ADDRESS
     
    15121423#undef HAVE_MEMCPY
    15131424
     1425/* Define to 1 if you have the `memmem' function. */
     1426#undef HAVE_MEMMEM
     1427
    15141428/* Define to 1 if you have the `memmove' function. */
    15151429#undef HAVE_MEMMOVE
     
    15631477#undef HAVE_NANOSLEEP
    15641478
    1565 /* Whether external iconv is available */
     1479/* Whether to use native iconv */
    15661480#undef HAVE_NATIVE_ICONV
    15671481
     
    15691483#undef HAVE_NDIR_H
    15701484
    1571 /* Define to 1 if you have the <netapi.h> header file. */
    1572 #undef HAVE_NETAPI_H
    1573 
    15741485/* Define to 1 if you have the <netdb.h> header file. */
    15751486#undef HAVE_NETDB_H
     
    15781489#undef HAVE_NETGROUP_H
    15791490
    1580 /* Define to 1 if you have the <netinet6/in6.h> header file. */
    1581 #undef HAVE_NETINET6_IN6_H
    1582 
    1583 /* Define to 1 if you have the <netinet/in6.h> header file. */
    1584 #undef HAVE_NETINET_IN6_H
    1585 
    15861491/* Define to 1 if you have the <netinet/in.h> header file. */
    15871492#undef HAVE_NETINET_IN_H
     
    15991504#undef HAVE_NETINET_TCP_H
    16001505
    1601 /* Define to 1 if you have the `NetUserGetGroups' function. */
    1602 #undef HAVE_NETUSERGETGROUPS
    1603 
    1604 /* Define to 1 if you have the `NetUserGetInfo' function. */
    1605 #undef HAVE_NETUSERGETINFO
    1606 
    1607 /* Define to 1 if you have the `NetUserModalsGet' function. */
    1608 #undef HAVE_NETUSERMODALSGET
    1609 
    1610 /* Define to 1 if you have the `NetUserSetInfo' function. */
    1611 #undef HAVE_NETUSERSETINFO
    1612 
    16131506/* usability of net/if.h */
    16141507#undef HAVE_NET_IF_H
     
    16171510#undef HAVE_NEW_LIBREADLINE
    16181511
     1512/* Whether nfs quota support is available */
     1513#undef HAVE_NFS_QUOTAS
     1514
    16191515/* Define to 1 if you have the `nl_langinfo' function. */
    16201516#undef HAVE_NL_LANGINFO
     
    16561552#undef HAVE_OPENDIR64
    16571553
    1658 /* Define to 1 if you have the `openpty' function. */
    1659 #undef HAVE_OPENPTY
    1660 
    16611554/* Whether the open(2) accepts O_DIRECT */
    16621555#undef HAVE_OPEN_O_DIRECT
     
    16771570#undef HAVE_PAM_RADIO_TYPE
    16781571
    1679 /* Define to 1 if you have the `pam_start' function. */
    1680 #undef HAVE_PAM_START
     1572/* Define to 1 if PAM_RHOST is available */
     1573#undef HAVE_PAM_RHOST
     1574
     1575/* Define to 1 if PAM_TTY is available */
     1576#undef HAVE_PAM_TTY
    16811577
    16821578/* Define to 1 if you have the `pam_vsyslog' function. */
     
    17041600#undef HAVE_POLL
    17051601
    1706 /* Define to 1 if you have the <popt.h> header file. */
    1707 #undef HAVE_POPT_H
     1602/* Define to 1 if you have the <poll.h> header file. */
     1603#undef HAVE_POLL_H
    17081604
    17091605/* Whether POSIX ACLs are available */
     
    17481644/* Define to 1 if the system has the type `ptrdiff_t'. */
    17491645#undef HAVE_PTRDIFF_T
    1750 
    1751 /* Define to 1 if you have the <pty.h> header file. */
    1752 #undef HAVE_PTY_H
    1753 
    1754 /* Define to 1 if you have the `putenv' function. */
    1755 #undef HAVE_PUTENV
    17561646
    17571647/* Whether putprpwnam is available */
     
    17971687#undef HAVE_RANDOM
    17981688
    1799 /* Define to 1 if you have the `rcmd' function. */
    1800 #undef HAVE_RCMD
    1801 
    18021689/* Define to 1 if you have the `rdchk' function. */
    18031690#undef HAVE_RDCHK
     
    18211708#undef HAVE_READLINK
    18221709
    1823 /* Define to 1 if you have the `readv' function. */
    1824 #undef HAVE_READV
    1825 
    18261710/* Define to 1 if you have the `realpath' function. */
    18271711#undef HAVE_REALPATH
     
    18361720#undef HAVE_RENAME
    18371721
    1838 /* Define to 1 if you have the <resolv.h> header file. */
    1839 #undef HAVE_RESOLV_H
    1840 
    1841 /* Define to 1 if you have the `res_ndestroy' function. */
    1842 #undef HAVE_RES_NDESTROY
    1843 
    1844 /* Define to 1 if you have the `res_nsearch' function. */
    1845 #undef HAVE_RES_NSEARCH
    1846 
    1847 /* Define to 1 if you have the `res_search' function. */
    1848 #undef HAVE_RES_SEARCH
    1849 
    18501722/* Define to 1 if you have the `rewinddir64' function. */
    18511723#undef HAVE_REWINDDIR64
     
    18721744#undef HAVE_RPC_RPC_H
    18731745
    1874 /* Define to 1 if you have the `sasl_client_init' function. */
    1875 #undef HAVE_SASL_CLIENT_INIT
    1876 
    1877 /* Define to 1 if you have the <sasl/sasl.h> header file. */
    1878 #undef HAVE_SASL_SASL_H
    1879 
    18801746/* Define to 1 if the system has the type `sa_family_t'. */
    18811747#undef HAVE_SA_FAMILY_T
    18821748
    1883 /* Whether SA_SIGINFO() is available */
    1884 #undef HAVE_SA_SIGINFO_DECL
    1885 
    18861749/* Whether mkstemp is secure */
    18871750#undef HAVE_SECURE_MKSTEMP
     
    19171780#undef HAVE_SENDFILEV64
    19181781
    1919 /* Define to 1 if you have the `sendmsg' function. */
    1920 #undef HAVE_SENDMSG
    1921 
    19221782/* Define to 1 if you have the `setbuffer' function. */
    19231783#undef HAVE_SETBUFFER
     
    19441804#undef HAVE_SETGROUPS
    19451805
    1946 /* Define to 1 if you have the `setitimer' function. */
    1947 #undef HAVE_SETITIMER
    1948 
    19491806/* Define to 1 if you have the <setjmp.h> header file. */
    19501807#undef HAVE_SETJMP_H
     
    19651822#undef HAVE_SETNETGRENT
    19661823
     1824/* If setnetgrent prototype is defined */
     1825#undef HAVE_SETNETGRENT_PROTOTYPE
     1826
    19671827/* Define to 1 if you have the `setpgid' function. */
    19681828#undef HAVE_SETPGID
     
    19711831#undef HAVE_SETPRIV
    19721832
    1973 /* Whether setproctitle() is available */
    1974 #undef HAVE_SETPROCTITLE
    1975 
    1976 /* Define to 1 if you have the <setproctitle.h> header file. */
    1977 #undef HAVE_SETPROCTITLE_H
    1978 
    1979 /* Define to 1 if you have the `setprogname' function. */
    1980 #undef HAVE_SETPROGNAME
    1981 
    19821833/* Define to 1 if you have the `setproplist' function. */
    19831834#undef HAVE_SETPROPLIST
     
    20341885#undef HAVE_SIGBLOCK
    20351886
    2036 /* Define to 1 if you have the <signal.h> header file. */
    2037 #undef HAVE_SIGNAL_H
    2038 
    20391887/* Define to 1 if you have the `sigprocmask' function. */
    20401888#undef HAVE_SIGPROCMASK
     
    20551903#undef HAVE_SOCKADDR_SA_LEN
    20561904
    2057 /* Define to 1 if you have the `socket' function. */
    2058 #undef HAVE_SOCKET
    2059 
    20601905/* Define to 1 if you have the `socketpair' function. */
    20611906#undef HAVE_SOCKETPAIR
     
    20731918#undef HAVE_SPLICE_DECL
    20741919
    2075 /* Whether sqlite3 is available */
    2076 #undef HAVE_SQLITE3
    2077 
    2078 /* Define to 1 if you have the <sqlite3.h> header file. */
    2079 #undef HAVE_SQLITE3_H
    2080 
    2081 /* Define to 1 if you have the `sqlite3_open' function. */
    2082 #undef HAVE_SQLITE3_OPEN
    2083 
    20841920/* Define to 1 if you have the `srand' function. */
    20851921#undef HAVE_SRAND
     
    21181954#undef HAVE_STAT_ST_FLAGS
    21191955
    2120 /* Whether stat has tv_nsec nanosecond fields */
    2121 #undef HAVE_STAT_TV_NSEC
    2122 
    21231956/* Define to 1 if you have the <stdarg.h> header file. */
    21241957#undef HAVE_STDARG_H
     
    21511984#undef HAVE_STRERROR
    21521985
     1986/* Define to 1 if you have the `strerror_r' function. */
     1987#undef HAVE_STRERROR_R
     1988
    21531989/* Define to 1 if you have the `strftime' function. */
    21541990#undef HAVE_STRFTIME
     
    21662002#undef HAVE_STRLCPY
    21672003
    2168 /* Define to 1 if you have the `strlwr' function. */
    2169 #undef HAVE_STRLWR
    2170 
    2171 /* Define to 1 if you have the `strncasecmp' function. */
    2172 #undef HAVE_STRNCASECMP
    2173 
    21742004/* Define to 1 if you have the `strndup' function. */
    21752005#undef HAVE_STRNDUP
     
    21832013/* Define to 1 if you have the `strpbrk' function. */
    21842014#undef HAVE_STRPBRK
    2185 
    2186 /* Define to 1 if you have the `strptime' function. */
    2187 #undef HAVE_STRPTIME
    2188 
    2189 /* Define to 1 if you have the `strsep' function. */
    2190 #undef HAVE_STRSEP
    2191 
    2192 /* Define to 1 if you have the `strsep_copy' function. */
    2193 #undef HAVE_STRSEP_COPY
    21942015
    21952016/* Define to 1 if you have the `strsignal' function. */
     
    22942115#undef HAVE_STRUCT_TIMESPEC
    22952116
    2296 /* define if struct winsize is declared in sys/termios.h */
    2297 #undef HAVE_STRUCT_WINSIZE
    2298 
    22992117/* Define to 1 if you have the `strupr' function. */
    23002118#undef HAVE_STRUPR
     
    23042122#undef HAVE_ST_RDEV
    23052123
    2306 /* Define to 1 if you have the `swab' function. */
    2307 #undef HAVE_SWAB
    2308 
    23092124/* Define to 1 if you have the `symlink' function. */
    23102125#undef HAVE_SYMLINK
     
    23302145/* Define to 1 if you have the <sys/attributes.h> header file. */
    23312146#undef HAVE_SYS_ATTRIBUTES_H
    2332 
    2333 /* Define to 1 if you have the <sys/bswap.h> header file. */
    2334 #undef HAVE_SYS_BSWAP_H
    23352147
    23362148/* Whether sys/capability.h is present */
     
    23952207#undef HAVE_SYS_JFSDMAPI_H
    23962208
     2209/* Whether Linux kernel uses core_pattern for core files */
     2210#undef HAVE_SYS_KERNEL_PROC_CORE_PATTERN
     2211
    23972212/* Define to 1 if you have the <sys/mman.h> header file. */
    23982213#undef HAVE_SYS_MMAN_H
     
    24562271#undef HAVE_SYS_STAT_H
    24572272
    2458 /* Define to 1 if you have the <sys/stropts.h> header file. */
    2459 #undef HAVE_SYS_STROPTS_H
    2460 
    24612273/* Define to 1 if you have the <sys/syscall.h> header file. */
    24622274#undef HAVE_SYS_SYSCALL_H
     
    24742286#undef HAVE_SYS_TERMIO_H
    24752287
    2476 /* Define to 1 if you have the <sys/timeb.h> header file. */
    2477 #undef HAVE_SYS_TIMEB_H
    2478 
    2479 /* Define to 1 if you have the <sys/times.h> header file. */
    2480 #undef HAVE_SYS_TIMES_H
    2481 
    24822288/* Define to 1 if you have the <sys/time.h> header file. */
    24832289#undef HAVE_SYS_TIME_H
     
    24952301#undef HAVE_SYS_UN_H
    24962302
    2497 /* Define to 1 if you have the <sys/utsname.h> header file. */
    2498 #undef HAVE_SYS_UTSNAME_H
    2499 
    25002303/* Define to 1 if you have the <sys/vfs.h> header file. */
    25012304#undef HAVE_SYS_VFS_H
     
    25072310#undef HAVE_SYS_XATTR_H
    25082311
     2312/* Whether we have TDB_ERR_NESTING */
     2313#undef HAVE_TDB_ERR_NESTING
     2314
    25092315/* Define to 1 if you have the `telldir64' function. */
    25102316#undef HAVE_TELLDIR64
    25112317
    2512 /* Define to 1 if you have the <termcap.h> header file. */
    2513 #undef HAVE_TERMCAP_H
    2514 
    25152318/* Define to 1 if you have the <termios.h> header file. */
    25162319#undef HAVE_TERMIOS_H
     
    25192322#undef HAVE_TERMIO_H
    25202323
    2521 /* Define to 1 if you have the <term.h> header file. */
    2522 #undef HAVE_TERM_H
    2523 
    25242324/* Define to 1 if you have the `textdomain' function. */
    25252325#undef HAVE_TEXTDOMAIN
     
    25312331#undef HAVE_TIMEGM
    25322332
    2533 /* Define to 1 if you have the <timezone.h> header file. */
    2534 #undef HAVE_TIMEZONE_H
    2535 
    25362333/* Define to 1 if you have the <time.h> header file. */
    25372334#undef HAVE_TIME_H
     
    25432340#undef HAVE_TRUNCATED_SALT
    25442341
    2545 /* Define to 1 if you have the <ttyname.h> header file. */
    2546 #undef HAVE_TTYNAME_H
    2547 
    25482342/* Whether uint16 typedef is included by rpc/rpc.h */
    25492343#undef HAVE_UINT16_FROM_RPC_RPC_H
     
    25552349#undef HAVE_UINTPTR_T
    25562350
    2557 /* Define to 1 if you have the `umask' function. */
    2558 #undef HAVE_UMASK
    2559 
    2560 /* Define to 1 if you have the `uname' function. */
    2561 #undef HAVE_UNAME
    2562 
    25632351/* Define to 1 if you have the <unistd.h> header file. */
    25642352#undef HAVE_UNISTD_H
     
    25882376#undef HAVE_USLEEP
    25892377
    2590 /* Define to 1 if you have the <util.h> header file. */
    2591 #undef HAVE_UTIL_H
    2592 
    25932378/* Whether struct utimbuf is available */
    25942379#undef HAVE_UTIMBUF
     
    26722457#undef HAVE_VA_COPY
    26732458
     2459/* Define to 1 if you have the `vdprintf' function. */
     2460#undef HAVE_VDPRINTF
     2461
    26742462/* Whether the C compiler understands volatile */
    26752463#undef HAVE_VOLATILE
     
    26872475#undef HAVE_WAITPID
    26882476
    2689 /* Define to 1 if you have the `warn' function. */
    2690 #undef HAVE_WARN
    2691 
    2692 /* Define to 1 if you have the `warnx' function. */
    2693 #undef HAVE_WARNX
    2694 
    26952477/* Define to 1 if you have the <windows.h> header file. */
    26962478#undef HAVE_WINDOWS_H
     
    27022484#undef HAVE_WRFILE_KEYTAB
    27032485
    2704 /* Define to 1 if you have the `writev' function. */
    2705 #undef HAVE_WRITEV
    2706 
    27072486/* Define to 1 if you have the <ws2tcpip.h> header file. */
    27082487#undef HAVE_WS2TCPIP_H
    27092488
    2710 /* define if struct winsize has ws_xpixel */
    2711 #undef HAVE_WS_XPIXEL
    2712 
    2713 /* define if struct winsize has ws_ypixel */
    2714 #undef HAVE_WS_YPIXEL
    2715 
    2716 /* Whether we have xattr support */
    2717 #undef HAVE_XATTR_SUPPORT
    2718 
    27192489/* Define to 1 if you have the <xfs/dmapi.h> header file. */
    27202490#undef HAVE_XFS_DMAPI_H
     
    28222592#undef HAVE__READDIR64
    28232593
    2824 /* Define if you have the `_res' variable. */
    2825 #undef HAVE__RES
    2826 
    28272594/* Define to 1 if you have the `_seekdir' function. */
    28282595#undef HAVE__SEEKDIR
     
    29992766#undef LDAP_SET_REBIND_PROC_ARGS
    30002767
    3001 /* ldb Modules directory */
    3002 #undef LDB_MODULESDIR
    3003 
    30042768/* LIBREPLACE_NETWORK_CHECKS were used */
    30052769#undef LIBREPLACE_NETWORK_CHECKS
     
    30852849/* Define as the return type of signal handlers (`int' or `void'). */
    30862850#undef RETSIGTYPE
    3087 
    3088 /* Whether we use in internal heimdal build */
    3089 #undef SAMBA4_INTERNAL_HEIMDAL
    30902851
    30912852/* Whether the host os is sco unix */
     
    32563017
    32573018
    3258 /* Define if signal handlers return void. */
    3259 #undef VOID_RETSIGTYPE
     3019/* Whether we have valgrind headers */
     3020#undef VALGRIND
    32603021
    32613022/* Whether to include Active Directory support */
     
    32733034/* Whether to enable avahi support */
    32743035#undef WITH_AVAHI_SUPPORT
    3275 
    3276 /* Whether to build mount.cifs */
    3277 #undef WITH_CIFSMOUNT
    3278 
    3279 /* Whether to build umount.cifs */
    3280 #undef WITH_CIFSUMOUNT
    3281 
    3282 /* whether to build cifs.upcall */
    3283 #undef WITH_CIFSUPCALL
    32843036
    32853037/* Whether to include DFS support */
     
    33383090
    33393091/* xattr functions have additional options */
    3340 #undef XATTR_ADDITIONAL_OPTIONS
    3341 
    3342 /* xattr functions have additional options */
    33433092#undef XATTR_ADD_OPT
    3344 
    3345 /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
    3346    `char[]'. */
    3347 #undef YYTEXT_POINTER
    33483093
    33493094/* File offset bits */
     
    34603205/* Whether to build idmap_adex as shared module */
    34613206#undef idmap_adex_init
     3207
     3208/* Whether to build idmap_autorid as shared module */
     3209#undef idmap_autorid_init
    34623210
    34633211/* Whether to build idmap_hash as shared module */
     
    35453293#undef pid_t
    35463294
    3547 /* Whether to build rpc_dssetup as shared module */
    3548 #undef rpc_dssetup_init
    3549 
    3550 /* Whether to build rpc_eventlog as shared module */
    3551 #undef rpc_eventlog_init
    3552 
    3553 /* Whether to build rpc_initshutdown as shared module */
    3554 #undef rpc_initshutdown_init
    3555 
    3556 /* Whether to build rpc_lsarpc as shared module */
    3557 #undef rpc_lsarpc_init
    3558 
    3559 /* Whether to build rpc_netdfs as shared module */
    3560 #undef rpc_netdfs_init
    3561 
    3562 /* Whether to build rpc_netlogon as shared module */
    3563 #undef rpc_netlogon_init
    3564 
    3565 /* Whether to build rpc_ntsvcs as shared module */
    3566 #undef rpc_ntsvcs_init
    3567 
    3568 /* Whether to build rpc_rpcecho as shared module */
    3569 #undef rpc_rpcecho_init
    3570 
    3571 /* Whether to build rpc_samr as shared module */
    3572 #undef rpc_samr_init
    3573 
    3574 /* Whether to build rpc_spoolss as shared module */
    3575 #undef rpc_spoolss_init
    3576 
    3577 /* Whether to build rpc_srvsvc as shared module */
    3578 #undef rpc_srvsvc_init
    3579 
    3580 /* Whether to build rpc_svcctl as shared module */
    3581 #undef rpc_svcctl_init
    3582 
    3583 /* Whether to build rpc_winreg as shared module */
    3584 #undef rpc_winreg_init
    3585 
    3586 /* Whether to build rpc_wkssvc as shared module */
    3587 #undef rpc_wkssvc_init
    3588 
    35893295/* Define to `unsigned int' if <sys/types.h> does not define. */
    35903296#undef size_t
     
    36153321
    36163322/* Decl of Static init functions */
    3617 #undef static_decl_rpc
    3618 
    3619 /* Decl of Static init functions */
    36203323#undef static_decl_vfs
    36213324
     
    36423345
    36433346/* Static init functions */
    3644 #undef static_init_rpc
    3645 
    3646 /* Static init functions */
    36473347#undef static_init_vfs
    3648 
    3649 /* Define to `uint8_t' if <sys/types.h> does not define. */
    3650 #undef u_char
    3651 
    3652 /* Define to `uint32_t' if <sys/types.h> does not define. */
    3653 #undef u_int32_t
    36543348
    36553349/* Define to `int' if <sys/types.h> doesn't define. */
     
    36683362#undef uint8_t
    36693363
    3670 /* Define to `unsigned int' if <sys/types.h> does not define. */
    3671 #undef uint_t
    3672 
    36733364/* Whether to build vfs_acl_tdb as shared module */
    36743365#undef vfs_acl_tdb_init
     
    37043395#undef vfs_commit_init
    37053396
     3397/* Whether to build vfs_crossrename as shared module */
     3398#undef vfs_crossrename_init
     3399
    37063400/* Whether to build vfs_default as shared module */
    37073401#undef vfs_default_init
     
    37283422#undef vfs_full_audit_init
    37293423
     3424/* Whether to build vfs_gpfs_hsm_notify as shared module */
     3425#undef vfs_gpfs_hsm_notify_init
     3426
    37303427/* Whether to build vfs_gpfs as shared module */
    37313428#undef vfs_gpfs_init
     
    37373434#undef vfs_irixacl_init
    37383435
     3436/* Whether to build vfs_linux_xfs_sgid as shared module */
     3437#undef vfs_linux_xfs_sgid_init
     3438
    37393439/* Whether to build vfs_netatalk as shared module */
    37403440#undef vfs_netatalk_init
     
    37913491#undef vfs_syncops_init
    37923492
     3493/* Whether to build vfs_time_audit as shared module */
     3494#undef vfs_time_audit_init
     3495
    37933496/* Whether to build vfs_tru64acl as shared module */
    37943497#undef vfs_tru64acl_init
  • trunk/server/source3/include/ctdbd_conn.h

    r429 r745  
    2121#define _CTDBD_CONN_H
    2222
     23#include <tdb.h>
     24
    2325struct ctdbd_connection;
     26struct messaging_context;
     27struct messaging_rec;
    2428
    25 NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
    26                                struct ctdbd_connection **pconn);
    2729NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
    2830                                    struct ctdbd_connection **pconn);
     
    6971NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn);
    7072
    71 NTSTATUS ctdbd_persistent_store(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data);
    72 NTSTATUS ctdbd_start_persistent_update(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data);
    73 NTSTATUS ctdbd_cancel_persistent_update(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data);
    74 
    7573NTSTATUS ctdbd_control_local(struct ctdbd_connection *conn, uint32 opcode,
    7674                             uint64_t srvid, uint32_t flags, TDB_DATA data,
  • trunk/server/source3/include/dbwrap.h

    r414 r745  
    33   Database interface wrapper around tdb
    44   Copyright (C) Volker Lendecke 2005-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/>.
     
    2020#ifndef __DBWRAP_H__
    2121#define __DBWRAP_H__
     22
     23#include <tdb.h>
    2224
    2325struct db_record {
     
    6971                               int open_flags, mode_t mode);
    7072
    71 struct db_context *db_open_tdb2(TALLOC_CTX *mem_ctx,
    72                                 const char *name,
    73                                 int hash_size, int tdb_flags,
    74                                 int open_flags, mode_t mode);
    75 
    7673struct messaging_context;
    7774
     
    10198                               const char *key);
    10299
     100/* The following definitions come from lib/dbwrap_util.c  */
     101
     102int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
     103int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
     104bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
     105                         uint32_t *val);
     106int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
     107NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
     108                                     uint32_t *oldval, uint32_t change_val);
     109NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db,
     110                                           const char *keystr,
     111                                           uint32_t *oldval,
     112                                           uint32_t change_val);
     113NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
     114                                    int32_t *oldval, int32_t change_val);
     115NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db,
     116                                          const char *keystr,
     117                                          int32_t *oldval,
     118                                          int32_t change_val);
     119NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
     120                            int flag);
     121NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
     122NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr,
     123                                  int32_t v);
     124NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr,
     125                                   uint32_t v);
     126NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key,
     127                                     TDB_DATA data, int flags);
     128NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key);
     129NTSTATUS dbwrap_trans_do(struct db_context *db,
     130                         NTSTATUS (*action)(struct db_context *, void *),
     131                         void *private_data);
     132NTSTATUS dbwrap_trans_traverse(struct db_context *db,
     133                               int (*f)(struct db_record*, void*),
     134                               void *private_data);
     135NTSTATUS dbwrap_traverse(struct db_context *db,
     136                         int (*f)(struct db_record*, void*),
     137                         void *private_data);
     138
     139NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key);
     140NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
     141                                     TDB_DATA data, int flags);
     142TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx,
     143                                     const char *key);
     144
    103145#endif /* __DBWRAP_H__ */
  • trunk/server/source3/include/dynconfig.h

    r414 r745  
    33   Copyright (C) 2001 by Martin Pool <mbp@samba.org>
    44   Copyright (C) 2003 by Jim McDonough <jmcd@us.ibm.com>
    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/>.
     
    8080bool is_default_dyn_PIDDIR(void);
    8181
     82const char *get_dyn_NMBDSOCKETDIR(void);
     83const char *set_dyn_NMBDSOCKETDIR(const char *newpath);
     84bool is_default_dyn_NMBDSOCKETDIR(void);
     85
    8286const char *get_dyn_NCALRPCDIR(void);
    8387const char *set_dyn_NCALRPCDIR(const char *newpath);
     
    9195const char *set_dyn_PRIVATE_DIR(const char *newpath);
    9296bool is_default_dyn_PRIVATE_DIR(void);
     97
     98const char *get_dyn_LOCALEDIR(void);
     99const char *set_dyn_LOCALEDIR(const char *newpath);
     100bool is_default_dyn_LOCALEDIR(void);
  • trunk/server/source3/include/event.h

    r414 r745  
    2626
    2727/* The following definitions come from lib/events.c  */
    28 
    29 void event_fd_set_writeable(struct fd_event *fde);
    30 void event_fd_set_not_writeable(struct fd_event *fde);
    31 void event_fd_set_readable(struct fd_event *fde);
    32 void event_fd_set_not_readable(struct fd_event *fde);
    33 bool event_add_to_select_args(struct event_context *event_ctx,
    34                               const struct timeval *now,
    35                               fd_set *read_fds, fd_set *write_fds,
    36                               struct timeval *timeout, int *maxfd);
    37 bool run_events(struct event_context *event_ctx,
    38                 int selrtn, fd_set *read_fds, fd_set *write_fds);
     28struct pollfd;
    3929struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
    4030                                         struct timeval *to_ret);
    41 void event_context_reinit(struct event_context *ev);
    4231void dump_event_list(struct event_context *event_ctx);
    4332struct tevent_context *s3_tevent_context_init(TALLOC_CTX *mem_ctx);
    4433
     34bool event_add_to_poll_args(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
     35                            struct pollfd **pfds, int *num_pfds,
     36                            int *ptimeout);
     37bool run_events_poll(struct tevent_context *ev, int pollrtn,
     38                     struct pollfd *pfds, int num_pfds);
  • trunk/server/source3/include/fake_file.h

    r414 r745  
    3939};
    4040
     41enum FAKE_FILE_TYPE is_fake_file_path(const char *path);
     42enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname);
     43NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
     44                                uint16_t current_vuid,
     45                                enum FAKE_FILE_TYPE fake_file_type,
     46                                const struct smb_filename *smb_fname,
     47                                uint32 access_mask,
     48                                files_struct **result);
     49NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
     50
    4151#endif /* _FAKE_FILE_H */
  • trunk/server/source3/include/g_lock.h

    r454 r745  
    11/*
    22   Unix SMB/CIFS implementation.
    3    global locks based on ctdb
     3   global locks based on dbwrap and messaging
    44   Copyright (C) 2009 by Volker Lendecke
    55
     
    4545
    4646NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
    47                    struct timeval timeout,
     47                   struct timeval timeout, struct server_id self,
    4848                   void (*fn)(void *private_data), void *private_data);
    4949
  • trunk/server/source3/include/idmap.h

    r414 r745  
    88   Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
    99   Copyright (C) Simo Sorce 2003
    10    
     10
    1111   This library is free software; you can redistribute it and/or
    1212   modify it under the terms of the GNU Lesser General Public
    1313   License as published by the Free Software Foundation; either
    1414   version 3 of the License, or (at your option) any later version.
    15    
     15
    1616   This library 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 GNU
    1919   Library General Public License for more details.
    20    
     20
    2121   You should have received a copy of the GNU Lesser General Public License
    2222   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    3131#define SMB_IDMAP_INTERFACE_VERSION 5
    3232
     33#include "librpc/gen_ndr/idmap.h"
     34
    3335struct idmap_domain {
    3436        const char *name;
    3537        struct idmap_methods *methods;
     38        uint32_t low_id;
     39        uint32_t high_id;
     40        bool read_only;
    3641        void *private_data;
    3742};
     
    4146
    4247        /* Called when backend is first loaded */
    43         NTSTATUS (*init)(struct idmap_domain *dom, const char *params);
     48        NTSTATUS (*init)(struct idmap_domain *dom);
    4449
    4550        /* Map an array of uids/gids to SIDs.  The caller specifies
     
    5156        NTSTATUS (*sids_to_unixids)(struct idmap_domain *dom, struct id_map **ids);
    5257
    53         NTSTATUS (*set_mapping)(struct idmap_domain *dom, const struct id_map *map);
    54         NTSTATUS (*remove_mapping)(struct idmap_domain *dom, const struct id_map *map);
    55 
    56         /* Called to dump backends data */
    57         /* NOTE: caller must use talloc_free to free maps when done */
    58         NTSTATUS (*dump_data)(struct idmap_domain *dom, struct id_map **maps, int *num_maps);
    59 
    60         /* Called when backend is unloaded */
    61         NTSTATUS (*close_fn)(struct idmap_domain *dom);
     58        /* Allocate a Unix-ID. */
     59        NTSTATUS (*allocate_id)(struct idmap_domain *dom, struct unixid *id);
    6260};
    6361
    64 struct idmap_alloc_methods {
    65 
    66         /* Called when backend is first loaded */
    67         NTSTATUS (*init)(const char *compat_params);
    68 
    69         NTSTATUS (*allocate_id)(struct unixid *id);
    70         NTSTATUS (*get_id_hwm)(struct unixid *id);
    71         NTSTATUS (*set_id_hwm)(struct unixid *id);
    72 
    73         /* Called when backend is unloaded */
    74         NTSTATUS (*close_fn)(void);
    75 };
     62#include "winbindd/idmap_proto.h"
    7663
    7764#endif /* _IDMAP_H_ */
  • trunk/server/source3/include/includes.h

    r414 r745  
    2323#include "../replace/replace.h"
    2424
     25#if _SAMBA_BUILD_ == 4
     26# undef _SAMBA_BUILD_
     27# define _SAMBA_BUILD_ 3
     28#endif
     29
    2530/* make sure we have included the correct config.h */
    2631#ifndef NO_CONFIG_H /* for some tests */
     
    3540   still have comflicts with their header files (e.g. IRIX 6.4) */
    3641
    37 #if !defined(__cplusplus) && defined(DEVELOPER)
     42#if !defined(__cplusplus) && defined(DEVELOPER) && defined(__linux__)
    3843#define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
    3944#define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
     
    4954#include "local.h"
    5055
    51 #ifdef AIX
    52 #define DEFAULT_PRINTING PRINT_AIX
    53 #define PRINTCAP_NAME "/etc/qconfig"
    54 #endif
    55 
    56 #ifdef HPUX
    57 #define DEFAULT_PRINTING PRINT_HPUX
    58 #endif
    59 
    60 #ifdef QNX
    61 #define DEFAULT_PRINTING PRINT_QNX
    62 #endif
    63 
    6456#ifdef SUNOS4
    6557/* on SUNOS4 termios.h conflicts with sys/ioctl.h */
     
    7769#endif /* RELIANTUNIX */
    7870
    79 #include "system/capability.h"
    8071#include "system/dir.h"
    81 #include "system/filesys.h"
    82 #include "system/glob.h"
    83 #include "system/iconv.h"
    8472#include "system/locale.h"
    85 #include "system/network.h"
    86 #include "system/passwd.h"
    87 #include "system/readline.h"
    88 #include "system/select.h"
    89 #include "system/shmem.h"
    90 #include "system/syslog.h"
    91 #include "system/terminal.h"
    9273#include "system/time.h"
    9374#include "system/wait.h"
     
    146127#endif
    147128
    148 #if HAVE_LBER_H
    149 #include <lber.h>
    150 #if defined(HPUX) && !defined(_LBER_TYPES_H)
    151 /* Define ber_tag_t and ber_int_t for using
    152  * HP LDAP-UX Integration products' LDAP libraries.
    153 */
    154 #ifndef ber_tag_t
    155 typedef unsigned long ber_tag_t;
    156 typedef int ber_int_t;
    157 #endif
    158 #endif /* defined(HPUX) && !defined(_LBER_TYPES_H) */
    159 #ifndef LBER_USE_DER
    160 #define LBER_USE_DER 0x01
    161 #endif
    162 #endif
    163 
    164 #if HAVE_LDAP_H
    165 #include <ldap.h>
    166 #ifndef LDAP_CONST
    167 #define LDAP_CONST const
    168 #endif
    169 #ifndef LDAP_OPT_SUCCESS
    170 #define LDAP_OPT_SUCCESS 0
    171 #endif
    172 /* Solaris 8 and maybe other LDAP implementations spell this "..._INPROGRESS": */
    173 #if defined(LDAP_SASL_BIND_INPROGRESS) && !defined(LDAP_SASL_BIND_IN_PROGRESS)
    174 #define LDAP_SASL_BIND_IN_PROGRESS LDAP_SASL_BIND_INPROGRESS
    175 #endif
    176 /* Solaris 8 defines SSL_LDAP_PORT, not LDAPS_PORT and it only does so if
    177    LDAP_SSL is defined - but SSL is not working. We just want the
    178    port number! Let's just define LDAPS_PORT correct. */
    179 #if !defined(LDAPS_PORT)
    180 #define LDAPS_PORT 636
    181 #endif
    182 #else
     129#ifndef HAVE_LDAP_H
    183130#undef HAVE_LDAP
    184 #endif
    185 
    186 #if HAVE_GSSAPI_GSSAPI_H
    187 #include <gssapi/gssapi.h>
    188 #elif HAVE_GSSAPI_GSSAPI_GENERIC_H
    189 #include <gssapi/gssapi_generic.h>
    190 #elif HAVE_GSSAPI_H
    191 #include <gssapi.h>
    192 #endif
    193 
    194 #if HAVE_COM_ERR_H
    195 #include <com_err.h>
    196131#endif
    197132
     
    237172#if defined(HAVE_AIO_H) && defined(WITH_AIO)
    238173#include <aio.h>
    239 #endif
    240 
    241 #ifdef WITH_MADVISE_PROTECTED
    242 #include <sys/mman.h>
    243174#endif
    244175
     
    252183#endif
    253184
    254 /* If we have --enable-developer and the valgrind header is present,
    255  * then we're OK to use it.  Set a macro so this logic can be done only
    256  * once. */
    257 #if defined(DEVELOPER)
    258 #if (HAVE_VALGRIND_H || HAVE_VALGRIND_VALGRIND_H)
    259 #define VALGRIND
    260 #endif
    261 #endif
    262 
    263 
    264185/* we support ADS if we want it and have krb5 and ldap libs */
    265186#if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP)
     
    384305
    385306#ifdef LARGE_SMB_INO_T
    386 #define SINO_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32))
    387 #define INO_T_VAL(p, ofs) ((SMB_INO_T)(((uint64_t)(IVAL(p,ofs)))| (((uint64_t)(IVAL(p,(ofs)+4))) << 32)))
     307#define SINO_T_VAL(p, ofs, v) SBVAL(p, ofs, v)
     308#define INO_T_VAL(p, ofs) ((SMB_INO_T)BVAL(p, ofs))
    388309#else
    389 #define SINO_T_VAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
     310#define SINO_T_VAL(p, ofs, v) SBVAL(p, ofs, ((uint64_t)(v)) & UINT32_MAX)
    390311#define INO_T_VAL(p, ofs) ((SMB_INO_T)(IVAL((p),(ofs))))
    391312#endif
     
    399320#endif
    400321
    401 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
    402 #define BIG_UINT(p, ofs) ((((uint64_t) IVAL(p,(ofs)+4))<<32)|IVAL(p,ofs))
    403 #define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF)) | \
    404                 (( ((uint64_t)(IVAL((buf),(off+4)))) & ((uint64_t)0xFFFFFFFF) ) << 32 ) )
    405 
     322/* TODO: remove this macros */
     323#define SBIG_UINT(p, ofs, v) SBVAL(p, ofs, v)
     324#define BIG_UINT(p, ofs) BVAL(p, ofs)
     325#define IVAL2_TO_SMB_BIG_UINT(p, ofs) BVAL(p, ofs)
    406326
    407327/* this should really be a 64 bit type if possible */
     
    553473#endif
    554474
    555 #ifndef HAVE_STRUCT_TIMESPEC
    556 struct timespec {
    557         time_t tv_sec;            /* Seconds.  */
    558         long tv_nsec;           /* Nanoseconds.  */
    559 };
    560 #endif
    561 
    562475enum timestamp_set_resolution {
    563476        TIMESTAMP_SET_SECONDS = 0,
     
    565478        TIMESTAMP_SET_NT_OR_BETTER
    566479};
    567 
    568 #ifdef HAVE_BROKEN_GETGROUPS
    569 #define GID_T int
    570 #else
    571 #define GID_T gid_t
    572 #endif
    573 
    574 #ifndef NGROUPS_MAX
    575 #define NGROUPS_MAX 32 /* Guess... */
    576 #endif
    577480
    578481/* Our own fstrings */
     
    600503#endif
    601504
    602 /* Samba 3 doesn't use iconv_convenience: */
    603 extern void *cmdline_lp_ctx;
    604 struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
    605 
    606505/* Lists, trees, caching, database... */
    607506#include "../lib/util/util.h"
     
    610509#include "../lib/util/memory.h"
    611510#include "../lib/util/attr.h"
    612 #include "intl.h"
     511#include "../lib/util/tsort.h"
    613512#include "../lib/util/dlinklist.h"
    614 #include "tdb.h"
    615 #include "util_tdb.h"
    616 
    617 #include "talloc.h"
     513
     514#include <talloc.h>
    618515
    619516#include "event.h"
    620 #include "../lib/util/tevent_unix.h"
    621 #include "../lib/util/tevent_ntstatus.h"
    622 #include "../lib/tsocket/tsocket.h"
    623517
    624518#include "../lib/util/data_blob.h"
    625519#include "../lib/util/time.h"
    626 #include "../lib/util/asn1.h"
    627 
    628 #include "ads.h"
    629 #include "ads_dns.h"
    630 #include "interfaces.h"
    631 #include "trans2.h"
     520#include "../lib/util/debug.h"
     521#include "../lib/util/debug_s3.h"
     522
     523#include "../libcli/util/ntstatus.h"
    632524#include "../libcli/util/error.h"
    633 #include "ntioctl.h"
    634525#include "../lib/util/charset/charset.h"
    635526#include "dynconfig.h"
    636 #include "util_getent.h"
    637 #include "debugparse.h"
    638 #include "privileges.h"
    639 #include "messages.h"
    640527#include "locking.h"
    641528#include "smb_perfcount.h"
    642 #include "smb_signing.h"
    643529#include "smb.h"
    644 #include "nameserv.h"
    645 #include "secrets.h"
    646530#include "../lib/util/byteorder.h"
    647 #include "privileges.h"
    648 #include "rpc_misc.h"
    649 #include "rpc_dce.h"
    650 #include "../librpc/gen_ndr/schannel.h"
    651 #include "mapping.h"
    652 #include "passdb.h"
    653 #include "rpc_secdes.h"
    654 #include "../libgpo/gpo.h"
    655 #include "msdfs.h"
    656 #include "rap.h"
    657 #include "../lib/crypto/md5.h"
    658 #include "../lib/crypto/md4.h"
    659 #include "../lib/crypto/arcfour.h"
    660 #include "../lib/crypto/crc32.h"
    661 #include "../lib/crypto/hmacmd5.h"
    662 #include "ntlmssp.h"
    663 #include "auth.h"
    664 #include "ntdomain.h"
    665 #include "reg_objects.h"
    666 #include "reg_db.h"
    667 #include "librpc/gen_ndr/perfcount.h"
    668 #include "librpc/gen_ndr/notify.h"
    669 #include "librpc/gen_ndr/xattr.h"
    670 #include "librpc/gen_ndr/messaging.h"
    671 #include "librpc/gen_ndr/ndr_nbt.h"
    672 #include "librpc/rpc/dcerpc.h"
    673 #include "nt_printing.h"
    674 #include "idmap.h"
    675 #include "client.h"
    676 
    677 #include "session.h"
    678 #include "popt.h"
    679 #include "mangle.h"
     531
    680532#include "module.h"
    681 #include "nsswitch/winbind_client.h"
    682 #include "dbwrap.h"
    683 #include "packet.h"
    684 #include "ctdbd_conn.h"
    685533#include "../lib/util/talloc_stack.h"
    686 #include "memcache.h"
    687 #include "async_smb.h"
    688 #include "../lib/async_req/async_sock.h"
    689 #include "talloc_dict.h"
    690 #include "services.h"
    691 #include "eventlog.h"
    692534#include "../lib/util/smb_threads.h"
    693535#include "../lib/util/smb_threads_internal.h"
    694 #include "tldap.h"
    695 #include "tldap_util.h"
    696 
    697 #include "lib/smbconf/smbconf.h"
    698 #include "lib/smbconf/smbconf_init.h"
    699 #include "lib/smbconf/smbconf_reg.h"
    700 #include "lib/smbconf/smbconf_txt.h"
    701 
    702 /* Defines for wisXXX functions. */
    703 #define UNI_UPPER    0x1
    704 #define UNI_LOWER    0x2
    705 #define UNI_DIGIT    0x4
    706 #define UNI_XDIGIT   0x8
    707 #define UNI_SPACE    0x10
    708 
    709 #include "nsswitch/winbind_nss.h"
    710 
    711 /* forward declaration from printing.h to get around
    712    header file dependencies */
    713 
    714 struct printjob;
    715 
    716 /* forward declarations from smbldap.c */
    717 
    718 #include "smbldap.h"
    719 
    720 /*
    721  * Reasons for cache flush.
    722  */
    723 
    724 enum flush_reason_enum {
    725     SEEK_FLUSH,
    726     READ_FLUSH,
    727     WRITE_FLUSH,
    728     READRAW_FLUSH,
    729     OPLOCK_RELEASE_FLUSH,
    730     CLOSE_FLUSH,
    731     SYNC_FLUSH,
    732     SIZECHANGE_FLUSH,
    733     /* NUM_FLUSH_REASONS must remain the last value in the enumeration. */
    734     NUM_FLUSH_REASONS};
    735 
    736 #include "nss_info.h"
    737 #include "modules/nfs4_acls.h"
    738 #include "nsswitch/libwbclient/wbclient.h"
    739536
    740537/***** prototypes *****/
     
    742539#include "proto.h"
    743540#endif
    744 #include "libcli/security/secace.h"
    745 #include "libcli/security/secacl.h"
    746 #include "libcli/security/security_descriptor.h"
    747 
    748 #if defined(HAVE_POSIX_ACLS)
    749 #include "modules/vfs_posixacl.h"
    750 #endif
    751 
    752 #if defined(HAVE_TRU64_ACLS)
    753 #include "modules/vfs_tru64acl.h"
    754 #endif
    755 
    756 #if defined(HAVE_SOLARIS_ACLS) || defined(HAVE_UNIXWARE_ACLS)
    757 #include "modules/vfs_solarisacl.h"
    758 #endif
    759 
    760 #if defined(HAVE_HPUX_ACLS)
    761 #include "modules/vfs_hpuxacl.h"
    762 #endif
    763 
    764 #if defined(HAVE_IRIX_ACLS)
    765 #include "modules/vfs_irixacl.h"
    766 #endif
    767 
    768 #ifdef HAVE_LDAP
    769 #include "ads_protos.h"
    770 #endif
    771 
    772 /* We need this after proto.h to reference GetTimeOfDay(). */
    773 #include "smbprofile.h"
    774541
    775542/* String routines */
     
    778545#include "safe_string.h"
    779546
    780 /* prototypes from lib/util_transfer_file.c */
    781 #include "transfer_file.h"
    782 
    783 #ifndef DEFAULT_PRINTING
    784 #ifdef HAVE_CUPS
    785 #define DEFAULT_PRINTING PRINT_CUPS
    786 #define PRINTCAP_NAME "cups"
    787 #elif defined(SYSV)
    788 #define DEFAULT_PRINTING PRINT_SYSV
    789 #define PRINTCAP_NAME "lpstat"
    790 #else
    791 #define DEFAULT_PRINTING PRINT_BSD
    792 #define PRINTCAP_NAME "/etc/printcap"
    793 #endif
    794 #endif
    795 
    796 #ifndef PRINTCAP_NAME
    797 #define PRINTCAP_NAME "/etc/printcap"
    798 #endif
    799 
    800547#ifndef SIGCLD
    801548#define SIGCLD SIGCHLD
     
    806553#endif
    807554
    808 #ifndef MAP_FILE
    809 #define MAP_FILE 0
    810 #endif
    811 
    812555#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
    813556#define OSF1_ENH_SEC 1
    814 #endif
    815 
    816 #ifndef ALLOW_CHANGE_PASSWORD
    817 #if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
    818 #define ALLOW_CHANGE_PASSWORD 1
    819 #endif
    820 #endif
    821 
    822 /* what is the longest significant password available on your system?
    823  Knowing this speeds up password searches a lot */
    824 #ifndef PASSWORD_LENGTH
    825 #define PASSWORD_LENGTH 8
    826 #endif
    827 
    828 #ifndef HAVE_PIPE
    829 #define SYNC_DNS 1
    830557#endif
    831558
     
    851578#endif
    852579
    853 
    854 #if HAVE_KERNEL_SHARE_MODES
    855 #ifndef LOCK_MAND
    856 #define LOCK_MAND       32      /* This is a mandatory flock */
    857 #define LOCK_READ       64      /* ... Which allows concurrent read operations */
    858 #define LOCK_WRITE      128     /* ... Which allows concurrent write operations */
    859 #define LOCK_RW         192     /* ... Which allows concurrent read & write ops */
    860 #endif
    861 #endif
    862 
    863 extern int DEBUGLEVEL;
    864580
    865581#define MAX_SEC_CTX_DEPTH 8    /* Maximum number of security contexts */
     
    879595
    880596
    881 /* needed for some systems without iconv. Doesn't really matter
    882    what error code we use */
    883 #ifndef EILSEQ
    884 #define EILSEQ EIO
    885 #endif
    886 
    887597/* add varargs prototypes with printf checking */
    888598/*PRINTFLIKE2 */
     
    922632#endif
    923633
    924 #ifdef HAVE_LDAP
    925 
    926 /* function declarations not included in proto.h */
    927 LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to);
    928 
    929 #endif  /* HAVE_LDAP */
    930 
    931 #if defined(HAVE_LINUX_READAHEAD) && ! defined(HAVE_READAHEAD_DECL)
    932 ssize_t readahead(int fd, off64_t offset, size_t count);
    933 #endif
    934 
    935634#ifdef TRUE
    936635#undef TRUE
     
    960659void exit_server_fault(void) _NORETURN_;
    961660
    962 #ifdef HAVE_LIBNSCD
    963 #include "libnscd.h"
    964 #endif
    965 
    966 #if defined(HAVE_IPV6)
    967 void in6_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
    968                                   struct in6_addr ip);
    969 #endif
    970 
    971661/* samba3 doesn't use uwrap yet */
    972662#define uwrap_enabled() 0
    973663
     664#define BASE_RID (0x000003E8L)
     665
    974666#endif /* _INCLUDES_H */
  • trunk/server/source3/include/krb5_protos.h

    r414 r745  
     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 _INCLUDE_KRB5_PROTOS_H_
     24#define _INCLUDE_KRB5_PROTOS_H_
     25
     26struct PAC_DATA;
     27struct PAC_SIGNATURE_DATA;
     28
    129/* work around broken krb5.h on sles9 */
    230#ifdef SIZEOF_LONG
     
    3765#endif
    3866
     67/* The following definitions come from libsmb/clikrb5.c  */
     68
    3969/* Samba wrapper function for krb5 functionality. */
    4070bool setup_kaddr( krb5_address *pkaddr, struct sockaddr_storage *paddr);
     
    4777#endif
    4878krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes);
    49 bool get_krb5_smb_session_key(krb5_context context, krb5_auth_context auth_context, DATA_BLOB *session_key, bool remote);
     79bool get_krb5_smb_session_key(TALLOC_CTX *mem_ctx,
     80                              krb5_context context,
     81                              krb5_auth_context auth_context,
     82                              DATA_BLOB *session_key, bool remote);
    5083krb5_error_code smb_krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *kt_entry);
    5184krb5_principal kerberos_fetch_salt_princ_for_host_princ(krb5_context context, krb5_principal host_princ, int enctype);
     
    69102                                         size_t length);
    70103time_t get_authtime_from_tkt(krb5_ticket *tkt);
    71 void smb_krb5_free_ap_req(krb5_context context,
    72                           krb5_ap_req *ap_req);
    73104krb5_error_code smb_krb5_get_keyinfo_from_ap_req(krb5_context context,
    74105                                                 const krb5_data *inbuf,
     
    89120                                          krb5_const_principal princ1,
    90121                                          krb5_const_principal princ2);
    91 int cli_krb5_get_ticket(const char *principal, time_t time_offset,
    92                         DATA_BLOB *ticket, DATA_BLOB *session_key_krb5,
    93                         uint32 extra_ap_opts, const char *ccname,
    94                         time_t *tgs_expire,
    95                         const char *impersonate_princ_s);
    96122krb5_error_code smb_krb5_renew_ticket(const char *ccache_string, const char *client_string, const char *service_string, time_t *expire_time);
    97123krb5_error_code kpasswd_err_to_krb5_err(krb5_error_code res_code);
     
    124150                                     krb5_keytab keytab,
    125151                                     const char **keytab_name);
    126 int smb_krb5_kt_add_entry_ext(krb5_context context,
    127                               krb5_keytab keytab,
    128                               krb5_kvno kvno,
    129                               const char *princ_s,
    130                               krb5_enctype *enctypes,
    131                               krb5_data password,
    132                               bool no_salt,
    133                               bool keep_old_entries);
    134152krb5_error_code smb_krb5_get_credentials(krb5_context context,
    135153                                         krb5_ccache ccache,
     
    145163char *smb_krb5_principal_get_realm(krb5_context context,
    146164                                   krb5_principal principal);
     165
     166
    147167#endif /* HAVE_KRB5 */
    148168
     169int cli_krb5_get_ticket(TALLOC_CTX *mem_ctx,
     170                        const char *principal, time_t time_offset,
     171                        DATA_BLOB *ticket, DATA_BLOB *session_key_krb5,
     172                        uint32_t extra_ap_opts, const char *ccname,
     173                        time_t *tgs_expire,
     174                        const char *impersonate_princ_s);
     175
     176bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
     177                           DATA_BLOB *edata,
     178                           DATA_BLOB *edata_out);
     179bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
     180
     181#endif /* _INCLUDE_KRB5_PROTOS_H_ */
  • trunk/server/source3/include/libsmb_internal.h

    r414 r745  
    3030
    3131#include "../include/libsmbclient.h"
     32#include "libsmb/clirap.h"
    3233
    3334#define SMBC_MAX_NAME  1023
     
    137138         */
    138139        SMBCFILE *                              files;
    139 
    140         /*
    141          * Log to standard error instead of the more typical standard output
    142          */
    143         bool                                    debug_stderr;
    144140
    145141        /*
  • trunk/server/source3/include/libsmbclient.h

    r480 r745  
    12641264 * @param fd        Open file handle from smbc_open() or smbc_creat()
    12651265 *
    1266  * @param buf       Pointer to buffer to recieve read data
     1266 * @param buf       Pointer to buffer to receive read data
    12671267 *
    12681268 * @param bufsize   Size of buf in bytes
  • trunk/server/source3/include/local.h

    r599 r745  
    99#ifndef WORKGROUP
    1010#define WORKGROUP "WORKGROUP"
    11 #endif
    12 
    13 /* the maximum debug level to compile into the code. This assumes a good
    14    optimising compiler that can remove unused code
    15    for embedded or low-memory systems set this to a value like 2 to get
    16    only important messages. This gives *much* smaller binaries
    17 */
    18 #ifndef MAX_DEBUG_LEVEL
    19 #define MAX_DEBUG_LEVEL 1000
    2011#endif
    2112
     
    5142/* maximum number of file caches per smbd */
    5243#define MAX_WRITE_CACHES 10
    53 
    54 /* define what facility to use for syslog */
    55 #ifndef SYSLOG_FACILITY
    56 #define SYSLOG_FACILITY LOG_DAEMON
    57 #endif
    5844
    5945/*
     
    241227#define WINBIND_SERVER_MUTEX_WAIT_TIME (( ((NUM_CLI_AUTH_CONNECT_RETRIES) * ((CLI_AUTH_TIMEOUT)/1000)) + 5)*2)
    242228
    243 /* Max number of simultaneous winbindd socket connections. */
    244 #define WINBINDD_MAX_SIMULTANEOUS_CLIENTS 200
    245 
    246229/* Buffer size to use when printing backtraces */
    247230#define BACKTRACE_STACK_SIZE 64
     
    276259#define MAX_RPC_DATA_SIZE (15*1024*1024)
    277260
    278 #endif
     261#define CLIENT_NDR_PADDING_SIZE 8
     262#define SERVER_NDR_PADDING_SIZE 8
     263
     264#define DEFAULT_SMB2_MAX_READ (1024*1024)
     265#define DEFAULT_SMB2_MAX_WRITE (1024*1024)
     266#define DEFAULT_SMB2_MAX_TRANSACT (1024*1024)
     267#define DEFAULT_SMB2_MAX_CREDITS 8192
     268#define DEFAULT_SMB2_MAX_CREDIT_BITMAP_FACTOR 2
     269
     270#endif
  • trunk/server/source3/include/locking.h

    r414 r745  
    3232#define IS_PENDING_LOCK(type) ((type) == PENDING_READ_LOCK || (type) == PENDING_WRITE_LOCK)
    3333
     34#include "librpc/gen_ndr/server_id.h"
     35
    3436/* This contains elements that differentiate locks. The smbpid is a
    3537   client supplied pid, and is essentially the locking context for
     
    3739
    3840struct lock_context {
    39         uint32 smbpid;
     41        uint64_t smblctx;
    4042        uint16 tid;
    4143        struct server_id pid;
     
    4446struct files_struct;
    4547
    46 struct file_id {
    47         /* we don't use SMB_DEV_T and SMB_INO_T as we want a fixed size here,
    48            and we may be using file system specific code to fill in something
    49            other than a dev_t for the device */
    50         uint64_t devid;
    51         uint64_t inode;
    52         uint64_t extid; /* Support systems that use an extended id (e.g. snapshots). */
    53 };
     48#include "../librpc/gen_ndr/file_id.h"
    5449
    5550struct byte_range_lock {
     
    8984        uint64_t offset;
    9085        uint64_t count;
    91         uint32_t lock_pid;
    92         uint32_t blocking_pid; /* PID that blocks us. */
     86        uint64_t smblctx;
     87        uint64_t blocking_smblctx; /* Context that blocks us. */
    9388        enum brl_flavour lock_flav;
    9489        enum brl_type lock_type;
     
    9792};
    9893
     94struct smbd_lock_element {
     95        uint64_t smblctx;
     96        enum brl_type brltype;
     97        uint64_t offset;
     98        uint64_t count;
     99};
     100
    99101#endif /* _LOCKING_H_ */
  • trunk/server/source3/include/mangle.h

    r414 r745  
     1/*
     2   Unix SMB/CIFS implementation.
     3   Name mangling interface
     4   Copyright (C) Andrew Tridgell 2002
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 3 of the License, or
     9   (at your option) any later version.
     10
     11   This program is distributed in the hope that it will be useful,
     12   but WITHOUT ANY WARRANTY; without even the implied warranty of
     13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14   GNU General Public License for more details.
     15
     16   You should have received a copy of the GNU General Public License
     17   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     18*/
     19
    120#ifndef _MANGLE_H_
    221#define _MANGLE_H_
  • trunk/server/source3/include/mapping.h

    r414 r745  
    2525        struct pdb_methods *methods;
    2626        gid_t gid;
    27         DOM_SID sid;
     27        struct dom_sid sid;
    2828        enum lsa_SidType sid_name_use;
    2929        fstring nt_name;
     
    3131} GROUP_MAP;
    3232
     33#include "groupdb/proto.h"
  • trunk/server/source3/include/messages.h

    r414 r745  
    6767#define MSG_SRVID_SAMBA 0x0000000100000000LL
    6868
    69 
    70 struct server_id {
    71         pid_t pid;
    72 #ifdef CLUSTER_SUPPORT
    73         uint32 vnn;
    74 #endif
    75 };
     69#include "librpc/gen_ndr/server_id.h"
    7670
    7771#ifdef CLUSTER_SUPPORT
     
    111105                            struct messaging_backend **presult);
    112106
     107bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx);
     108
    113109NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
    114110                              TALLOC_CTX *mem_ctx,
     
    125121                                         struct event_context *ev);
    126122
     123struct server_id messaging_server_id(const struct messaging_context *msg_ctx);
     124
    127125/*
    128126 * re-init after a fork
    129127 */
    130 NTSTATUS messaging_reinit(struct messaging_context *msg_ctx);
     128NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
     129                          struct server_id id);
    131130
    132131NTSTATUS messaging_register(struct messaging_context *msg_ctx,
     
    149148                            struct messaging_rec *rec);
    150149
     150#include "librpc/gen_ndr/ndr_messaging.h"
     151
    151152#endif
  • trunk/server/source3/include/module.h

    r414 r745  
    2626NTSTATUS init_samba_module(void);
    2727
    28 typedef int smb_event_id_t;
    29 #define SMB_EVENT_ID_INVALID    (-1)
    30 
    31 #define SMB_IDLE_EVENT_DEFAULT_INTERVAL 180
    32 #define SMB_IDLE_EVENT_MIN_INTERVAL     30
    33 
    34 typedef void (smb_idle_event_fn)(void **data,time_t *interval,time_t now);
    35 
    3628#endif /* _MODULE_H */
  • trunk/server/source3/include/msdfs.h

    r414 r745  
    3838#define MAX_MSDFS_JUNCTIONS 256
    3939
    40 typedef struct _client_referral {
     40struct client_dfs_referral {
    4141        uint32 proximity;
    4242        uint32 ttl;
    4343        char *dfspath;
    44 } CLIENT_DFS_REFERRAL;
     44};
    4545
    4646struct referral {
  • trunk/server/source3/include/nss_info.h

    r414 r745  
    6363        NTSTATUS (*init)( struct nss_domain_entry *e );
    6464        NTSTATUS (*get_nss_info)( struct nss_domain_entry *e,
    65                                   const DOM_SID *sid,
     65                                  const struct dom_sid *sid,
    6666                                  TALLOC_CTX *ctx,
    67                                   ADS_STRUCT *ads, LDAPMessage *msg,
    6867                                  const char **homedir, const char **shell,
    6968                                  const char **gecos, gid_t *p_gid);
     
    8483                                struct nss_info_methods *methods);
    8584
    86 NTSTATUS nss_init( const char **nss_list );
    87 
    88 NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid,
     85NTSTATUS nss_get_info( const char *domain, const struct dom_sid *user_sid,
    8986                       TALLOC_CTX *ctx,
    90                        ADS_STRUCT *ads, LDAPMessage *msg,
    9187                       const char **homedir, const char **shell,
    9288                       const char **gecos, gid_t *p_gid);
     
    10096NTSTATUS nss_close( const char *parameters );
    10197
     98/* The following definitions come from winbindd/nss_info.c  */
     99
     100
     101/* The following definitions come from winbindd/nss_info_template.c  */
     102
     103NTSTATUS nss_info_template_init( void );
     104
    102105#endif /* _IDMAP_NSS_H_ */
    103106
  • trunk/server/source3/include/nt_printing.h

    r414 r745  
    2323#define NT_PRINTING_H_
    2424
    25 /* container for a single registry key */
    26 
    27 typedef struct {
    28         char                    *name;
    29         struct regval_ctr       *values;
    30 } NT_PRINTER_KEY;
    31 
    32 /* container for all printer data */
    33 
    34 typedef struct {
    35         int             num_keys;
    36         NT_PRINTER_KEY  *keys;
    37 } NT_PRINTER_DATA;
    38 
    39 typedef struct ntdevicemode
    40 {
    41         fstring devicename;
    42         fstring formname;
    43 
    44         uint16  specversion;
    45         uint16  driverversion;
    46         uint16  size;
    47         uint16  driverextra;
    48         uint16  orientation;
    49         uint16  papersize;
    50         uint16  paperlength;
    51         uint16  paperwidth;
    52         uint16  scale;
    53         uint16  copies;
    54         uint16  defaultsource;
    55         uint16  printquality;
    56         uint16  color;
    57         uint16  duplex;
    58         uint16  yresolution;
    59         uint16  ttoption;
    60         uint16  collate;
    61         uint16  logpixels;
    62 
    63         uint32  fields;
    64         uint32  bitsperpel;
    65         uint32  pelswidth;
    66         uint32  pelsheight;
    67         uint32  displayflags;
    68         uint32  displayfrequency;
    69         uint32  icmmethod;
    70         uint32  icmintent;
    71         uint32  mediatype;
    72         uint32  dithertype;
    73         uint32  reserved1;
    74         uint32  reserved2;
    75         uint32  panningwidth;
    76         uint32  panningheight;
    77         uint8   *nt_dev_private;
    78 } NT_DEVICEMODE;
    79 
    80 typedef struct nt_printer_info_level_2
    81 {
    82         uint32 attributes;
    83         uint32 priority;
    84         uint32 default_priority;
    85         uint32 starttime;
    86         uint32 untiltime;
    87         uint32 status;
    88         uint32 cjobs;
    89         uint32 averageppm;
    90         fstring servername;
    91         fstring printername;
    92         fstring sharename;
    93         fstring portname;
    94         fstring drivername;
    95         char comment[1024];
    96         fstring location;
    97         NT_DEVICEMODE *devmode;
    98         fstring sepfile;
    99         fstring printprocessor;
    100         fstring datatype;
    101         fstring parameters;
    102         NT_PRINTER_DATA *data;
    103         SEC_DESC_BUF *secdesc_buf;
    104         uint32 changeid;
    105         uint32 c_setprinter;
    106         uint32 setuptime;       
    107 } NT_PRINTER_INFO_LEVEL_2;
    108 
    109 typedef struct nt_printer_info_level
    110 {
    111         NT_PRINTER_INFO_LEVEL_2 *info_2;
    112 } NT_PRINTER_INFO_LEVEL;
    113 
    114 typedef struct
    115 {
    116         fstring name;
    117         uint32 flag;
    118         uint32 width;
    119         uint32 length;
    120         uint32 left;
    121         uint32 top;
    122         uint32 right;
    123         uint32 bottom;
    124 } nt_forms_struct;
     25#include "client.h"
     26#include "../librpc/gen_ndr/spoolss.h"
    12527
    12628#ifndef SAMBA_PRINTER_PORT_NAME
     
    201103#define SPLHND_PORTMON_LOCAL    4
    202104
    203 /* structure to store the printer handles */
    204 /* and a reference to what it's pointing to */
    205 /* and the notify info asked about */
    206 /* that's the central struct */
    207 typedef struct _Printer{
    208         struct _Printer *prev, *next;
    209         bool document_started;
    210         bool page_started;
    211         uint32 jobid; /* jobid in printing backend */
    212         int printer_type;
    213         fstring servername;
    214         fstring sharename;
    215         uint32 type;
    216         uint32 access_granted;
    217         struct {
    218                 uint32 flags;
    219                 uint32 options;
    220                 fstring localmachine;
    221                 uint32 printerlocal;
    222                 struct spoolss_NotifyOption *option;
    223                 struct policy_handle client_hnd;
    224                 bool client_connected;
    225                 uint32 change;
    226                 /* are we in a FindNextPrinterChangeNotify() call? */
    227                 bool fnpcn;
    228         } notify;
    229         struct {
    230                 fstring machine;
    231                 fstring user;
    232         } client;
    233        
    234         /* devmode sent in the OpenPrinter() call */
    235         NT_DEVICEMODE   *nt_devmode;
    236        
    237         /* cache the printer info */
    238         NT_PRINTER_INFO_LEVEL *printer_info;
    239        
    240 } Printer_entry;
    241 
    242105/*
    243106 * The printer attributes.
     
    262125};
    263126
     127bool nt_printing_init(struct messaging_context *msg_ctx);
     128
     129const char *get_short_archi(const char *long_archi);
     130
     131bool print_access_check(const struct auth_serversupplied_info *server_info,
     132                        struct messaging_context *msg_ctx, int snum,
     133                        int access_type);
     134
     135WERROR nt_printer_publish(TALLOC_CTX *mem_ctx,
     136                          const struct auth_serversupplied_info *server_info,
     137                          struct messaging_context *msg_ctx,
     138                          struct spoolss_PrinterInfo2 *pinfo2,
     139                          int action);
     140
     141bool is_printer_published(TALLOC_CTX *mem_ctx,
     142                          const struct auth_serversupplied_info *server_info,
     143                          struct messaging_context *msg_ctx,
     144                          const char *servername, char *printer, struct GUID *guid,
     145                          struct spoolss_PrinterInfo2 **info2);
     146
     147WERROR check_published_printers(struct messaging_context *msg_ctx);
     148
     149bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
     150                           const struct auth_serversupplied_info *server_info,
     151                           struct messaging_context *msg_ctx,
     152                           const struct spoolss_DriverInfo8 *r);
     153bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
     154                                 const struct auth_serversupplied_info *server_info,
     155                                 struct messaging_context *msg_ctx,
     156                                 struct spoolss_DriverInfo8 *r);
     157bool delete_driver_files(const struct auth_serversupplied_info *server_info,
     158                         const struct spoolss_DriverInfo8 *r);
     159
     160WERROR move_driver_to_download_area(struct auth_serversupplied_info *session_info,
     161                                    struct spoolss_AddDriverInfoCtr *r);
     162
     163WERROR clean_up_driver_struct(TALLOC_CTX *mem_ctx,
     164                              struct auth_serversupplied_info *session_info,
     165                              struct spoolss_AddDriverInfoCtr *r);
     166
     167void map_printer_permissions(struct security_descriptor *sd);
     168
     169void map_job_permissions(struct security_descriptor *sd);
     170
     171bool print_time_access_check(const struct auth_serversupplied_info *server_info,
     172                             struct messaging_context *msg_ctx,
     173                             const char *servicename);
     174
     175void nt_printer_remove(TALLOC_CTX *mem_ctx,
     176                        const struct auth_serversupplied_info *server_info,
     177                        struct messaging_context *msg_ctx,
     178                        const char *printer);
     179
    264180#endif /* NT_PRINTING_H_ */
  • trunk/server/source3/include/ntdomain.h

    r414 r745  
    2424#define _NT_DOMAIN_H
    2525
     26#include "librpc/rpc/dcerpc.h"
     27
    2628/*
    2729 * A bunch of stuff that was put into smb.h
     
    2931 */
    3032
    31 #define prs_init_empty( _ps_, _ctx_, _io_ ) (void) prs_init((_ps_), 0, (_ctx_), (_io_))
    32 
    33 typedef struct _prs_struct {
    34         bool io; /* parsing in or out of data stream */
    35         /*
    36          * If the (incoming) data is big-endian. On output we are
    37          * always little-endian.
    38          */
    39         bool bigendian_data;
    40         uint8 align; /* data alignment */
    41         bool is_dynamic; /* Do we own this memory or not ? */
    42         uint32 data_offset; /* Current working offset into data. */
    43         uint32 buffer_size; /* Current allocated size of the buffer. */
    44         uint32 grow_size; /* size requested via prs_grow() calls */
    45         char *data_p; /* The buffer itself. */
    46         TALLOC_CTX *mem_ctx; /* When unmarshalling, use this.... */
    47         const char *sess_key; /* If we have to do encrypt/decrypt on the fly. */
    48 } prs_struct;
    49 
    50 /*
    51  * Defines for io member of prs_struct.
    52  */
    53 
    54 #define MARSHALL 0
    55 #define UNMARSHALL 1
    56 
    57 #define MARSHALLING(ps) (!(ps)->io)
    58 #define UNMARSHALLING(ps) ((ps)->io)
    59 
    60 #define RPC_BIG_ENDIAN          1
    61 #define RPC_LITTLE_ENDIAN       0
    62 
    63 #define RPC_PARSE_ALIGN 4
    64 
    6533typedef struct _output_data {
    6634        /*
    6735         * Raw RPC output data. This does not include RPC headers or footers.
    6836         */
    69         prs_struct rdata;
     37        DATA_BLOB rdata;
    7038
    7139        /* The amount of data sent from the current rdata struct. */
     
    7644         * headers, data and authentication footer.
    7745         */
    78         prs_struct frag;
     46        DATA_BLOB frag;
    7947
    8048        /* The amount of data sent from the current PDU. */
     
    8856         * pdu is seen, then the data is copied into the in_data
    8957         * structure. The maximum size of this is 0x1630 (RPC_MAX_PDU_FRAG_LEN).
    90          */
    91         uint8_t *current_in_pdu;
     58         * If length is zero, then we are at the start of a new
     59         * pdu.
     60         */
     61        DATA_BLOB pdu;
    9262
    9363        /*
     
    9969
    10070        /*
    101          * The amount of data received so far in the in_pdu.
    102          * If this is zero, then we are at the start of a new
    103          * pdu.
    104          */
    105         uint32 pdu_received_len;
    106 
    107         /*
    10871         * This is the collection of input data with all
    10972         * the rpc headers and auth footers removed.
    11073         * The maximum length of this (1Mb) is strictly enforced.
    11174         */
    112         prs_struct data;
     75        DATA_BLOB data;
     76
    11377} input_data;
    11478
     
    13296 */
    13397
    134 enum pipe_auth_type { PIPE_AUTH_TYPE_NONE = 0, PIPE_AUTH_TYPE_NTLMSSP, PIPE_AUTH_TYPE_SCHANNEL,
    135                         PIPE_AUTH_TYPE_SPNEGO_NTLMSSP, PIPE_AUTH_TYPE_KRB5, PIPE_AUTH_TYPE_SPNEGO_KRB5 };
    136 
    137 /* auth state for krb5. */
    138 struct kerberos_auth_struct {
    139         const char *service_principal;
    140         DATA_BLOB session_key;
    141 };
    142 
    143 /* auth state for schannel. */
    144 struct schannel_auth_struct {
    145         unsigned char sess_key[16];
    146         uint32 seq_num;
    147 };
    148 
    149 /* auth state for all bind types. */
    150 
    151 struct pipe_auth_data {
    152         enum pipe_auth_type auth_type; /* switch for union below. */
    153         enum dcerpc_AuthLevel auth_level;
    154         union {
    155                 struct schannel_state *schannel_auth;
    156                 AUTH_NTLMSSP_STATE *auth_ntlmssp_state;
    157 /*              struct kerberos_auth_struct *kerberos_auth; TO BE ADDED... */
    158         } a_u;
    159         void (*auth_data_free_func)(struct pipe_auth_data *);
    160 };
     98struct gse_context;
     99
     100struct dcesrv_ep_entry_list;
    161101
    162102/*
     
    165105 */
    166106
    167 typedef struct pipes_struct {
     107struct pipes_struct {
    168108        struct pipes_struct *next, *prev;
    169109
    170         char client_address[INET6_ADDRSTRLEN];
    171 
    172         struct auth_serversupplied_info *server_info;
     110        struct client_address *client_id;
     111        struct client_address *server_id;
     112
     113        enum dcerpc_transport_t transport;
     114
     115        struct auth_serversupplied_info *session_info;
     116        struct messaging_context *msg_ctx;
    173117
    174118        struct ndr_syntax_id syntax;
     119        struct dcesrv_ep_entry_list *ep_entries;
    175120
    176121        /* linked list of rpc dispatch tables associated
     
    179124        PIPE_RPC_FNS *contexts;
    180125
    181         RPC_HDR hdr; /* Incoming RPC header. */
    182         RPC_HDR_REQ hdr_req; /* Incoming request header. */
    183 
    184126        struct pipe_auth_data auth;
     127
     128        bool ncalrpc_as_system;
    185129
    186130        /*
     
    233177        struct handle_list *pipe_handles;
    234178
     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
    235185        /* private data for the interface implementation */
    236186        void *private_data;
    237187
    238 } pipes_struct;
     188};
    239189
    240190struct api_struct { 
    241191        const char *name;
    242192        uint8 opnum;
    243         bool (*fn) (pipes_struct *);
     193        bool (*fn) (struct pipes_struct *);
    244194};
    245195
     196/* The following definitions come from rpc_server/rpc_handles.c  */
     197
     198size_t num_pipe_handles(struct pipes_struct *p);
     199bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *syntax);
     200bool create_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
     201bool find_policy_by_hnd(struct pipes_struct *p, const struct policy_handle *hnd,
     202                        void **data_p);
     203bool close_policy_hnd(struct pipes_struct *p, struct policy_handle *hnd);
     204void close_policy_by_pipe(struct pipes_struct *p);
     205bool pipe_access_check(struct pipes_struct *p);
     206
     207void *_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
     214void *_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))
     222
     223#include "rpc_server/srv_pipe_register.h"
     224
    246225#endif /* _NT_DOMAIN_H */
  • trunk/server/source3/include/ntioctl.h

    r414 r745  
    3939#define FSCTL_GET_COMPRESSION        0x0009003C
    4040#define FSCTL_SET_COMPRESSION        0x0009C040
     41#define FSCTL_IS_VOLUME_DIRTY        0x00090078
    4142#define FSCTL_REQUEST_FILTER_OPLOCK  0x0009008C
    4243#define FSCTL_FIND_FILES_BY_SID      0x0009008F
     
    7778typedef char SHADOW_COPY_LABEL[25];
    7879
    79 typedef struct shadow_copy_data {
    80         TALLOC_CTX *mem_ctx;
     80struct shadow_copy_data {
    8181        /* Total number of shadow volumes currently mounted */
    8282        uint32 num_volumes;
    8383        /* Concatenated list of labels */
    8484        SHADOW_COPY_LABEL *labels;
    85 } SHADOW_COPY_DATA;
     85};
    8686
    8787
  • trunk/server/source3/include/ntquotas.h

    r414 r745  
    7373        uint64_t hardlim;
    7474        uint32 qflags;
    75         DOM_SID sid;
     75        struct dom_sid sid;
    7676} SMB_NTQUOTA_STRUCT;
    7777
  • trunk/server/source3/include/packet.h

    r414 r745  
    33   Packet 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/>.
     
    3939 * Sync read, wait for the next chunk
    4040 */
    41 NTSTATUS packet_fd_read_sync(struct packet_context *ctx,
    42                              struct timeval *timeout);
     41NTSTATUS packet_fd_read_sync(struct packet_context *ctx, int timeout);
    4342
    4443/*
  • trunk/server/source3/include/passdb.h

    r414 r745  
    2424#define _PASSDB_H
    2525
     26#include "../librpc/gen_ndr/lsa.h"
     27
     28#include "mapping.h"
     29
    2630/**********************************************************************
    2731 * Masks for mappings between unix uid and gid types and
     
    2933 **********************************************************************/
    3034
    31 #define BASE_RID (0x000003E8L)
    32 
    3335/* Take the bottom bit. */
    3436#define RID_TYPE_MASK           1
     
    3840#define USER_RID_TYPE           0
    3941#define GROUP_RID_TYPE          1
     42
     43/*
     44 * Flags for local user manipulation.
     45 */
     46
     47#define LOCAL_ADD_USER 0x1
     48#define LOCAL_DELETE_USER 0x2
     49#define LOCAL_DISABLE_USER 0x4
     50#define LOCAL_ENABLE_USER 0x8
     51#define LOCAL_TRUST_ACCOUNT 0x10
     52#define LOCAL_SET_NO_PASSWORD 0x20
     53#define LOCAL_SET_PASSWORD 0x40
     54#define LOCAL_SET_LDAP_ADMIN_PW 0x80
     55#define LOCAL_INTERDOM_ACCOUNT 0x100
     56#define LOCAL_AM_ROOT 0x200  /* Act as root */
     57
     58/*
     59 * Size of new password account encoding string.  This is enough space to
     60 * hold 11 ACB characters, plus the surrounding [] and a terminating null.
     61 * Do not change unless you are adding new ACB bits!
     62 */
     63
     64#define NEW_PW_FORMAT_SPACE_PADDED_LEN 14
     65
     66/* Password history contants. */
     67#define PW_HISTORY_SALT_LEN 16
     68#define SALTED_MD5_HASH_LEN 16
     69#define PW_HISTORY_ENTRY_LEN (PW_HISTORY_SALT_LEN+SALTED_MD5_HASH_LEN)
     70#define MAX_PW_HISTORY_LEN 24
    4071
    4172/*
     
    73104        PDB_BAD_PASSWORD_COUNT,
    74105        PDB_LOGON_COUNT,
     106        PDB_COUNTRY_CODE,
     107        PDB_CODE_PAGE,
    75108        PDB_UNKNOWN6,
    76109        PDB_LMPASSWD,
     
    105138
    106139/* cache for bad password lockout data, to be used on replicated SAMs */
    107 typedef struct logon_cache_struct {
     140struct login_cache {
    108141        time_t entry_timestamp;
    109         uint32 acct_ctrl;
    110         uint16 bad_password_count;
     142        uint32_t acct_ctrl;
     143        uint16_t bad_password_count;
    111144        time_t bad_password_time;
    112 } LOGIN_CACHE;
     145};
    113146
    114147#define SAMU_BUFFER_V0          0
     
    119152#define SAMU_BUFFER_V4          4
    120153#define SAMU_BUFFER_LATEST      SAMU_BUFFER_V4
     154
     155#define MAX_HOURS_LEN 32
    121156
    122157struct samu {
     
    148183        const char *munged_dial;  /* munged path name and dial-back tel number */
    149184
    150         DOM_SID user_sid; 
    151         DOM_SID *group_sid;
     185        struct dom_sid user_sid;
     186        struct dom_sid *group_sid;
    152187
    153188        DATA_BLOB lm_pw; /* .data is Null if no password */
     
    156191        char* plaintext_pw; /* is Null if not available */
    157192
    158         uint32 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
    159         uint32 fields_present; /* 0x00ff ffff */
    160 
    161         uint16 logon_divs; /* 168 - number of hours in a week */
    162         uint32 hours_len; /* normally 21 bytes */
    163         uint8 hours[MAX_HOURS_LEN];
     193        uint32_t acct_ctrl; /* account info (ACB_xxxx bit-mask) */
     194        uint32_t fields_present; /* 0x00ff ffff */
     195
     196        uint16_t logon_divs; /* 168 - number of hours in a week */
     197        uint32_t hours_len; /* normally 21 bytes */
     198        uint8_t hours[MAX_HOURS_LEN];
    164199
    165200        /* Was unknown_5. */
    166         uint16 bad_password_count;
    167         uint16 logon_count;
    168 
    169         uint32 unknown_6; /* 0x0000 04ec */
     201        uint16_t bad_password_count;
     202        uint16_t logon_count;
     203
     204        uint16_t country_code;
     205        uint16_t code_page;
     206
     207        uint32_t unknown_6; /* 0x0000 04ec */
    170208
    171209        /* a tag for who added the private methods */
     
    183221        fstring acct_name; /* account name */
    184222        fstring acct_desc; /* account name */
    185         uint32 rid; /* domain-relative RID */
     223        uint32_t rid; /* domain-relative RID */
    186224};
    187225
    188226struct samr_displayentry {
    189         uint32 idx;
    190         uint32 rid;
    191         uint32 acct_flags;
     227        uint32_t idx;
     228        uint32_t rid;
     229        uint32_t acct_flags;
    192230        const char *account_name;
    193231        const char *fullname;
     
    204242        enum pdb_search_type type;
    205243        struct samr_displayentry *cache;
    206         uint32 num_entries;
     244        uint32_t num_entries;
    207245        ssize_t cache_size;
    208246        bool search_ended;
     
    219257        struct dom_sid sid;
    220258        struct GUID guid;
     259};
     260
     261struct pdb_trusted_domain {
     262        char *domain_name;
     263        char *netbios_name;
     264        struct dom_sid security_identifier;
     265        DATA_BLOB trust_auth_incoming;
     266        DATA_BLOB trust_auth_outgoing;
     267        uint32_t trust_direction;
     268        uint32_t trust_type;
     269        uint32_t trust_attributes;
     270        DATA_BLOB trust_forest_trust_info;
     271};
     272
     273/*
     274 * trusted domain entry/entries returned by secrets_get_trusted_domains
     275 * (used in _lsa_enum_trust_dom call)
     276 */
     277struct trustdom_info {
     278        char *name;
     279        struct dom_sid sid;
    221280};
    222281
     
    237296};
    238297
    239 #define PDB_CAP_STORE_RIDS      0x0001
    240 #define PDB_CAP_ADS             0x0002
     298#define PDB_CAP_STORE_RIDS              0x0001
     299#define PDB_CAP_ADS                     0x0002
     300#define PDB_CAP_TRUSTED_DOMAINS_EX      0x0004
    241301
    242302/*****************************************************************
     
    252312 * the pdb module. Remove the latter, this might happen more often. VL.
    253313 * changed to version 14 to move lookup_rids and lookup_names to return
    254  * enum lsa_SidType rather than uint32.
     314 * enum lsa_SidType rather than uint32_t.
    255315 * Changed to 16 for access to the trusted domain passwords (obnox).
    256316 * Changed to 17, the sampwent interface is gone.
     
    270330        NTSTATUS (*getsampwnam)(struct pdb_methods *, struct samu *sam_acct, const char *username);
    271331
    272         NTSTATUS (*getsampwsid)(struct pdb_methods *, struct samu *sam_acct, const DOM_SID *sid);
     332        NTSTATUS (*getsampwsid)(struct pdb_methods *, struct samu *sam_acct, const struct dom_sid *sid);
    273333
    274334        NTSTATUS (*create_user)(struct pdb_methods *, TALLOC_CTX *tmp_ctx,
    275                                 const char *name, uint32 acct_flags,
    276                                 uint32 *rid);
     335                                const char *name, uint32_t acct_flags,
     336                                uint32_t *rid);
    277337
    278338        NTSTATUS (*delete_user)(struct pdb_methods *, TALLOC_CTX *tmp_ctx,
     
    289349        NTSTATUS (*update_login_attempts)(struct pdb_methods *methods, struct samu *sam_acct, bool success);
    290350
    291         NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map, DOM_SID sid);
     351        NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map, struct dom_sid sid);
    292352
    293353        NTSTATUS (*getgrgid)(struct pdb_methods *methods, GROUP_MAP *map, gid_t gid);
     
    297357        NTSTATUS (*create_dom_group)(struct pdb_methods *methods,
    298358                                     TALLOC_CTX *mem_ctx, const char *name,
    299                                      uint32 *rid);
     359                                     uint32_t *rid);
    300360
    301361        NTSTATUS (*delete_dom_group)(struct pdb_methods *methods,
    302                                      TALLOC_CTX *mem_ctx, uint32 rid);
     362                                     TALLOC_CTX *mem_ctx, uint32_t rid);
    303363
    304364        NTSTATUS (*add_group_mapping_entry)(struct pdb_methods *methods,
     
    309369
    310370        NTSTATUS (*delete_group_mapping_entry)(struct pdb_methods *methods,
    311                                                DOM_SID sid);
     371                                               struct dom_sid sid);
    312372
    313373        NTSTATUS (*enum_group_mapping)(struct pdb_methods *methods,
    314                                        const DOM_SID *sid, enum lsa_SidType sid_name_use,
     374                                       const struct dom_sid *sid, enum lsa_SidType sid_name_use,
    315375                                       GROUP_MAP **pp_rmap, size_t *p_num_entries,
    316376                                       bool unix_only);
     
    318378        NTSTATUS (*enum_group_members)(struct pdb_methods *methods,
    319379                                       TALLOC_CTX *mem_ctx,
    320                                        const DOM_SID *group,
    321                                        uint32 **pp_member_rids,
     380                                       const struct dom_sid *group,
     381                                       uint32_t **pp_member_rids,
    322382                                       size_t *p_num_members);
    323383
     
    325385                                           TALLOC_CTX *mem_ctx,
    326386                                           struct samu *user,
    327                                            DOM_SID **pp_sids, gid_t **pp_gids,
    328                                            size_t *p_num_groups);
     387                                           struct dom_sid **pp_sids, gid_t **pp_gids,
     388                                           uint32_t *p_num_groups);
    329389
    330390        NTSTATUS (*set_unix_primary_group)(struct pdb_methods *methods,
     
    334394        NTSTATUS (*add_groupmem)(struct pdb_methods *methods,
    335395                                 TALLOC_CTX *mem_ctx,
    336                                  uint32 group_rid, uint32 member_rid);
     396                                 uint32_t group_rid, uint32_t member_rid);
    337397
    338398        NTSTATUS (*del_groupmem)(struct pdb_methods *methods,
    339399                                 TALLOC_CTX *mem_ctx,
    340                                  uint32 group_rid, uint32 member_rid);
     400                                 uint32_t group_rid, uint32_t member_rid);
    341401
    342402        NTSTATUS (*create_alias)(struct pdb_methods *methods,
    343                                  const char *name, uint32 *rid);
     403                                 const char *name, uint32_t *rid);
    344404
    345405        NTSTATUS (*delete_alias)(struct pdb_methods *methods,
    346                                  const DOM_SID *sid);
     406                                 const struct dom_sid *sid);
    347407
    348408        NTSTATUS (*get_aliasinfo)(struct pdb_methods *methods,
    349                                   const DOM_SID *sid,
     409                                  const struct dom_sid *sid,
    350410                                  struct acct_info *info);
    351411
    352412        NTSTATUS (*set_aliasinfo)(struct pdb_methods *methods,
    353                                   const DOM_SID *sid,
     413                                  const struct dom_sid *sid,
    354414                                  struct acct_info *info);
    355415
    356416        NTSTATUS (*add_aliasmem)(struct pdb_methods *methods,
    357                                  const DOM_SID *alias, const DOM_SID *member);
     417                                 const struct dom_sid *alias, const struct dom_sid *member);
    358418        NTSTATUS (*del_aliasmem)(struct pdb_methods *methods,
    359                                  const DOM_SID *alias, const DOM_SID *member);
     419                                 const struct dom_sid *alias, const struct dom_sid *member);
    360420        NTSTATUS (*enum_aliasmem)(struct pdb_methods *methods,
    361                                   const DOM_SID *alias, TALLOC_CTX *mem_ctx,
    362                                   DOM_SID **members, size_t *p_num_members);
     421                                  const struct dom_sid *alias, TALLOC_CTX *mem_ctx,
     422                                  struct dom_sid **members, size_t *p_num_members);
    363423        NTSTATUS (*enum_alias_memberships)(struct pdb_methods *methods,
    364424                                           TALLOC_CTX *mem_ctx,
    365                                            const DOM_SID *domain_sid,
    366                                            const DOM_SID *members,
     425                                           const struct dom_sid *domain_sid,
     426                                           const struct dom_sid *members,
    367427                                           size_t num_members,
    368                                            uint32 **pp_alias_rids,
     428                                           uint32_t **pp_alias_rids,
    369429                                           size_t *p_num_alias_rids);
    370430
    371431        NTSTATUS (*lookup_rids)(struct pdb_methods *methods,
    372                                 const DOM_SID *domain_sid,
     432                                const struct dom_sid *domain_sid,
    373433                                int num_rids,
    374                                 uint32 *rids,
     434                                uint32_t *rids,
    375435                                const char **pp_names,
    376436                                enum lsa_SidType *attrs);
    377437
    378438        NTSTATUS (*lookup_names)(struct pdb_methods *methods,
    379                                  const DOM_SID *domain_sid,
     439                                 const struct dom_sid *domain_sid,
    380440                                 int num_names,
    381441                                 const char **pp_names,
    382                                  uint32 *rids,
     442                                 uint32_t *rids,
    383443                                 enum lsa_SidType *attrs);
    384444
     
    395455        bool (*search_users)(struct pdb_methods *methods,
    396456                             struct pdb_search *search,
    397                              uint32 acct_flags);
     457                             uint32_t acct_flags);
    398458        bool (*search_groups)(struct pdb_methods *methods,
    399459                              struct pdb_search *search);
    400460        bool (*search_aliases)(struct pdb_methods *methods,
    401461                               struct pdb_search *search,
    402                                const DOM_SID *sid);
     462                               const struct dom_sid *sid);
    403463
    404464        bool (*uid_to_sid)(struct pdb_methods *methods, uid_t uid,
    405                            DOM_SID *sid);
     465                           struct dom_sid *sid);
    406466        bool (*gid_to_sid)(struct pdb_methods *methods, gid_t gid,
    407                            DOM_SID *sid);
    408         bool (*sid_to_id)(struct pdb_methods *methods, const DOM_SID *sid,
     467                           struct dom_sid *sid);
     468        bool (*sid_to_id)(struct pdb_methods *methods, const struct dom_sid *sid,
    409469                          union unid_t *id, enum lsa_SidType *type);
    410470
    411471        uint32_t (*capabilities)(struct pdb_methods *methods);
    412         bool (*new_rid)(struct pdb_methods *methods, uint32 *rid);
     472        bool (*new_rid)(struct pdb_methods *methods, uint32_t *rid);
    413473
    414474
    415475        bool (*get_trusteddom_pw)(struct pdb_methods *methods,
    416476                                  const char *domain, char** pwd,
    417                                   DOM_SID *sid, time_t *pass_last_set_time);
     477                                  struct dom_sid *sid, time_t *pass_last_set_time);
    418478        bool (*set_trusteddom_pw)(struct pdb_methods *methods,
    419479                                  const char* domain, const char* pwd,
    420                                   const DOM_SID *sid);
     480                                  const struct dom_sid *sid);
    421481        bool (*del_trusteddom_pw)(struct pdb_methods *methods,
    422482                                  const char *domain);
    423483        NTSTATUS (*enum_trusteddoms)(struct pdb_methods *methods,
    424                                      TALLOC_CTX *mem_ctx, uint32 *num_domains,
     484                                     TALLOC_CTX *mem_ctx, uint32_t *num_domains,
    425485                                     struct trustdom_info ***domains);
     486
     487
     488        NTSTATUS (*get_trusted_domain)(struct pdb_methods *methods,
     489                                       TALLOC_CTX *mem_ctx,
     490                                       const char *domain,
     491                                       struct pdb_trusted_domain **td);
     492        NTSTATUS (*get_trusted_domain_by_sid)(struct pdb_methods *methods,
     493                                              TALLOC_CTX *mem_ctx,
     494                                              struct dom_sid *sid,
     495                                              struct pdb_trusted_domain **td);
     496        NTSTATUS (*set_trusted_domain)(struct pdb_methods *methods,
     497                                       const char* domain,
     498                                       const struct pdb_trusted_domain *td);
     499        NTSTATUS (*del_trusted_domain)(struct pdb_methods *methods,
     500                                       const char *domain);
     501        NTSTATUS (*enum_trusted_domains)(struct pdb_methods *methods,
     502                                         TALLOC_CTX *mem_ctx,
     503                                         uint32_t *num_domains,
     504                                         struct pdb_trusted_domain ***domains);
    426505
    427506        void *private_data;  /* Private data of some kind */
     
    441520};
    442521
     522#include "passdb/proto.h"
     523#include "passdb/machine_sid.h"
     524#include "passdb/lookup_sid.h"
     525
    443526#endif /* _PASSDB_H */
  • trunk/server/source3/include/popt_common.h

    r414 r745  
    3030extern struct poptOption popt_common_credentials[];
    3131extern struct poptOption popt_common_debuglevel[];
     32extern struct poptOption popt_common_option[];
    3233extern const struct poptOption popt_common_dynconfig[];
    3334
     
    4546    "Build-time configuration overrides:", NULL },
    4647#define POPT_COMMON_DEBUGLEVEL { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debuglevel, 0, "Common samba debugging:", NULL },
     48#define POPT_COMMON_OPTION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_option, 0, "Common samba commandline config:", NULL },
    4749
    4850struct user_auth_info {
     
    5961};
    6062
     63void popt_common_set_auth_info(struct user_auth_info *auth_info);
     64
    6165#endif /* _POPT_COMMON_H */
  • trunk/server/source3/include/printing.h

    r414 r745  
    2626*/
    2727
     28/* Extra fields above "LPQ_PRINTING" are used to map extra NT status codes. */
     29
     30enum {
     31        LPQ_QUEUED = 0,
     32        LPQ_PAUSED,
     33        LPQ_SPOOLING,
     34        LPQ_PRINTING,
     35        LPQ_ERROR,
     36        LPQ_DELETING,
     37        LPQ_OFFLINE,
     38        LPQ_PAPEROUT,
     39        LPQ_PRINTED,
     40        LPQ_DELETED,
     41        LPQ_BLOCKED,
     42        LPQ_USER_INTERVENTION,
     43
     44        /* smbd is dooing the file spooling before passing control to spoolss */
     45        PJOB_SMBD_SPOOLING
     46};
     47
     48typedef struct _print_queue_struct {
     49        int job;                /* normally the UNIX jobid -- see note in
     50                                   printing.c:traverse_fn_delete() */
     51        int size;
     52        int page_count;
     53        int status;
     54        int priority;
     55        time_t time;
     56        fstring fs_user;
     57        fstring fs_file;
     58} print_queue_struct;
     59
     60enum {LPSTAT_OK, LPSTAT_STOPPED, LPSTAT_ERROR};
     61
     62typedef struct {
     63        fstring message;
     64        int qcount;
     65        int status;
     66}  print_status_struct;
     67
    2868/* Information for print jobs */
    2969struct printjob {
     
    4080        fstring jobname; /* the job name given to us by the client */
    4181        fstring user; /* the user who started the job */
     82        fstring clientmachine; /* The client machine which started this job */
    4283        fstring queuename; /* service number of printer for this job */
    43         NT_DEVICEMODE *nt_devmode;
     84        struct spoolss_DeviceMode *devmode;
    4485};
    4586
     
    83124#define PRINT_SPOOL_PREFIX "smbprn."
    84125#endif
    85 #define PRINT_DATABASE_VERSION 5
     126#define PRINT_DATABASE_VERSION 7
     127
     128#ifdef AIX
     129#define DEFAULT_PRINTING PRINT_AIX
     130#define PRINTCAP_NAME "/etc/qconfig"
     131#endif
     132
     133#ifdef HPUX
     134#define DEFAULT_PRINTING PRINT_HPUX
     135#endif
     136
     137#ifdef QNX
     138#define DEFAULT_PRINTING PRINT_QNX
     139#endif
     140
     141#ifndef DEFAULT_PRINTING
     142#ifdef HAVE_CUPS
     143#define DEFAULT_PRINTING PRINT_CUPS
     144#define PRINTCAP_NAME "cups"
     145#elif defined(SYSV)
     146#define DEFAULT_PRINTING PRINT_SYSV
     147#define PRINTCAP_NAME "lpstat"
     148#else
     149#define DEFAULT_PRINTING PRINT_BSD
     150#define PRINTCAP_NAME "/etc/printcap"
     151#endif
     152#endif
     153
     154#ifndef PRINTCAP_NAME
     155#define PRINTCAP_NAME "/etc/printcap"
     156#endif
    86157
    87158/* There can be this many printing tdb's open, plus any locked ones. */
    88159#define MAX_PRINT_DBS_OPEN 1
    89160
     161struct TDB_DATA;
     162struct tdb_context;
     163
    90164struct tdb_print_db {
    91165        struct tdb_print_db *next, *prev;
    92         TDB_CONTEXT *tdb;
     166        struct tdb_context *tdb;
    93167        int ref_count;
    94168        fstring printer_name;
     
    101175#define NOTIFY_PID_LIST_KEY "NOTIFY_PID_LIST"
    102176
     177/* The following definitions come from printing/printspoolss.c  */
     178
     179NTSTATUS print_spool_open(files_struct *fsp,
     180                          const char *fname,
     181                          uint16_t current_vuid);
     182
     183int print_spool_write(files_struct *fsp, const char *data, uint32_t size,
     184                      SMB_OFF_T offset, uint32_t *written);
     185
     186void print_spool_end(files_struct *fsp, enum file_close_type close_type);
     187
     188void print_spool_terminate(struct connection_struct *conn,
     189                           struct print_file_data *print_file);
     190
     191/* The following definitions come from printing/printing.c  */
     192
     193uint32 sysjob_to_jobid(int unix_jobid);
     194bool print_notify_register_pid(int snum);
     195bool print_notify_deregister_pid(int snum);
     196bool print_job_exists(const char* sharename, uint32 jobid);
     197char *print_job_fname(const char* sharename, uint32 jobid);
     198struct spoolss_DeviceMode *print_job_devmode(const char* sharename, uint32 jobid);
     199bool print_job_set_name(struct tevent_context *ev,
     200                        struct messaging_context *msg_ctx,
     201                        const char *sharename, uint32 jobid, const char *name);
     202bool print_job_get_name(TALLOC_CTX *mem_ctx, const char *sharename, uint32_t jobid, char **name);
     203WERROR print_job_delete(const struct auth_serversupplied_info *server_info,
     204                        struct messaging_context *msg_ctx,
     205                        int snum, uint32_t jobid);
     206bool print_job_pause(const struct auth_serversupplied_info *server_info,
     207                     struct messaging_context *msg_ctx,
     208                     int snum, uint32 jobid, WERROR *errcode);
     209bool print_job_resume(const struct auth_serversupplied_info *server_info,
     210                      struct messaging_context *msg_ctx,
     211                      int snum, uint32 jobid, WERROR *errcode);
     212ssize_t print_job_write(struct tevent_context *ev,
     213                        struct messaging_context *msg_ctx,
     214                        int snum, uint32 jobid, const char *buf, size_t size);
     215int print_queue_length(struct messaging_context *msg_ctx, int snum,
     216                       print_status_struct *pstatus);
     217WERROR print_job_start(const struct auth_serversupplied_info *server_info,
     218                       struct messaging_context *msg_ctx,
     219                       const char *clientmachine,
     220                       int snum, const char *docname, const char *filename,
     221                       struct spoolss_DeviceMode *devmode, uint32_t *_jobid);
     222void print_job_endpage(struct messaging_context *msg_ctx,
     223                       int snum, uint32 jobid);
     224NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum,
     225                       uint32 jobid, enum file_close_type close_type);
     226int print_queue_status(struct messaging_context *msg_ctx, int snum,
     227                       print_queue_struct **ppqueue,
     228                       print_status_struct *status);
     229WERROR print_queue_pause(const struct auth_serversupplied_info *server_info,
     230                         struct messaging_context *msg_ctx, int snum);
     231WERROR print_queue_resume(const struct auth_serversupplied_info *server_info,
     232                          struct messaging_context *msg_ctx, int snum);
     233WERROR print_queue_purge(const struct auth_serversupplied_info *server_info,
     234                         struct messaging_context *msg_ctx, int snum);
     235uint16 pjobid_to_rap(const char* sharename, uint32 jobid);
     236bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid);
     237void rap_jobid_delete(const char* sharename, uint32 jobid);
     238bool print_backend_init(struct messaging_context *msg_ctx);
     239void start_background_queue(struct tevent_context *ev,
     240                            struct messaging_context *msg);
     241void printing_end(void);
     242
     243/* The following definitions come from printing/lpq_parse.c  */
     244
     245bool parse_lpq_entry(enum printing_types printing_type,char *line,
     246                     print_queue_struct *buf,
     247                     print_status_struct *status,bool first);
     248uint32_t print_parse_jobid(const char *fname);
     249
     250/* The following definitions come from printing/printing_db.c  */
     251
     252struct tdb_print_db *get_print_db_byname(const char *printername);
     253void release_print_db( struct tdb_print_db *pdb);
     254void close_all_print_db(void);
     255struct TDB_DATA get_printer_notify_pid_list(struct tdb_context *tdb, const char *printer_name, bool cleanlist);
     256
     257void print_queue_receive(struct messaging_context *msg,
     258                                void *private_data,
     259                                uint32_t msg_type,
     260                                struct server_id server_id,
     261                                DATA_BLOB *data);
    103262#endif /* PRINTING_H_ */
  • trunk/server/source3/include/proto.h

    r599 r745  
    2424#define _PROTO_H_
    2525
    26 
    27 /* The following definitions come from auth/auth.c  */
    28 
    29 NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init);
    30 bool load_auth_module(struct auth_context *auth_context,
    31                       const char *module, auth_methods **ret) ;
    32 NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) ;
    33 NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[8]) ;
    34 
    35 /* The following definitions come from auth/auth_builtin.c  */
    36 
    37 NTSTATUS auth_builtin_init(void);
    38 
    39 /* The following definitions come from auth/auth_compat.c  */
    40 
    41 NTSTATUS check_plaintext_password(const char *smb_name, DATA_BLOB plaintext_password, auth_serversupplied_info **server_info);
    42 bool password_ok(struct auth_context *actx, bool global_encrypted,
    43                  const char *session_workgroup,
    44                  const char *smb_name, DATA_BLOB password_blob);
    45 
    46 /* The following definitions come from auth/auth_domain.c  */
    47 
    48 void attempt_machine_password_change(void);
    49 NTSTATUS auth_domain_init(void);
    50 
    51 NTSTATUS auth_netlogond_init(void);
    52 
    53 /* The following definitions come from auth/auth_ntlmssp.c  */
    54 
    55 NTSTATUS auth_ntlmssp_start(AUTH_NTLMSSP_STATE **auth_ntlmssp_state);
    56 void auth_ntlmssp_end(AUTH_NTLMSSP_STATE **auth_ntlmssp_state);
    57 NTSTATUS auth_ntlmssp_update(AUTH_NTLMSSP_STATE *auth_ntlmssp_state,
    58                              const DATA_BLOB request, DATA_BLOB *reply) ;
    59 
    60 /* The following definitions come from auth/auth_sam.c  */
    61 
    62 NTSTATUS auth_sam_init(void);
    63 
    64 /* The following definitions come from auth/auth_server.c  */
    65 
    66 NTSTATUS auth_server_init(void);
    67 
    68 /* The following definitions come from auth/auth_unix.c  */
    69 
    70 NTSTATUS auth_unix_init(void);
    71 
    72 /* The following definitions come from auth/auth_util.c  */
    73 
    74 NTSTATUS make_user_info_map(auth_usersupplied_info **user_info,
    75                             const char *smb_name,
    76                             const char *client_domain,
    77                             const char *wksta_name,
    78                             DATA_BLOB *lm_pwd, DATA_BLOB *nt_pwd,
    79                             DATA_BLOB *lm_interactive_pwd, DATA_BLOB *nt_interactive_pwd,
    80                             DATA_BLOB *plaintext,
    81                             bool encrypted);
    82 bool make_user_info_netlogon_network(auth_usersupplied_info **user_info,
    83                                      const char *smb_name,
    84                                      const char *client_domain,
    85                                      const char *wksta_name,
    86                                      uint32 logon_parameters,
    87                                      const uchar *lm_network_pwd,
    88                                      int lm_pwd_len,
    89                                      const uchar *nt_network_pwd,
    90                                      int nt_pwd_len);
    91 bool make_user_info_netlogon_interactive(auth_usersupplied_info **user_info,
    92                                          const char *smb_name,
    93                                          const char *client_domain,
    94                                          const char *wksta_name,
    95                                          uint32 logon_parameters,
    96                                          const uchar chal[8],
    97                                          const uchar lm_interactive_pwd[16],
    98                                          const uchar nt_interactive_pwd[16],
    99                                          const uchar *dc_sess_key);
    100 bool make_user_info_for_reply(auth_usersupplied_info **user_info,
    101                               const char *smb_name,
    102                               const char *client_domain,
    103                               const uint8 chal[8],
    104                               DATA_BLOB plaintext_password);
    105 NTSTATUS make_user_info_for_reply_enc(auth_usersupplied_info **user_info,
    106                                       const char *smb_name,
    107                                       const char *client_domain,
    108                                       DATA_BLOB lm_resp, DATA_BLOB nt_resp);
    109 bool make_user_info_guest(auth_usersupplied_info **user_info) ;
    110 NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info,
    111                               struct samu *sampass);
    112 NTSTATUS create_local_token(auth_serversupplied_info *server_info);
    113 NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
    114                                     bool is_guest,
    115                                     uid_t *uid, gid_t *gid,
    116                                     char **found_username,
    117                                     struct nt_user_token **token);
    118 bool user_in_group_sid(const char *username, const DOM_SID *group_sid);
    119 bool user_in_group(const char *username, const char *groupname);
    120 NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
    121                              char *unix_username,
    122                              struct passwd *pwd);
    123 NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx,
    124                                        const char *username,
    125                                        bool is_guest,
    126                                        struct auth_serversupplied_info **presult);
    127 struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx,
    128                                                  const auth_serversupplied_info *src);
    129 bool init_guest_info(void);
    130 bool server_info_set_session_key(struct auth_serversupplied_info *info,
    131                                  DATA_BLOB session_key);
    132 NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,
    133                                 auth_serversupplied_info **server_info);
    134 bool copy_current_user(struct current_user *dst, struct current_user *src);
    135 struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser,
    136                              fstring save_username, bool create );
    137 NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
    138                                 const char *sent_nt_username,
    139                                 const char *domain,
    140                                 auth_serversupplied_info **server_info,
    141                                 struct netr_SamInfo3 *info3);
    142 NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
    143                                           const char *sent_nt_username,
    144                                           const char *domain,
    145                                           const struct wbcAuthUserInfo *info,
    146                                           auth_serversupplied_info **server_info);
    147 void free_user_info(auth_usersupplied_info **user_info);
    148 bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ;
    149 bool is_trusted_domain(const char* dom_name);
    150 
    151 /* The following definitions come from auth/auth_winbind.c  */
    152 
    153 NTSTATUS auth_winbind_init(void);
    154 
    155 /* The following definitions come from auth/auth_wbc.c  */
    156 
    157 NTSTATUS auth_wbc_init(void);
    158 
    159 /* The following definitions come from auth/pampass.c  */
    160 
    161 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
    162 bool smb_pam_close_session(char *user, char *tty, char *rhost);
    163 NTSTATUS smb_pam_accountcheck(const char * user);
    164 NTSTATUS smb_pam_passcheck(const char * user, const char * password);
    165 bool smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword);
    166 NTSTATUS smb_pam_accountcheck(const char * user);
    167 bool smb_pam_claim_session(char *user, char *tty, char *rhost);
    168 bool smb_pam_close_session(char *in_user, char *tty, char *rhost);
    169 
    170 /* The following definitions come from auth/pass_check.c  */
    171 
    172 void dfs_unlogin(void);
    173 NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *password,
    174                     int pwlen, bool (*fn) (const char *, const char *), bool run_cracker);
    175 
    176 /* The following definitions come from auth/token_util.c  */
    177 
    178 bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token );
    179 bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid );
    180 NT_USER_TOKEN *get_root_nt_token( void );
    181 NTSTATUS add_aliases(const DOM_SID *domain_sid,
    182                      struct nt_user_token *token);
    183 NTSTATUS create_builtin_users(const DOM_SID *sid);
    184 NTSTATUS create_builtin_administrators(const DOM_SID *sid);
    185 struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
    186                                             const DOM_SID *user_sid,
    187                                             bool is_guest,
    188                                             int num_groupsids,
    189                                             const DOM_SID *groupsids);
    190 void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token);
    191 void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid,
    192                            int n_groups, gid_t *groups);
    193 
    194 /* The following definitions come from groupdb/mapping.c  */
    195 
    196 NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
    197 bool get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map);
    198 int smb_create_group(const char *unix_group, gid_t *new_gid);
    199 int smb_delete_group(const char *unix_group);
    200 int smb_set_primary_group(const char *unix_group, const char* unix_user);
    201 int smb_add_user_group(const char *unix_group, const char *unix_user);
    202 int smb_delete_user_group(const char *unix_group, const char *unix_user);
    203 NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
    204                                  DOM_SID sid);
    205 NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
    206                                  gid_t gid);
    207 NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
    208                                  const char *name);
    209 NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
    210                                                 GROUP_MAP *map);
    211 NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
    212                                                    GROUP_MAP *map);
    213 NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
    214                                                    DOM_SID sid);
    215 NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
    216                                            const DOM_SID *sid, enum lsa_SidType sid_name_use,
    217                                            GROUP_MAP **pp_rmap, size_t *p_num_entries,
    218                                            bool unix_only);
    219 NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
    220                                   const char *name, uint32 *rid);
    221 NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
    222                                   const DOM_SID *sid);
    223 NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
    224                                    const DOM_SID *sid,
    225                                    struct acct_info *info);
    226 NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
    227                                    const DOM_SID *sid,
    228                                    struct acct_info *info);
    229 NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
    230                                   const DOM_SID *alias, const DOM_SID *member);
    231 NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
    232                                   const DOM_SID *alias, const DOM_SID *member);
    233 NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
    234                                    const DOM_SID *alias, TALLOC_CTX *mem_ctx,
    235                                    DOM_SID **pp_members,
    236                                    size_t *p_num_members);
    237 NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
    238                                        TALLOC_CTX *mem_ctx,
    239                                        const DOM_SID *domain_sid,
    240                                        const DOM_SID *members,
    241                                        size_t num_members,
    242                                        uint32 **pp_alias_rids,
    243                                        size_t *p_num_alias_rids);
    244 NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
    245                                  DOM_SID sid);
    246 NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
    247                                  gid_t gid);
    248 NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
    249                                  const char *name);
    250 NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
    251                                                 GROUP_MAP *map);
    252 NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
    253                                                    GROUP_MAP *map);
    254 NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
    255                                                    DOM_SID sid);
    256 NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
    257                                            enum lsa_SidType sid_name_use,
    258                                            GROUP_MAP **rmap, size_t *num_entries,
    259                                            bool unix_only);
    260 bool pdb_get_dom_grp_info(const DOM_SID *sid, struct acct_info *info);
    261 bool pdb_set_dom_grp_info(const DOM_SID *sid, const struct acct_info *info);
    262 NTSTATUS pdb_create_builtin_alias(uint32 rid);
    263 
    264 /* The following definitions come from groupdb/mapping_ldb.c  */
    265 
    266 const struct mapping_backend *groupdb_ldb_init(void);
    267 
    268 /* The following definitions come from groupdb/mapping_tdb.c  */
    269 
    270 const struct mapping_backend *groupdb_tdb_init(void);
    271 
    272 /* The following definitions come from intl/lang_tdb.c  */
    273 
    274 bool lang_tdb_init(const char *lang);
    275 const char *lang_msg(const char *msgid);
    276 void lang_msg_free(const char *msgstr);
    277 char *lang_tdb_current(void);
    278 
    27926/* The following definitions come from lib/access.c  */
    28027
     
    28633                const char *cname,
    28734                const char *caddr);
    288 bool check_access(int sock, const char **allow_list, const char **deny_list);
    289 
    290 /* The following definitions come from lib/account_pol.c  */
    291 
    292 void account_policy_names_list(const char ***names, int *num_names);
    293 const char *decode_account_policy_name(enum pdb_policy_type type);
    294 const char *get_account_policy_attr(enum pdb_policy_type type);
    295 const char *account_policy_get_desc(enum pdb_policy_type type);
    296 enum pdb_policy_type account_policy_name_to_typenum(const char *name);
    297 bool account_policy_get_default(enum pdb_policy_type type, uint32_t *val);
    298 bool init_account_policy(void);
    299 bool account_policy_get(enum pdb_policy_type type, uint32_t *value);
    300 bool account_policy_set(enum pdb_policy_type type, uint32_t value);
    301 bool cache_account_policy_set(enum pdb_policy_type type, uint32_t value);
    302 bool cache_account_policy_get(enum pdb_policy_type type, uint32_t *value);
    303 struct db_context *get_account_pol_db( void );
    30435
    30536/* The following definitions come from lib/adt_tree.c  */
     
    33364/* The following definitions come from lib/bitmap.c  */
    33465
    335 struct bitmap *bitmap_allocate(int n);
    336 void bitmap_free(struct bitmap *bm);
    33766struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n);
    33867int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src);
     
    34473/* The following definitions come from lib/charcnv.c  */
    34574
    346 NTSTATUS smb_register_charset(struct charset_functions *funcs);
    34775char lp_failed_convert_char(void);
    34876void lazy_initialize_conv(void);
     
    411139                        int flags);
    412140size_t align_string(const void *base_ptr, const char *p, int flags);
    413 codepoint_t next_codepoint(const char *str, size_t *size);
    414141
    415142/* The following definitions come from lib/clobber.c  */
     
    419146/* The following definitions come from lib/conn_tdb.c  */
    420147
    421 struct db_record *connections_fetch_record(TALLOC_CTX *mem_ctx,
    422                                            TDB_DATA key);
    423148struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx,
    424149                                          connection_struct *conn,
     
    432157                                 void *private_data),
    433158                       void *private_data);
     159int connections_forall_read(int (*fn)(const struct connections_key *key,
     160                                      const struct connections_data *data,
     161                                      void *private_data),
     162                            void *private_data);
    434163bool connections_init(bool rw);
    435 
    436 /* The following definitions come from lib/dbwrap_util.c  */
    437 
    438 int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
    439 int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v);
    440 bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
    441                          uint32_t *val);
    442 int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
    443 NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
    444                                      uint32_t *oldval, uint32_t change_val);
    445 NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db,
    446                                            const char *keystr,
    447                                            uint32_t *oldval,
    448                                            uint32_t change_val);
    449 NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
    450                                     int32_t *oldval, int32_t change_val);
    451 NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db,
    452                                           const char *keystr,
    453                                           int32_t *oldval,
    454                                           int32_t change_val);
    455 NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
    456                             int flag);
    457 NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key);
    458 NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr,
    459                                   int32_t v);
    460 NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr,
    461                                    uint32_t v);
    462 NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key,
    463                                      TDB_DATA data, int flags);
    464 NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key);
    465 NTSTATUS dbwrap_trans_do(struct db_context *db,
    466                          NTSTATUS (*action)(struct db_context *, void *),
    467                          void *private_data);
    468 NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key);
    469 NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
    470                                      TDB_DATA data, int flags);
    471 TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx,
    472                                      const char *key);
    473 
    474 /* The following definitions come from lib/debug.c  */
    475 
    476 void gfree_debugsyms(void);
    477 const char *debug_classname_from_index(int ndx);
    478 int debug_add_class(const char *classname);
    479 int debug_lookup_classname(const char *classname);
    480 bool debug_parse_levels(const char *params_str);
    481 void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data);
    482 void debug_init(void);
    483 void debug_register_msgs(struct messaging_context *msg_ctx);
    484 void setup_logging(const char *pname, bool interactive);
    485 void setup_logging_stdout( void );
    486 void debug_set_logfile(const char *name);
    487 bool reopen_logs( void );
    488 void force_check_log_size( void );
    489 bool need_to_check_log_size( void );
    490 void check_log_size( void );
    491 void dbgflush( void );
    492 bool dbghdrclass(int level, int cls, const char *location, const char *func);
    493 bool dbghdr(int level, const char *location, const char *func);
    494 
    495 /* The following definitions come from lib/display_sec.c  */
    496 
    497 char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
    498 void display_sec_access(uint32_t *info);
    499 void display_sec_ace_flags(uint8_t flags);
    500 void display_sec_ace(SEC_ACE *ace);
    501 void display_sec_acl(SEC_ACL *sec_acl);
    502 void display_acl_type(uint16 type);
    503 void display_sec_desc(SEC_DESC *sec);
    504164
    505165/* The following definitions come from lib/dmallocmsg.c  */
     
    534194bool gencache_del(const char *keystr);
    535195bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
     196bool gencache_parse(const char *keystr,
     197                    void (*parser)(time_t timeout, DATA_BLOB blob,
     198                                   void *private_data),
     199                    void *private_data);
    536200bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob,
    537201                            time_t *timeout, bool *was_expired);
    538202bool gencache_stabilize(void);
    539203bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout);
     204void gencache_iterate_blobs(void (*fn)(const char *key, DATA_BLOB value,
     205                                       time_t timeout, void *private_data),
     206                            void *private_data, const char *pattern);
    540207void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
    541208                      void* data, const char* keystr_pattern);
     
    587254int gen_fnmatch(const char *pattern, const char *string);
    588255
    589 /* The following definitions come from lib/pam_errors.c  */
    590 
    591 NTSTATUS pam_to_nt_status(int pam_error);
    592 int nt_status_to_pam(NTSTATUS nt_status);
    593 NTSTATUS pam_to_nt_status(int pam_error);
    594 int nt_status_to_pam(NTSTATUS nt_status);
    595 
    596256/* The following definitions come from lib/pidfile.c  */
    597257
     
    599259void pidfile_create(const char *program_name);
    600260void pidfile_unlink(void);
    601 
    602 /* The following definitions come from lib/popt_common.c  */
    603 
    604 void popt_common_set_auth_info(struct user_auth_info *auth_info);
    605 
    606 /* The following definitions come from lib/privileges.c  */
    607 
    608 bool get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount);
    609 NTSTATUS privilege_enumerate_accounts(DOM_SID **sids, int *num_sids);
    610 NTSTATUS privilege_enum_sids(const SE_PRIV *mask, TALLOC_CTX *mem_ctx,
    611                              DOM_SID **sids, int *num_sids);
    612 bool grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
    613 bool grant_privilege_by_name(DOM_SID *sid, const char *name);
    614 bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask);
    615 bool revoke_all_privileges( DOM_SID *sid );
    616 bool revoke_privilege_by_name(DOM_SID *sid, const char *name);
    617 NTSTATUS privilege_create_account(const DOM_SID *sid );
    618 NTSTATUS privilege_delete_account(const struct dom_sid *sid);
    619 NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set);
    620 NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set);
    621 void privilege_set_free(PRIVILEGE_SET *priv_set);
    622 NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_la, int count);
    623 bool is_privileged_sid( const DOM_SID *sid );
    624 bool grant_all_privileges( const DOM_SID *sid );
    625 
    626 /* The following definitions come from lib/privileges_basic.c  */
    627 
    628 bool se_priv_copy( SE_PRIV *dst, const SE_PRIV *src );
    629 bool se_priv_put_all_privileges(SE_PRIV *mask);
    630 void se_priv_add( SE_PRIV *mask, const SE_PRIV *addpriv );
    631 void se_priv_remove( SE_PRIV *mask, const SE_PRIV *removepriv );
    632 bool se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 );
    633 bool se_priv_from_name( const char *name, SE_PRIV *mask );
    634 void dump_se_priv( int dbg_cl, int dbg_lvl, const SE_PRIV *mask );
    635 bool is_privilege_assigned(const SE_PRIV *privileges,
    636                            const SE_PRIV *check);
    637 const char* get_privilege_dispname( const char *name );
    638 bool user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege);
    639 bool user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege);
    640 int count_all_privileges( void );
    641 LUID_ATTR get_privilege_luid( SE_PRIV *mask );
    642 const char *luid_to_privilege_name(const LUID *set);
    643 bool se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask );
    644 bool privilege_set_to_se_priv( SE_PRIV *mask, struct lsa_PrivilegeSet *privset );
    645 
    646 /* The following definitions come from lib/readline.c  */
    647 
    648 void smb_readline_done(void);
    649 char *smb_readline(const char *prompt, void (*callback)(void),
    650                    char **(completion_fn)(const char *text, int start, int end));
    651 const char *smb_readline_get_line_buffer(void);
    652 void smb_readline_ca_char(char c);
    653 int cmd_history(void);
    654261
    655262/* The following definitions come from lib/recvfile.c  */
     
    667274/* The following definitions come from lib/secdesc.c  */
    668275
    669 uint32_t get_sec_info(const SEC_DESC *sd);
    670 SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb);
    671 SEC_DESC *make_sec_desc(TALLOC_CTX *ctx,
     276uint32_t get_sec_info(const struct security_descriptor *sd);
     277struct security_descriptor *sec_desc_merge(TALLOC_CTX *ctx, struct security_descriptor *new_sdb, struct security_descriptor *old_sdb);
     278struct sec_desc_buf *sec_desc_merge_buf(TALLOC_CTX *ctx, struct sec_desc_buf *new_sdb, struct sec_desc_buf *old_sdb);
     279struct security_descriptor *make_sec_desc(TALLOC_CTX *ctx,
    672280                        enum security_descriptor_revision revision,
    673281                        uint16 type,
    674                         const DOM_SID *owner_sid, const DOM_SID *grp_sid,
    675                         SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size);
    676 SEC_DESC *dup_sec_desc(TALLOC_CTX *ctx, const SEC_DESC *src);
     282                        const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
     283                        struct security_acl *sacl, struct security_acl *dacl, size_t *sd_size);
     284struct security_descriptor *dup_sec_desc(TALLOC_CTX *ctx, const struct security_descriptor *src);
    677285NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
    678286                           struct security_descriptor *secdesc,
     
    685293NTSTATUS unmarshall_sec_desc_buf(TALLOC_CTX *mem_ctx, uint8_t *data, size_t len,
    686294                                 struct sec_desc_buf **psecdesc_buf);
    687 SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid,
    688                                  SEC_ACL *dacl, size_t *sd_size);
    689 SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc);
    690 SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src);
    691 NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size);
    692 NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask);
    693 NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size);
    694 bool sd_has_inheritable_components(const SEC_DESC *parent_ctr, bool container);
     295struct security_descriptor *make_standard_sec_desc(TALLOC_CTX *ctx, const struct dom_sid *owner_sid, const struct dom_sid *grp_sid,
     296                                 struct security_acl *dacl, size_t *sd_size);
     297struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct security_descriptor *sec_desc);
     298struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
     299NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, const struct dom_sid *sid, uint32 mask, size_t *sd_size);
     300NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32 mask);
     301NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, struct security_descriptor **psd, struct dom_sid *sid, size_t *sd_size);
     302bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
    695303NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
    696                                         SEC_DESC **ppsd,
     304                                        struct security_descriptor **ppsd,
    697305                                        size_t *psize,
    698                                         const SEC_DESC *parent_ctr,
    699                                         const DOM_SID *owner_sid,
    700                                         const DOM_SID *group_sid,
     306                                        const struct security_descriptor *parent_ctr,
     307                                        const struct dom_sid *owner_sid,
     308                                        const struct dom_sid *group_sid,
    701309                                        bool container);
    702310NTSTATUS se_create_child_secdesc_buf(TALLOC_CTX *ctx,
    703                                         SEC_DESC_BUF **ppsdb,
    704                                         const SEC_DESC *parent_ctr,
     311                                        struct sec_desc_buf **ppsdb,
     312                                        const struct security_descriptor *parent_ctr,
    705313                                        bool container);
    706 
    707 /* The following definitions come from lib/select.c  */
    708 
    709 void sys_select_signal(char c);
    710 int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
    711 int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval);
    712314
    713315/* The following definitions come from lib/sendfile.c  */
     
    723325
    724326bool share_info_db_init(void);
    725 SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
    726 SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename,
     327struct security_descriptor *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access);
     328struct security_descriptor *get_share_security( TALLOC_CTX *ctx, const char *servicename,
    727329                              size_t *psize);
    728 bool set_share_security(const char *share_name, SEC_DESC *psd);
     330bool set_share_security(const char *share_name, struct security_descriptor *psd);
    729331bool delete_share_security(const char *servicename);
    730 bool share_access_check(const NT_USER_TOKEN *token, const char *sharename,
    731                         uint32 desired_access);
    732 bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd);
    733 
    734 /* The following definitions come from lib/smbldap.c  */
    735 
    736 int smb_ldap_start_tls(LDAP *ldap_struct, int version);
    737 int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri);
    738 int smb_ldap_upgrade_conn(LDAP *ldap_struct, int *new_version) ;
    739 int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
    740 int smbldap_search(struct smbldap_state *ldap_state,
    741                    const char *base, int scope, const char *filter,
    742                    const char *attrs[], int attrsonly,
    743                    LDAPMessage **res);
    744 int smbldap_search_paged(struct smbldap_state *ldap_state,
    745                          const char *base, int scope, const char *filter,
    746                          const char **attrs, int attrsonly, int pagesize,
    747                          LDAPMessage **res, void **cookie);
    748 int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
    749 int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
    750 int smbldap_delete(struct smbldap_state *ldap_state, const char *dn);
    751 int smbldap_extended_operation(struct smbldap_state *ldap_state,
    752                                LDAP_CONST char *reqoid, struct berval *reqdata,
    753                                LDAPControl **serverctrls, LDAPControl **clientctrls,
    754                                char **retoidp, struct berval **retdatap);
    755 int smbldap_search_suffix (struct smbldap_state *ldap_state,
    756                            const char *filter, const char **search_attr,
    757                            LDAPMessage ** result);
    758 void smbldap_free_struct(struct smbldap_state **ldap_state) ;
    759 NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
    760                       const char *location,
    761                       struct smbldap_state **smbldap_state);
    762 bool smbldap_has_control(LDAP *ld, const char *control);
    763 bool smbldap_has_extension(LDAP *ld, const char *extension);
    764 bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
    765 bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret);
    766 
    767 /* The following definitions come from lib/smbldap_util.c  */
    768 
    769 NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
    770                                     LDAPMessage ** result, const char *domain_name,
    771                                     bool try_add);
     332bool share_access_check(const struct security_token *token,
     333                        const char *sharename,
     334                        uint32 desired_access,
     335                        uint32_t *pgranted);
     336bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_descriptor **ppsd);
    772337
    773338/* The following definitions come from lib/smbrun.c  */
     
    791356void set_current_user_info(const char *smb_name, const char *unix_name,
    792357                           const char *domain);
     358void sub_set_socket_ids(const char *peeraddr, const char *peername,
     359                        const char *sockaddr);
    793360const char *get_current_username(void);
    794361void standard_sub_basic(const char *smb_name, const char *domain_name,
     
    796363char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name,
    797364                       const char *domain_name, const char *str);
    798 char *alloc_sub_basic(const char *smb_name, const char *domain_name,
    799                       const char *str);
    800365char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
    801366                        const char *input_string,
     
    843408int sys_acl_delete_def_file(vfs_handle_struct *handle,
    844409                            const char *path);
    845 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    846                            const char *path_p, SMB_ACL_TYPE_T type);
    847 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    848 int sys_acl_set_file(vfs_handle_struct *handle,
    849                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    850 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    851                    SMB_ACL_T acl_d);
    852 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    853                             const char *path);
    854 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    855                            const char *path_p, SMB_ACL_TYPE_T type);
    856 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    857 int sys_acl_set_file(vfs_handle_struct *handle,
    858                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    859 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    860                    SMB_ACL_T acl_d);
    861 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    862                             const char *path);
    863 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    864                            const char *path_p, SMB_ACL_TYPE_T type);
    865 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    866 int sys_acl_set_file(vfs_handle_struct *handle,
    867                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    868 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    869                    SMB_ACL_T acl_d);
    870 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    871                             const char *path);
    872 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    873                            const char *path_p, SMB_ACL_TYPE_T type);
    874 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    875 int sys_acl_set_file(vfs_handle_struct *handle,
    876                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    877 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    878                    SMB_ACL_T acl_d);
    879 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    880                             const char *path);
    881 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    882                            const char *path_p, SMB_ACL_TYPE_T type);
    883 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    884 int sys_acl_set_file(vfs_handle_struct *handle,
    885                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    886 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    887                    SMB_ACL_T acl_d);
    888 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    889                             const char *path);
    890 SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle,
    891                            const char *path_p, SMB_ACL_TYPE_T type);
    892 SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp);
    893 int sys_acl_set_file(vfs_handle_struct *handle,
    894                      const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
    895 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
    896                    SMB_ACL_T acl_d);
    897 int sys_acl_delete_def_file(vfs_handle_struct *handle,
    898                             const char *path);
    899410int no_acl_syscall_error(int err);
    900411
     
    911422int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
    912423int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp);
     424
     425int sys_get_nfs_quota(const char *path, const char *bdev,
     426                      enum SMB_QUOTA_TYPE qtype,
     427                      unid_t id, SMB_DISK_QUOTA *dp);
     428int sys_set_nfs_quota(const char *path, const char *bdev,
     429                      enum SMB_QUOTA_TYPE qtype,
     430                      unid_t id, SMB_DISK_QUOTA *dp);
    913431
    914432/* The following definitions come from lib/system.c  */
     
    937455int sys_ftruncate(int fd, SMB_OFF_T offset);
    938456int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len);
     457int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len);
    939458SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence);
    940459int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence);
     
    945464void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
    946465SMB_STRUCT_DIR *sys_opendir(const char *name);
     466SMB_STRUCT_DIR *sys_fdopendir(int fd);
    947467SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
    948468void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
     
    960480int sys_getgroups(int setlen, gid_t *gidset);
    961481int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset);
    962 void sys_setpwent(void);
    963 struct passwd *sys_getpwent(void);
    964 void sys_endpwent(void);
    965 struct passwd *sys_getpwnam(const char *name);
    966 struct passwd *sys_getpwuid(uid_t uid);
    967 struct group *sys_getgrnam(const char *name);
    968 struct group *sys_getgrgid(gid_t gid);
    969482int sys_popen(const char *command);
    970483int sys_pclose(int fd);
     
    997510int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb);
    998511int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout);
    999 int sys_getpeereid( int s, uid_t *uid);
    1000 int sys_getnameinfo(const struct sockaddr *psa,
    1001                         socklen_t salen,
    1002                         char *host,
    1003                         size_t hostlen,
    1004                         char *service,
    1005                         size_t servlen,
    1006                         int flags);
    1007 int sys_connect(int fd, const struct sockaddr * addr);
    1008 
    1009512/* The following definitions come from lib/system_smbd.c  */
    1010513
    1011514bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
    1012515                         gid_t primary_gid,
    1013                          gid_t **ret_groups, size_t *p_ngroups);
     516                         gid_t **ret_groups, uint32_t *p_ngroups);
    1014517
    1015518/* The following definitions come from lib/tallocmsg.c  */
     
    1022525void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
    1023526void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
    1024 time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
    1025 time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
    1026 time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
    1027 uint32 convert_time_t_to_uint32(time_t t);
    1028 time_t convert_uint32_to_time_t(uint32 u);
     527uint32_t convert_time_t_to_uint32_t(time_t t);
     528time_t convert_uint32_t_to_time_t(uint32_t u);
    1029529bool nt_time_is_zero(const NTTIME *nt);
    1030530time_t generalized_to_unix_time(const char *str);
     
    1040540void put_long_date(char *p, time_t t);
    1041541void dos_filetime_timespec(struct timespec *tsp);
     542time_t make_unix_date(const void *date_ptr, int zone_offset);
    1042543time_t make_unix_date2(const void *date_ptr, int zone_offset);
    1043544time_t make_unix_date3(const void *date_ptr, int zone_offset);
     
    1045546time_t srv_make_unix_date2(const void *date_ptr);
    1046547time_t srv_make_unix_date3(const void *date_ptr);
    1047 time_t convert_timespec_to_time_t(struct timespec ts);
    1048548struct timespec convert_time_t_to_timespec(time_t t);
    1049549struct timespec convert_timeval_to_timespec(const struct timeval tv);
     
    1056556void round_timespec_to_usec(struct timespec *ts);
    1057557struct timespec interpret_long_date(const char *p);
    1058 void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate);
    1059 void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate);
    1060 void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate);
    1061 time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr);
    1062 time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr);
    1063 time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr);
    1064 bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2);
    1065558void TimeInit(void);
    1066559void get_process_uptime(struct timeval *ret_time);
     560void get_startup_time(struct timeval *ret_time);
    1067561time_t nt_time_to_unix_abs(const NTTIME *nt);
    1068562time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
    1069563void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
    1070564void unix_to_nt_time_abs(NTTIME *nt, time_t t);
    1071 bool null_mtime(time_t mtime);
    1072565const char *time_to_asc(const time_t t);
    1073566const char *display_time(NTTIME nttime);
     
    1076569/* The following definitions come from lib/username.c  */
    1077570
     571void flush_pwnam_cache(void);
    1078572char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
    1079573struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
    1080574
    1081 /* The following definitions come from lib/util.c  */
    1082 
    1083 enum protocol_types get_Protocol(void);
    1084 void set_Protocol(enum protocol_types  p);
    1085 bool all_zero(const uint8_t *ptr, size_t size);
     575/* The following definitions come from lib/util_names.c  */
     576void gfree_netbios_names(void);
    1086577bool set_global_myname(const char *myname);
    1087578const char *global_myname(void);
    1088579bool set_global_myworkgroup(const char *myworkgroup);
    1089580const char *lp_workgroup(void);
     581const char *get_global_sam_name(void);
     582
     583/* The following definitions come from lib/util.c  */
     584
     585enum protocol_types get_Protocol(void);
     586void set_Protocol(enum protocol_types  p);
     587bool all_zero(const uint8_t *ptr, size_t size);
    1090588bool set_global_scope(const char *scope);
    1091589const char *global_scope(void);
     
    1095593bool set_netbios_aliases(const char **str_array);
    1096594bool init_names(void);
    1097 struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
    1098 const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
    1099 void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
    1100                                     const char *username);
    1101 const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
    1102 void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
    1103                                   const char *domain);
    1104 void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
    1105                                     const char *password);
    1106 const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
    1107 bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
    1108                                          const char *arg);
    1109 int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
    1110 void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
    1111                                       bool b);
    1112 bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
    1113 void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
    1114                                         bool b);
    1115 bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
    1116 void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
    1117                                         bool b);
    1118 bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
    1119 void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
    1120 void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
    1121 void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
    1122 bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
    1123 bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
    1124 bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
    1125 struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
    1126                                                  const struct user_auth_info *info);
    1127 bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
    1128 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
    1129595bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf,
    1130596                     bool fake_dir_create_times);
     
    1142608ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos);
    1143609int set_blocking(int fd, bool set);
    1144 void smb_msleep(unsigned int t);
    1145610NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
    1146                        struct event_context *ev_ctx,
    1147                        bool parent_longlived);
    1148 bool yesno(const char *p);
     611                           struct event_context *ev_ctx,
     612                           struct server_id id,
     613                           bool parent_longlived);
    1149614void *malloc_(size_t size);
    1150615void *memalign_array(size_t el_size, size_t align, unsigned int count);
     
    1180645const char *tab_depth(int level, int depth);
    1181646int str_checksum(const char *s);
    1182 unsigned int jenkins_hash(TDB_DATA *key);
    1183647void zero_free(void *p, size_t size);
    1184648int set_maxfiles(int requested_max);
     
    1208672void set_my_vnn(uint32 vnn);
    1209673uint32 get_my_vnn(void);
     674void set_my_unique_id(uint64_t unique_id);
    1210675struct server_id pid_to_procid(pid_t pid);
    1211676struct server_id procid_self(void);
    1212 struct server_id server_id_self(void);
    1213677bool procid_equal(const struct server_id *p1, const struct server_id *p2);
    1214678bool cluster_id_equal(const struct server_id *id1,
     
    1220684bool procid_valid(const struct server_id *pid);
    1221685bool procid_is_local(const struct server_id *pid);
    1222 int this_is_smp(void);
    1223686bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
    1224687bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
     
    1236699void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name);
    1237700void *talloc_zeronull(const void *context, size_t size, const char *name);
    1238 bool is_valid_policy_hnd(const struct policy_handle *hnd);
    1239 bool policy_hnd_equal(const struct policy_handle *hnd1,
    1240                       const struct policy_handle *hnd2);
    1241701const char *strip_hostname(const char *s);
    1242702bool tevent_req_poll_ntstatus(struct tevent_req *req,
    1243703                              struct tevent_context *ev,
    1244704                              NTSTATUS *status);
     705bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
     706int timeval_to_msec(struct timeval t);
     707char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
     708
     709/* The following definitions come from lib/util_cmdline.c  */
     710
     711struct user_auth_info *user_auth_info_init(TALLOC_CTX *mem_ctx);
     712const char *get_cmdline_auth_info_username(const struct user_auth_info *auth_info);
     713void set_cmdline_auth_info_username(struct user_auth_info *auth_info,
     714                                    const char *username);
     715const char *get_cmdline_auth_info_domain(const struct user_auth_info *auth_info);
     716void set_cmdline_auth_info_domain(struct user_auth_info *auth_info,
     717                                  const char *domain);
     718void set_cmdline_auth_info_password(struct user_auth_info *auth_info,
     719                                    const char *password);
     720const char *get_cmdline_auth_info_password(const struct user_auth_info *auth_info);
     721bool set_cmdline_auth_info_signing_state(struct user_auth_info *auth_info,
     722                                         const char *arg);
     723int get_cmdline_auth_info_signing_state(const struct user_auth_info *auth_info);
     724void set_cmdline_auth_info_use_ccache(struct user_auth_info *auth_info,
     725                                      bool b);
     726bool get_cmdline_auth_info_use_ccache(const struct user_auth_info *auth_info);
     727void set_cmdline_auth_info_use_kerberos(struct user_auth_info *auth_info,
     728                                        bool b);
     729bool get_cmdline_auth_info_use_kerberos(const struct user_auth_info *auth_info);
     730void set_cmdline_auth_info_fallback_after_kerberos(struct user_auth_info *auth_info,
     731                                        bool b);
     732bool get_cmdline_auth_info_fallback_after_kerberos(const struct user_auth_info *auth_info);
     733void set_cmdline_auth_info_use_krb5_ticket(struct user_auth_info *auth_info);
     734void set_cmdline_auth_info_smb_encrypt(struct user_auth_info *auth_info);
     735void set_cmdline_auth_info_use_machine_account(struct user_auth_info *auth_info);
     736bool get_cmdline_auth_info_got_pass(const struct user_auth_info *auth_info);
     737bool get_cmdline_auth_info_smb_encrypt(const struct user_auth_info *auth_info);
     738bool get_cmdline_auth_info_use_machine_account(const struct user_auth_info *auth_info);
     739struct user_auth_info *get_cmdline_auth_info_copy(TALLOC_CTX *mem_ctx,
     740                                                 const struct user_auth_info *info);
     741bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_info);
     742void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info);
     743
     744/* The following definitions come from lib/util_builtin.c  */
     745
     746bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
     747bool lookup_builtin_name(const char *name, uint32 *rid);
     748const char *builtin_domain_name(void);
     749bool sid_check_is_builtin(const struct dom_sid *sid);
     750bool sid_check_is_in_builtin(const struct dom_sid *sid);
    1245751
    1246752/* The following definitions come from lib/util_file.c  */
     
    1256762/* The following definitions come from lib/util_nttoken.c  */
    1257763
    1258 NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken);
     764struct security_token *dup_nt_token(TALLOC_CTX *mem_ctx, const struct security_token *ptoken);
    1259765NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx,
    1260                         const struct nt_user_token *token_1,
    1261                         const struct nt_user_token *token_2,
    1262                         struct nt_user_token **token_out);
    1263 bool token_sid_in_ace(const NT_USER_TOKEN *token, const SEC_ACE *ace);
    1264 
    1265 /* The following definitions come from lib/util_pw.c  */
    1266 
    1267 struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ;
    1268 void flush_pwnam_cache(void);
    1269 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name);
    1270 struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ;
    1271 
    1272 /* The following definitions come from lib/util_reg.c  */
    1273 
    1274 const char *reg_type_lookup(enum winreg_Type type);
    1275 bool push_reg_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char *s);
    1276 bool push_reg_multi_sz(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, const char **a);
    1277 bool pull_reg_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char **s);
    1278 bool pull_reg_multi_sz(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, const char ***a);
    1279 
    1280 /* The following definitions come from lib/util_reg_api.c  */
    1281 
    1282 WERROR registry_pull_value(TALLOC_CTX *mem_ctx,
    1283                            struct registry_value **pvalue,
    1284                            enum winreg_Type type, uint8 *data,
    1285                            uint32 size, uint32 length);
    1286 WERROR registry_push_value(TALLOC_CTX *mem_ctx,
    1287                            const struct registry_value *value,
    1288                            DATA_BLOB *presult);
    1289 
    1290 /* The following definitions come from lib/util_seaccess.c  */
    1291 
    1292 void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping);
    1293 void security_acl_map_generic(struct security_acl *sa, const struct generic_mapping *mapping);
    1294 void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
    1295 NTSTATUS se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
    1296                      uint32 acc_desired, uint32 *acc_granted);
    1297 NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size);
     766                        const struct security_token *token_1,
     767                        const struct security_token *token_2,
     768                        struct security_token **token_out);
     769bool token_sid_in_ace(const struct security_token *token, const struct security_ace *ace);
    1298770
    1299771/* The following definitions come from lib/util_sec.c  */
     
    1318790/* The following definitions come from lib/util_sid.c  */
    1319791
    1320 const char *sid_type_lookup(uint32 sid_type) ;
    1321 NT_USER_TOKEN *get_system_token(void) ;
    1322 const char *get_global_sam_name(void) ;
    1323 char *sid_to_fstring(fstring sidstr_out, const DOM_SID *sid);
    1324 char *sid_string_talloc(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
    1325 char *sid_string_dbg(const DOM_SID *sid);
    1326 char *sid_string_tos(const DOM_SID *sid);
    1327 bool string_to_sid(DOM_SID *sidout, const char *sidstr);
    1328 DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr);
    1329 bool sid_append_rid(DOM_SID *sid, uint32 rid);
    1330 bool sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid);
    1331 bool sid_split_rid(DOM_SID *sid, uint32 *rid);
    1332 bool sid_peek_rid(const DOM_SID *sid, uint32 *rid);
    1333 bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *rid);
    1334 void sid_copy(DOM_SID *dst, const DOM_SID *src);
    1335 bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid);
    1336 bool sid_parse(const char *inbuf, size_t len, DOM_SID *sid);
    1337 int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2);
    1338 int sid_compare_domain(const DOM_SID *sid1, const DOM_SID *sid2);
    1339 bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2);
    1340 bool non_mappable_sid(DOM_SID *sid);
    1341 char *sid_binstring(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
    1342 char *sid_binstring_hex(const DOM_SID *sid);
    1343 DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src);
    1344 NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
    1345                           DOM_SID **sids, size_t *num);
    1346 NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
    1347                                  DOM_SID **sids, size_t *num_sids);
    1348 void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num);
    1349 bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx,
    1350                                     uint32 rid, uint32 **pp_rids, size_t *p_num);
    1351 bool is_null_sid(const DOM_SID *sid);
    1352 bool is_sid_in_token(const NT_USER_TOKEN *token, const DOM_SID *sid);
     792char *sid_to_fstring(fstring sidstr_out, const struct dom_sid *sid);
     793char *sid_string_talloc(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
     794char *sid_string_dbg(const struct dom_sid *sid);
     795char *sid_string_tos(const struct dom_sid *sid);
     796bool sid_linearize(char *outbuf, size_t len, const struct dom_sid *sid);
     797bool non_mappable_sid(struct dom_sid *sid);
     798char *sid_binstring_hex(const struct dom_sid *sid);
     799struct netr_SamInfo3;
    1353800NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx,
    1354801                              const struct netr_SamInfo3 *info3,
    1355                               DOM_SID **user_sids,
    1356                               size_t *num_user_sids,
     802                              struct dom_sid **user_sids,
     803                              uint32_t *num_user_sids,
    1357804                              bool include_user_group_rid,
    1358805                              bool skip_ressource_groups);
     
    1363810bool is_loopback_ip_v4(struct in_addr ip);
    1364811bool is_loopback_addr(const struct sockaddr *pss);
    1365 bool is_zero_addr(const struct sockaddr *pss);
     812bool is_zero_addr(const struct sockaddr_storage *pss);
    1366813void zero_ip_v4(struct in_addr *ip);
    1367814void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
     
    1379826char *print_canonical_sockaddr(TALLOC_CTX *ctx,
    1380827                        const struct sockaddr_storage *pss);
    1381 void set_sockaddr_port(struct sockaddr *psa, uint16_t port);
    1382828const char *client_name(int fd);
    1383829int get_socket_port(int fd);
     
    1406852                                          unsigned int timeout,
    1407853                                          size_t *len);
    1408 NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout,
    1409                          size_t *len);
    1410854NTSTATUS receive_smb_raw(int fd,
    1411855                        char *buffer,
     
    1434878                                              int timeout);
    1435879NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
    1436 bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs,
    1437                          int timeout, int *fd_index, int *fd);
    1438880int open_udp_socket(const char *host, int port);
    1439881const char *get_peer_name(int fd, bool force_lookup);
     
    1451893                                    const struct addrinfo *hints);
    1452894int getaddrinfo_recv(struct tevent_req *req, struct addrinfo **res);
     895int poll_one_fd(int fd, int events, int timeout, int *revents);
     896int poll_intr_one_fd(int fd, int events, int timeout, int *revents);
     897struct tstream_context;
    1453898struct tevent_req *tstream_read_packet_send(TALLOC_CTX *mem_ctx,
    1454899                                            struct tevent_context *ev,
     
    1465910
    1466911bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize);
    1467 bool next_token_talloc(TALLOC_CTX *ctx,
    1468                         const char **ptr,
    1469                         char **pp_buff,
    1470                         const char *sep);
    1471 bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx,
    1472                         const char **ptr,
    1473                         char **pp_buff,
    1474                         const char *sep);
    1475912int StrCaseCmp(const char *s, const char *t);
    1476913int StrnCaseCmp(const char *s, const char *t, size_t len);
     
    1544981void strlower_m(char *s);
    1545982void strupper_m(char *s);
    1546 size_t strlen_m_ext(const char *s, const charset_t dst_charset);
    1547 size_t strlen_m_ext_term(const char *s, const charset_t dst_charset);
    1548983size_t strlen_m(const char *s);
    1549984size_t strlen_m_term(const char *s);
    1550985size_t strlen_m_term_null(const char *s);
    1551 char *binary_string_rfc2254(TALLOC_CTX *mem_ctx, const uint8_t *buf, int len);
    1552 char *binary_string(char *buf, int len);
    1553986int fstr_sprintf(fstring s, const char *fmt, ...);
    1554987bool str_list_sub_basic( char **list, const char *smb_name,
    1555988                         const char *domain_name );
    1556989bool str_list_substitute(char **list, const char *pattern, const char *insert);
    1557 bool str_list_check(const char **list, const char *s);
    1558 bool str_list_check_ci(const char **list, const char *s);
    1559990
    1560991char *ipstr_list_make(char **ipstr_list,
     
    1563994int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
    1564995void ipstr_list_free(char* ipstr_list);
    1565 void rfc1738_unescape(char *buf);
    1566996DATA_BLOB base64_decode_data_blob(const char *s);
    1567997void base64_decode_inplace(char *s);
     
    15841014char *escape_shell_string(const char *src);
    15851015char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
     1016char *sanitize_username(TALLOC_CTX *mem_ctx, const char *username);
    15861017
    15871018/* The following definitions come from lib/util_unistr.c  */
     
    15891020void gfree_case_tables(void);
    15901021void load_case_tables(void);
    1591 void init_valid_table(void);
    15921022size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate);
    1593 char *skip_unibuf(char *src, size_t len);
    15941023int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
    15951024int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
    1596 smb_ucs2_t toupper_w(smb_ucs2_t val);
    1597 smb_ucs2_t tolower_w( smb_ucs2_t val );
    1598 bool islower_w(smb_ucs2_t c);
    1599 bool isupper_w(smb_ucs2_t c);
    16001025bool isvalid83_w(smb_ucs2_t c);
    16011026size_t strlen_w(const smb_ucs2_t *src);
     
    16271052smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p);
    16281053smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins);
    1629 int toupper_ascii(int c);
    1630 int tolower_ascii(int c);
    1631 int isupper_ascii(int c);
    1632 int islower_ascii(int c);
    1633 
    1634 /* The following definitions come from lib/util_uuid.c  */
    1635 
    1636 void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr);
    1637 void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu);
    1638 char *guid_binstring(TALLOC_CTX *mem_ctx, const struct GUID *guid);
     1054smb_ucs2_t toupper_w(smb_ucs2_t v);
     1055bool isupper_w(smb_ucs2_t v);
     1056smb_ucs2_t tolower_w(smb_ucs2_t v);
     1057bool islower_w(smb_ucs2_t v);
    16391058
    16401059/* The following definitions come from lib/version.c  */
    16411060
    16421061const char *samba_version_string(void);
    1643 
    1644 /* The following definitions come from lib/winbind_util.c  */
    1645 
    1646 bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid,
    1647                          enum lsa_SidType *name_type);
    1648 bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
    1649                         const char **domain, const char **name,
    1650                         enum lsa_SidType *name_type);
    1651 bool winbind_ping(void);
    1652 bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid);
    1653 bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid);
    1654 bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid);
    1655 bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid);
    1656 struct passwd * winbind_getpwnam(const char * sname);
    1657 struct passwd * winbind_getpwsid(const DOM_SID *sid);
    1658 wbcErr wb_is_trusted_domain(const char *domain);
    1659 bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
    1660                          const DOM_SID *domain_sid,
    1661                          int num_rids, uint32 *rids,
    1662                          const char **domain_name,
    1663                          const char ***names, enum lsa_SidType **types);
    1664 bool winbind_allocate_uid(uid_t *uid);
    1665 bool winbind_allocate_gid(gid_t *gid);
    1666 bool winbind_get_groups(TALLOC_CTX *mem_ctx,
    1667                         const char *account,
    1668                         uint32_t *num_groups,
    1669                         gid_t ** _groups);
    1670 bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
    1671                              const DOM_SID *dom_sid,
    1672                              const DOM_SID *members,
    1673                              size_t num_members,
    1674                              uint32_t **pp_alias_rids,
    1675                              size_t *p_num_alias_rids);
    1676 
    16771062
    16781063/* The following definitions come from lib/wins_srv.c  */
     
    16871072unsigned wins_srv_count_tag(const char *tag);
    16881073
    1689 /* The following definitions come from libads/ads_status.c  */
    1690 
    1691 ADS_STATUS ads_build_error(enum ads_error_type etype,
    1692                            int rc, int minor_status);
    1693 ADS_STATUS ads_build_nt_error(enum ads_error_type etype,
    1694                            NTSTATUS nt_status);
    1695 NTSTATUS ads_ntstatus(ADS_STATUS status);
    1696 const char *ads_errstr(ADS_STATUS status);
    1697 NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min);
    1698 
    1699 /* The following definitions come from libads/ads_struct.c  */
    1700 
    1701 char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse);
    1702 char *ads_build_dn(const char *realm);
    1703 char *ads_build_domain(const char *dn);
    1704 ADS_STRUCT *ads_init(const char *realm,
    1705                      const char *workgroup,
    1706                      const char *ldap_server);
    1707 void ads_destroy(ADS_STRUCT **ads);
    1708 
    1709 const char *ads_get_ldap_server_name(ADS_STRUCT *ads);
    1710 
    1711 /* The following definitions come from libads/authdata.c  */
    1712 
    1713 struct PAC_LOGON_INFO *get_logon_info_from_pac(struct PAC_DATA *pac_data);
    1714 NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
    1715                              const char *name,
    1716                              const char *pass,
    1717                              time_t time_offset,
    1718                              time_t *expire_time,
    1719                              time_t *renew_till_time,
    1720                              const char *cache_name,
    1721                              bool request_pac,
    1722                              bool add_netbios_addr,
    1723                              time_t renewable_time,
    1724                              const char *impersonate_princ_s,
    1725                              struct PAC_DATA **pac_ret);
    1726 NTSTATUS kerberos_return_info3_from_pac(TALLOC_CTX *mem_ctx,
    1727                                         const char *name,
    1728                                         const char *pass,
    1729                                         time_t time_offset,
    1730                                         time_t *expire_time,
    1731                                         time_t *renew_till_time,
    1732                                         const char *cache_name,
    1733                                         bool request_pac,
    1734                                         bool add_netbios_addr,
    1735                                         time_t renewable_time,
    1736                                         const char *impersonate_princ_s,
    1737                                         struct netr_SamInfo3 **info3);
    1738 
    1739 /* The following definitions come from libads/cldap.c  */
    1740 bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
    1741                         const char *server,
    1742                         const char *realm,
    1743                         uint32_t nt_version,
    1744                         struct netlogon_samlogon_response **reply);
    1745 bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
    1746                           const char *server,
    1747                           const char *realm,
    1748                           struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5);
    1749 
    1750 /* The following definitions come from libads/disp_sec.c  */
    1751 
    1752 void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, SEC_DESC *sd);
    1753 
    1754 /* The following definitions come from libads/dns.c  */
    1755 
    1756 NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
    1757                                 const char *dnsdomain,
    1758                                 struct dns_rr_ns **nslist,
    1759                                 int *numns);
    1760 bool sitename_store(const char *realm, const char *sitename);
    1761 char *sitename_fetch(const char *realm);
    1762 bool stored_sitename_changed(const char *realm, const char *sitename);
    1763 NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
    1764                            const char *realm,
    1765                            const char *sitename,
    1766                            struct dns_rr_srv **dclist,
    1767                            int *numdcs );
    1768 NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
    1769                            const char *realm,
    1770                            const char *sitename,
    1771                            struct dns_rr_srv **dclist,
    1772                            int *numdcs );
    1773 NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
    1774                             const char *dns_forest_name,
    1775                             const char *sitename,
    1776                             struct dns_rr_srv **dclist,
    1777                             int *numdcs );
    1778 NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
    1779                            const char *dns_domain_name,
    1780                            struct dns_rr_srv **dclist,
    1781                            int *numdcs );
    1782 NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
    1783                                 const char *dns_forest_name,
    1784                                 const struct GUID *domain_guid,
    1785                                 struct dns_rr_srv **dclist,
    1786                                 int *numdcs );
    1787 
    1788 /* The following definitions come from libads/kerberos.c  */
    1789 
    1790 int kerberos_kinit_password_ext(const char *principal,
    1791                                 const char *password,
    1792                                 int time_offset,
    1793                                 time_t *expire_time,
    1794                                 time_t *renew_till_time,
    1795                                 const char *cache_name,
    1796                                 bool request_pac,
    1797                                 bool add_netbios_addr,
    1798                                 time_t renewable_time,
    1799                                 NTSTATUS *ntstatus);
    1800 int ads_kinit_password(ADS_STRUCT *ads);
    1801 int ads_kdestroy(const char *cc_name);
    1802 char* kerberos_standard_des_salt( void );
    1803 bool kerberos_secrets_store_des_salt( const char* salt );
    1804 char* kerberos_secrets_fetch_des_salt( void );
    1805 char *kerberos_get_default_realm_from_ccache( void );
    1806 char *kerberos_get_realm_from_hostname(const char *hostname);
    1807 
    1808 bool kerberos_secrets_store_salting_principal(const char *service,
    1809                                               int enctype,
    1810                                               const char *principal);
    1811 int kerberos_kinit_password(const char *principal,
    1812                             const char *password,
    1813                             int time_offset,
    1814                             const char *cache_name);
    1815 bool create_local_private_krb5_conf_for_domain(const char *realm,
    1816                                                 const char *domain,
    1817                                                 const char *sitename,
    1818                                                 struct sockaddr_storage *pss,
    1819                                                 const char *kdc_name);
    1820 
    1821 /* The following definitions come from libads/kerberos_keytab.c  */
    1822 
    1823 int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc);
    1824 int ads_keytab_flush(ADS_STRUCT *ads);
    1825 int ads_keytab_create_default(ADS_STRUCT *ads);
    1826 int ads_keytab_list(const char *keytab_name);
    1827 
    1828 /* The following definitions come from libads/kerberos_verify.c  */
    1829 
    1830 NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx,
    1831                            const char *realm,
    1832                            time_t time_offset,
    1833                            const DATA_BLOB *ticket,
    1834                            char **principal,
    1835                            struct PAC_DATA **pac_data,
    1836                            DATA_BLOB *ap_rep,
    1837                            DATA_BLOB *session_key,
    1838                            bool use_replay_cache);
    1839 
    1840 /* The following definitions come from libads/krb5_errs.c  */
    1841 
    1842 
    1843 /* The following definitions come from libads/krb5_setpw.c  */
    1844 
    1845 ADS_STATUS ads_krb5_set_password(const char *kdc_host, const char *princ,
    1846                                  const char *newpw, int time_offset);
    1847 ADS_STATUS kerberos_set_password(const char *kpasswd_server,
    1848                                  const char *auth_principal, const char *auth_password,
    1849                                  const char *target_principal, const char *new_password,
    1850                                  int time_offset);
    1851 ADS_STATUS ads_set_machine_password(ADS_STRUCT *ads,
    1852                                     const char *machine_account,
    1853                                     const char *password);
    1854 
    1855 /* The following definitions come from libads/ldap.c  */
    1856 
    1857 bool ads_sitename_match(ADS_STRUCT *ads);
    1858 bool ads_closest_dc(ADS_STRUCT *ads);
    1859 ADS_STATUS ads_connect(ADS_STRUCT *ads);
    1860 ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads);
    1861 ADS_STATUS ads_connect_gc(ADS_STRUCT *ads);
    1862 void ads_disconnect(ADS_STRUCT *ads);
    1863 ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
    1864                                 int scope, const char *expr, const char **attrs,
    1865                                 bool (*fn)(ADS_STRUCT *, char *, void **, void *),
    1866                                 void *data_area);
    1867 char *ads_parent_dn(const char *dn);
    1868 ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
    1869 ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods,
    1870                        const char *name, const char *val);
    1871 ADS_STATUS ads_mod_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
    1872                            const char *name, const char **vals);
    1873 ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods);
    1874 ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods);
    1875 ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn);
    1876 char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit);
    1877 char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid);
    1878 ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods,
    1879                                 const char *name, const char **vals);
    1880 uint32 ads_get_kvno(ADS_STRUCT *ads, const char *account_name);
    1881 uint32_t ads_get_machine_kvno(ADS_STRUCT *ads, const char *machine_name);
    1882 ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machine_name);
    1883 ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_name,
    1884                                           const char *my_fqdn, const char *spn);
    1885 ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, const char *machine_name,
    1886                                    const char *org_unit);
    1887 ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name,
    1888                                  const char *org_unit, bool *moved);
    1889 int ads_count_replies(ADS_STRUCT *ads, void *res);
    1890 ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn);
    1891 ADS_STATUS ads_current_time(ADS_STRUCT *ads);
    1892 ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val);
    1893 ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid);
    1894 ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name);
    1895 ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn);
    1896 ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffixes, size_t *num_suffixes);
    1897 ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
    1898                                 TALLOC_CTX *mem_ctx,
    1899                                 char ***ous,
    1900                                 size_t *num_ous);
    1901 ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
    1902                                         const char *extended_dn,
    1903                                         enum ads_extended_dn_flags flags,
    1904                                         DOM_SID *sid);
    1905 char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
    1906 char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
    1907 char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name );
    1908 ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name,
    1909                         uint32 account_type, const char *org_unit);
    1910 ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname);
    1911 ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads,
    1912                                TALLOC_CTX *mem_ctx,
    1913                                const char *samaccountname,
    1914                                uint32 *uac_ret,
    1915                                const char **dn_ret);
    1916 ADS_STATUS ads_config_path(ADS_STRUCT *ads,
    1917                            TALLOC_CTX *mem_ctx,
    1918                            char **config_path);
    1919 const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
    1920                                                 const char *config_path,
    1921                                                 TALLOC_CTX *mem_ctx,
    1922                                                 const struct GUID *rights_guid);
    1923 ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
    1924                            ADS_STRUCT *ads,
    1925                            const char **account_ou);
    1926 
    1927 /* The following definitions come from libads/ldap_printer.c  */
    1928 
    1929 ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn,
    1930                                  TALLOC_CTX *ctx, const ADS_MODLIST *mods);
    1931 ADS_STATUS ads_add_printer_entry(ADS_STRUCT *ads, char *prt_dn,
    1932                                         TALLOC_CTX *ctx, ADS_MODLIST *mods);
    1933 WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli,
    1934                                           TALLOC_CTX *mem_ctx,
    1935                                           ADS_MODLIST *mods,
    1936                                           const char *printer);
    1937 bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx,
    1938                                        ADS_MODLIST *mods,
    1939                                        NT_PRINTER_DATA *data);
    1940 
    1941 /* The following definitions come from libads/ldap_schema.c  */
    1942 
    1943 ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
    1944                                      const char *schema_path,
    1945                                      const char **OIDs, size_t num_OIDs,
    1946                                      char ***OIDs_out, char ***names, size_t *count);
    1947 const char *ads_get_attrname_by_guid(ADS_STRUCT *ads,
    1948                                      const char *schema_path,
    1949                                      TALLOC_CTX *mem_ctx,
    1950                                      const struct GUID *schema_guid);
    1951 const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID);
    1952 ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path);
    1953 ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx,
    1954                                           ADS_STRUCT *ads,
    1955                                           enum wb_posix_mapping map_type,
    1956                                           struct posix_schema **s ) ;
    1957 
    1958 /* The following definitions come from libads/ldap_user.c  */
    1959 
    1960 ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user,
    1961                              const char *container, const char *fullname);
    1962 ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group,
    1963                               const char *container, const char *comment);
    1964 
    1965 /* The following definitions come from libads/ldap_utils.c  */
    1966 
    1967 ADS_STATUS ads_ranged_search(ADS_STRUCT *ads,
    1968                              TALLOC_CTX *mem_ctx,
    1969                              int scope,
    1970                              const char *base,
    1971                              const char *filter,
    1972                              void *args,
    1973                              const char *range_attr,
    1974                              char ***strings,
    1975                              size_t *num_strings);
    1976 ADS_STATUS ads_ranged_search_internal(ADS_STRUCT *ads,
    1977                                       TALLOC_CTX *mem_ctx,
    1978                                       int scope,
    1979                                       const char *base,
    1980                                       const char *filter,
    1981                                       const char **attrs,
    1982                                       void *args,
    1983                                       const char *range_attr,
    1984                                       char ***strings,
    1985                                       size_t *num_strings,
    1986                                       uint32 *first_usn,
    1987                                       int *num_retries,
    1988                                       bool *more_values);
    1989 
    1990 /* The following definitions come from libads/ndr.c  */
    1991 
    1992 void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r);
    1993 void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r);
    1994 
    1995 /* The following definitions come from libads/sasl.c  */
    1996 
    1997 ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads);
    1998 
    1999 /* The following definitions come from libads/sasl_wrapping.c  */
    2000 
    2001 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
    2002                                    const struct ads_saslwrap_ops *ops,
    2003                                    void *private_data);
    2004 ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads,
    2005                                    const struct ads_saslwrap_ops *ops,
    2006                                    void *private_data);
    2007 
    2008 /* The following definitions come from libads/util.c  */
    2009 
    2010 ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_principal);
    2011 ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
    2012                                        char **returned_principal);
    2013 
    2014 /* The following definitions come from libgpo/gpo_filesync.c  */
    2015 
    2016 NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
    2017                        struct cli_state *cli,
    2018                        const char *nt_path,
    2019                        const char *unix_path);
    2020 NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx,
    2021                               struct cli_state *cli,
    2022                               const char *nt_path,
    2023                               const char *local_path);
    2024 
    2025 /* The following definitions come from libgpo/gpo_ini.c  */
    2026 
    2027 NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx,
    2028                        const char *filename,
    2029                        uint32_t *version,
    2030                        char **display_name);
    2031 
    2032 /* The following definitions come from libgpo/gpo_reg.c  */
    2033 
    2034 struct nt_user_token *registry_create_system_token(TALLOC_CTX *mem_ctx);
    2035 WERROR gp_init_reg_ctx(TALLOC_CTX *mem_ctx,
    2036                        const char *initial_path,
    2037                        uint32_t desired_access,
    2038                        const struct nt_user_token *token,
    2039                        struct gp_registry_context **reg_ctx);
    2040 void gp_free_reg_ctx(struct gp_registry_context *reg_ctx);
    2041 WERROR gp_store_reg_subkey(TALLOC_CTX *mem_ctx,
    2042                            const char *subkeyname,
    2043                            struct registry_key *curr_key,
    2044                            struct registry_key **new_key);
    2045 WERROR gp_read_reg_subkey(TALLOC_CTX *mem_ctx,
    2046                           struct gp_registry_context *reg_ctx,
    2047                           const char *subkeyname,
    2048                           struct registry_key **key);
    2049 WERROR gp_store_reg_val_sz(TALLOC_CTX *mem_ctx,
    2050                            struct registry_key *key,
    2051                            const char *val_name,
    2052                            const char *val);
    2053 WERROR gp_read_reg_val_sz(TALLOC_CTX *mem_ctx,
    2054                           struct registry_key *key,
    2055                           const char *val_name,
    2056                           const char **val);
    2057 WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx,
    2058                           uint32_t flags,
    2059                           const char *dn,
    2060                           const struct nt_user_token *token,
    2061                           struct GROUP_POLICY_OBJECT *gpo_list);
    2062 WERROR gp_reg_state_read(TALLOC_CTX *mem_ctx,
    2063                          uint32_t flags,
    2064                          const DOM_SID *sid,
    2065                          struct GROUP_POLICY_OBJECT **gpo_list);
    2066 WERROR gp_secure_key(TALLOC_CTX *mem_ctx,
    2067                      uint32_t flags,
    2068                      struct registry_key *key,
    2069                      const DOM_SID *sid);
    2070 void dump_reg_val(int lvl, const char *direction,
    2071                   const char *key, const char *subkey,
    2072                   struct registry_value *val);
    2073 void dump_reg_entry(uint32_t flags,
    2074                     const char *dir,
    2075                     struct gp_registry_entry *entry);
    2076 void dump_reg_entries(uint32_t flags,
    2077                       const char *dir,
    2078                       struct gp_registry_entry *entries,
    2079                       size_t num_entries);
    2080 bool add_gp_registry_entry_to_array(TALLOC_CTX *mem_ctx,
    2081                                     struct gp_registry_entry *entry,
    2082                                     struct gp_registry_entry **entries,
    2083                                     size_t *num);
    2084 WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx,
    2085                                 struct registry_key *root_key,
    2086                                 struct gp_registry_context *reg_ctx,
    2087                                 struct gp_registry_entry *entry,
    2088                                 const struct nt_user_token *token,
    2089                                 uint32_t flags);
    2090 
    2091 
    2092 #include "librpc/gen_ndr/ndr_dfs.h"
    2093 #include "librpc/gen_ndr/ndr_dssetup.h"
    2094 #include "librpc/gen_ndr/ndr_echo.h"
    2095 #include "librpc/gen_ndr/ndr_eventlog.h"
    2096 #include "librpc/gen_ndr/ndr_krb5pac.h"
    2097 #include "librpc/gen_ndr/ndr_lsa.h"
    2098 #include "librpc/gen_ndr/ndr_misc.h"
    2099 #include "librpc/gen_ndr/ndr_netlogon.h"
    2100 #include "librpc/gen_ndr/ndr_notify.h"
    2101 #include "librpc/gen_ndr/ndr_ntsvcs.h"
    2102 #include "librpc/gen_ndr/ndr_samr.h"
    2103 #include "librpc/gen_ndr/ndr_security.h"
    2104 #include "librpc/gen_ndr/ndr_srvsvc.h"
    2105 #include "librpc/gen_ndr/ndr_svcctl.h"
    2106 #include "librpc/gen_ndr/ndr_winreg.h"
    2107 #include "librpc/gen_ndr/ndr_wkssvc.h"
    2108 #include "librpc/gen_ndr/ndr_drsuapi.h"
    2109 #include "librpc/gen_ndr/ndr_spoolss.h"
    2110 #include "librpc/gen_ndr/ndr_initshutdown.h"
    2111 
    2112 #include "librpc/ndr/libndr.h"
    2113 
    2114 /* The following definitions come from librpc/ndr/util.c  */
    2115 
    2116 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
    2117 enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
    2118 void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
    2119 enum ndr_err_code ndr_push_file_id(struct ndr_push *ndr, int ndr_flags, const struct file_id *r);
    2120 enum ndr_err_code ndr_pull_file_id(struct ndr_pull *ndr, int ndr_flags, struct file_id *r);
    2121 void ndr_print_file_id(struct ndr_print *ndr, const char *name, const struct file_id *r);
    2122 _PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
    2123 _PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
    2124 const char *ndr_errstr(enum ndr_err_code err);
    2125 extern const struct ndr_syntax_id null_ndr_syntax_id;
    2126 
    2127 /* The following definitions come from librpc/ndr/sid.c  */
    2128 
    2129 char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
    2130 
    2131 /* The following definitions come from librpc/rpc/binding.c  */
    2132 
    2133 const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
    2134 _PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b);
    2135 _PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out);
    2136 _PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,
    2137                                             struct ndr_syntax_id *syntax);
    2138 const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
    2139 enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot);
    2140 _PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(const struct epm_tower *tower);
    2141 _PUBLIC_ const char *derpc_transport_string_by_transport(enum dcerpc_transport_t t);
    2142 _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
    2143                                    struct epm_tower *tower,
    2144                                    struct dcerpc_binding **b_out);
    2145 _PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx,
    2146                                              const struct dcerpc_binding *binding,
    2147                                              struct epm_tower *tower);
    2148 
    2149 /* The following definitions come from librpc/rpc/dcerpc.c  */
    2150 
    2151 struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, const struct GUID *object,
    2152                                             const struct ndr_interface_table *table, uint32_t opnum,
    2153                                             TALLOC_CTX *mem_ctx, void *r);
    2154 NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req);
    2155 _PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe **pp,
    2156                                       const char *binding_string, const struct ndr_interface_table *table,
    2157                                       struct cli_credentials *credentials, struct event_context *ev,
    2158                                       struct loadparm_context *lp_ctx);
    2159 
    2160 /* The following definitions come from libsmb/cliconnect.c  */
    2161 
    2162 ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user,
    2163                               const char *pass, const char *user_domain,
    2164                                     const char * dest_realm);
    2165 
    2166 NTSTATUS cli_session_setup(struct cli_state *cli,
    2167                            const char *user,
    2168                            const char *pass, int passlen,
    2169                            const char *ntpass, int ntpasslen,
    2170                            const char *workgroup);
    2171 struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
    2172                                                   struct event_context *ev,
    2173                                                   struct cli_state *cli,
    2174                                                   struct tevent_req **psmbreq);
    2175 struct tevent_req *cli_session_setup_guest_send(TALLOC_CTX *mem_ctx,
    2176                                                 struct event_context *ev,
    2177                                                 struct cli_state *cli);
    2178 NTSTATUS cli_session_setup_guest_recv(struct tevent_req *req);
    2179 bool cli_ulogoff(struct cli_state *cli);
    2180 struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
    2181                                         struct event_context *ev,
    2182                                         struct cli_state *cli,
    2183                                         const char *share, const char *dev,
    2184                                         const char *pass, int passlen,
    2185                                         struct tevent_req **psmbreq);
    2186 struct tevent_req *cli_tcon_andx_send(TALLOC_CTX *mem_ctx,
    2187                                       struct event_context *ev,
    2188                                       struct cli_state *cli,
    2189                                       const char *share, const char *dev,
    2190                                       const char *pass, int passlen);
    2191 NTSTATUS cli_tcon_andx_recv(struct tevent_req *req);
    2192 NTSTATUS cli_tcon_andx(struct cli_state *cli, const char *share,
    2193                        const char *dev, const char *pass, int passlen);
    2194 bool cli_tdis(struct cli_state *cli);
    2195 void cli_negprot_sendsync(struct cli_state *cli);
    2196 NTSTATUS cli_negprot(struct cli_state *cli);
    2197 struct tevent_req *cli_negprot_send(TALLOC_CTX *mem_ctx,
    2198                                     struct event_context *ev,
    2199                                     struct cli_state *cli);
    2200 NTSTATUS cli_negprot_recv(struct tevent_req *req);
    2201 bool cli_session_request(struct cli_state *cli,
    2202                          struct nmb_name *calling, struct nmb_name *called);
    2203 NTSTATUS cli_connect(struct cli_state *cli,
    2204                 const char *host,
    2205                 struct sockaddr_storage *dest_ss);
    2206 NTSTATUS cli_start_connection(struct cli_state **output_cli,
    2207                               const char *my_name,
    2208                               const char *dest_host,
    2209                               struct sockaddr_storage *dest_ss, int port,
    2210                               int signing_state, int flags,
    2211                               bool *retry) ;
    2212 NTSTATUS cli_full_connection(struct cli_state **output_cli,
    2213                              const char *my_name,
    2214                              const char *dest_host,
    2215                              struct sockaddr_storage *dest_ss, int port,
    2216                              const char *service, const char *service_type,
    2217                              const char *user, const char *domain,
    2218                              const char *password, int flags,
    2219                              int signing_state,
    2220                              bool *retry) ;
    2221 bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost,
    2222                                      struct sockaddr_storage *pdest_ss);
    2223 NTSTATUS cli_raw_tcon(struct cli_state *cli,
    2224                       const char *service, const char *pass, const char *dev,
    2225                       uint16 *max_xmit, uint16 *tid);
    2226 struct cli_state *get_ipc_connect(char *server,
    2227                                 struct sockaddr_storage *server_ss,
    2228                                 const struct user_auth_info *user_info);
    2229 struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
    2230                                 struct ip_service *mb_ip,
    2231                                 const struct user_auth_info *user_info,
    2232                                 char **pp_workgroup_out);
    2233 struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
    2234                                         const struct user_auth_info *user_info,
    2235                                         char **pp_workgroup_out);
    2236 
    2237 /* The following definitions come from libsmb/clidfs.c  */
    2238 
    2239 NTSTATUS cli_cm_force_encryption(struct cli_state *c,
    2240                         const char *username,
    2241                         const char *password,
    2242                         const char *domain,
    2243                         const char *sharename);
    2244 struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
    2245                                 struct cli_state *referring_cli,
    2246                                 const char *server,
    2247                                 const char *share,
    2248                                 const struct user_auth_info *auth_info,
    2249                                 bool show_hdr,
    2250                                 bool force_encrypt,
    2251                                 int max_protocol,
    2252                                 int port,
    2253                                 int name_type);
    2254 void cli_cm_display(const struct cli_state *c);
    2255 bool cli_dfs_get_referral(TALLOC_CTX *ctx,
    2256                         struct cli_state *cli,
    2257                         const char *path,
    2258                         CLIENT_DFS_REFERRAL**refs,
    2259                         size_t *num_refs,
    2260                         size_t *consumed);
    2261 bool cli_resolve_path(TALLOC_CTX *ctx,
    2262                         const char *mountpt,
    2263                         const struct user_auth_info *dfs_auth_info,
    2264                         struct cli_state *rootcli,
    2265                         const char *path,
    2266                         struct cli_state **targetcli,
    2267                         char **pp_targetpath);
    2268 
    2269 bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
    2270                         struct cli_state *cli,
    2271                         const char *sharename,
    2272                         char **pp_newserver,
    2273                         char **pp_newshare,
    2274                         bool force_encrypt,
    2275                         const char *username,
    2276                         const char *password,
    2277                         const char *domain);
    2278 /* The following definitions come from libsmb/clidgram.c  */
    2279 
    2280 bool send_getdc_request(TALLOC_CTX *mem_ctx,
    2281                         struct messaging_context *msg_ctx,
    2282                         struct sockaddr_storage *dc_ss,
    2283                         const char *domain_name,
    2284                         const DOM_SID *sid,
    2285                         uint32_t nt_version);
    2286 bool receive_getdc_response(TALLOC_CTX *mem_ctx,
    2287                             struct sockaddr_storage *dc_ss,
    2288                             const char *domain_name,
    2289                             uint32_t *nt_version,
    2290                             const char **dc_name,
    2291                             struct netlogon_samlogon_response **reply);
    2292 
    2293 /* The following definitions come from libsmb/clientgen.c  */
    2294 
    2295 int cli_set_message(char *buf,int num_words,int num_bytes,bool zero);
    2296 unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout);
    2297 void cli_set_port(struct cli_state *cli, int port);
    2298 bool cli_state_seqnum_persistent(struct cli_state *cli,
    2299                                  uint16_t mid);
    2300 bool cli_state_seqnum_remove(struct cli_state *cli,
    2301                              uint16_t mid);
    2302 bool cli_receive_smb(struct cli_state *cli);
    2303 ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len);
    2304 bool cli_receive_smb_readX_header(struct cli_state *cli);
    2305 bool cli_send_smb(struct cli_state *cli);
    2306 bool cli_send_smb_direct_writeX(struct cli_state *cli,
    2307                                 const char *p,
    2308                                 size_t extradata);
    2309 void cli_setup_packet_buf(struct cli_state *cli, char *buf);
    2310 void cli_setup_packet(struct cli_state *cli);
    2311 void cli_setup_bcc(struct cli_state *cli, void *p);
    2312 NTSTATUS cli_set_domain(struct cli_state *cli, const char *domain);
    2313 NTSTATUS cli_set_username(struct cli_state *cli, const char *username);
    2314 NTSTATUS cli_set_password(struct cli_state *cli, const char *password);
    2315 NTSTATUS cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password);
    2316 struct cli_state *cli_initialise(void);
    2317 struct cli_state *cli_initialise_ex(int signing_state);
    2318 void cli_nt_pipes_close(struct cli_state *cli);
    2319 void cli_shutdown(struct cli_state *cli);
    2320 void cli_sockopt(struct cli_state *cli, const char *options);
    2321 uint16 cli_setpid(struct cli_state *cli, uint16 pid);
    2322 bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
    2323 bool cli_send_keepalive(struct cli_state *cli);
    2324 struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    2325                                  struct cli_state *cli, uint16_t num_echos,
    2326                                  DATA_BLOB data);
    2327 NTSTATUS cli_echo_recv(struct tevent_req *req);
    2328 NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data);
    2329 bool cli_ucs2(struct cli_state *cli);
    2330 bool is_andx_req(uint8_t cmd);
    2331 
    2332 /* The following definitions come from libsmb/clierror.c  */
    2333 
    2334 const char *cli_errstr(struct cli_state *cli);
    2335 NTSTATUS cli_nt_error(struct cli_state *cli);
    2336 void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode);
    2337 int cli_errno(struct cli_state *cli);
    2338 bool cli_is_error(struct cli_state *cli);
    2339 bool cli_is_nt_error(struct cli_state *cli);
    2340 bool cli_is_dos_error(struct cli_state *cli);
    2341 NTSTATUS cli_get_nt_error(struct cli_state *cli);
    2342 void cli_set_nt_error(struct cli_state *cli, NTSTATUS status);
    2343 void cli_reset_error(struct cli_state *cli);
    2344 bool cli_state_is_connected(struct cli_state *cli);
    2345 
    2346 /* The following definitions come from libsmb/clifile.c  */
    2347 
    2348 struct tevent_req *cli_posix_symlink_send(TALLOC_CTX *mem_ctx,
    2349                                         struct event_context *ev,
    2350                                         struct cli_state *cli,
    2351                                         const char *oldname,
    2352                                         const char *newname);
    2353 NTSTATUS cli_posix_symlink_recv(struct tevent_req *req);
    2354 NTSTATUS cli_posix_symlink(struct cli_state *cli,
    2355                         const char *oldname,
    2356                         const char *newname);
    2357 struct tevent_req *cli_posix_readlink_send(TALLOC_CTX *mem_ctx,
    2358                                         struct event_context *ev,
    2359                                         struct cli_state *cli,
    2360                                         const char *fname,
    2361                                         size_t len);
    2362 NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli,
    2363                                 char *retpath, size_t len);
    2364 NTSTATUS cli_posix_readlink(struct cli_state *cli, const char *fname,
    2365                         char *linkpath, size_t len);
    2366 struct tevent_req *cli_posix_hardlink_send(TALLOC_CTX *mem_ctx,
    2367                                         struct event_context *ev,
    2368                                         struct cli_state *cli,
    2369                                         const char *oldname,
    2370                                         const char *newname);
    2371 NTSTATUS cli_posix_hardlink_recv(struct tevent_req *req);
    2372 NTSTATUS cli_posix_hardlink(struct cli_state *cli,
    2373                         const char *oldname,
    2374                         const char *newname);
    2375 uint32_t unix_perms_to_wire(mode_t perms);
    2376 mode_t wire_perms_to_unix(uint32_t perms);
    2377 struct tevent_req *cli_posix_getfacl_send(TALLOC_CTX *mem_ctx,
    2378                                         struct event_context *ev,
    2379                                         struct cli_state *cli,
    2380                                         const char *fname);
    2381 NTSTATUS cli_posix_getfacl_recv(struct tevent_req *req,
    2382                                 TALLOC_CTX *mem_ctx,
    2383                                 size_t *prb_size,
    2384                                 char **retbuf);
    2385 NTSTATUS cli_posix_getfacl(struct cli_state *cli,
    2386                         const char *fname,
    2387                         TALLOC_CTX *mem_ctx,
    2388                         size_t *prb_size,
    2389                         char **retbuf);
    2390 struct tevent_req *cli_posix_stat_send(TALLOC_CTX *mem_ctx,
    2391                                         struct event_context *ev,
    2392                                         struct cli_state *cli,
    2393                                         const char *fname);
    2394 NTSTATUS cli_posix_stat_recv(struct tevent_req *req,
    2395                                 SMB_STRUCT_STAT *sbuf);
    2396 NTSTATUS cli_posix_stat(struct cli_state *cli,
    2397                         const char *fname,
    2398                         SMB_STRUCT_STAT *sbuf);
    2399 struct tevent_req *cli_posix_chmod_send(TALLOC_CTX *mem_ctx,
    2400                                         struct event_context *ev,
    2401                                         struct cli_state *cli,
    2402                                         const char *fname,
    2403                                         mode_t mode);
    2404 NTSTATUS cli_posix_chmod_recv(struct tevent_req *req);
    2405 NTSTATUS cli_posix_chmod(struct cli_state *cli, const char *fname, mode_t mode);
    2406 struct tevent_req *cli_posix_chown_send(TALLOC_CTX *mem_ctx,
    2407                                         struct event_context *ev,
    2408                                         struct cli_state *cli,
    2409                                         const char *fname,
    2410                                         uid_t uid,
    2411                                         gid_t gid);
    2412 NTSTATUS cli_posix_chown_recv(struct tevent_req *req);
    2413 NTSTATUS cli_posix_chown(struct cli_state *cli,
    2414                         const char *fname,
    2415                         uid_t uid,
    2416                         gid_t gid);
    2417 struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
    2418                                 struct event_context *ev,
    2419                                 struct cli_state *cli,
    2420                                 const char *fname_src,
    2421                                 const char *fname_dst);
    2422 NTSTATUS cli_rename_recv(struct tevent_req *req);
    2423 NTSTATUS cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
    2424 struct tevent_req *cli_ntrename_send(TALLOC_CTX *mem_ctx,
    2425                                 struct event_context *ev,
    2426                                 struct cli_state *cli,
    2427                                 const char *fname_src,
    2428                                 const char *fname_dst);
    2429 NTSTATUS cli_ntrename_recv(struct tevent_req *req);
    2430 NTSTATUS cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst);
    2431 
    2432 struct tevent_req *cli_nt_hardlink_send(TALLOC_CTX *mem_ctx,
    2433                                 struct event_context *ev,
    2434                                 struct cli_state *cli,
    2435                                 const char *fname_src,
    2436                                 const char *fname_dst);
    2437 NTSTATUS cli_nt_hardlink_recv(struct tevent_req *req);
    2438 NTSTATUS cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst);
    2439 
    2440 struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx,
    2441                                 struct event_context *ev,
    2442                                 struct cli_state *cli,
    2443                                 const char *fname,
    2444                                 uint16_t mayhave_attrs);
    2445 NTSTATUS cli_unlink_recv(struct tevent_req *req);
    2446 NTSTATUS cli_unlink(struct cli_state *cli, const char *fname, uint16_t mayhave_attrs);
    2447 
    2448 struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx,
    2449                                   struct event_context *ev,
    2450                                   struct cli_state *cli,
    2451                                   const char *dname);
    2452 NTSTATUS cli_mkdir_recv(struct tevent_req *req);
    2453 NTSTATUS cli_mkdir(struct cli_state *cli, const char *dname);
    2454 struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
    2455                                   struct event_context *ev,
    2456                                   struct cli_state *cli,
    2457                                   const char *dname);
    2458 NTSTATUS cli_rmdir_recv(struct tevent_req *req);
    2459 NTSTATUS cli_rmdir(struct cli_state *cli, const char *dname);
    2460 struct tevent_req *cli_nt_delete_on_close_send(TALLOC_CTX *mem_ctx,
    2461                                         struct event_context *ev,
    2462                                         struct cli_state *cli,
    2463                                         uint16_t fnum,
    2464                                         bool flag);
    2465 NTSTATUS cli_nt_delete_on_close_recv(struct tevent_req *req);
    2466 NTSTATUS cli_nt_delete_on_close(struct cli_state *cli, uint16_t fnum, bool flag);
    2467 struct tevent_req *cli_ntcreate_send(TALLOC_CTX *mem_ctx,
    2468                                      struct event_context *ev,
    2469                                      struct cli_state *cli,
    2470                                      const char *fname,
    2471                                      uint32_t CreatFlags,
    2472                                      uint32_t DesiredAccess,
    2473                                      uint32_t FileAttributes,
    2474                                      uint32_t ShareAccess,
    2475                                      uint32_t CreateDisposition,
    2476                                      uint32_t CreateOptions,
    2477                                      uint8_t SecurityFlags);
    2478 NTSTATUS cli_ntcreate_recv(struct tevent_req *req, uint16_t *pfnum);
    2479 NTSTATUS cli_ntcreate(struct cli_state *cli,
    2480                       const char *fname,
    2481                       uint32_t CreatFlags,
    2482                       uint32_t DesiredAccess,
    2483                       uint32_t FileAttributes,
    2484                       uint32_t ShareAccess,
    2485                       uint32_t CreateDisposition,
    2486                       uint32_t CreateOptions,
    2487                       uint8_t SecurityFlags,
    2488                       uint16_t *pfid);
    2489 uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str,
    2490                             size_t str_len, size_t *pconverted_size);
    2491 struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
    2492                                    struct event_context *ev,
    2493                                    struct cli_state *cli, const char *fname,
    2494                                    int flags, int share_mode,
    2495                                    struct tevent_req **psmbreq);
    2496 struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    2497                                  struct cli_state *cli, const char *fname,
    2498                                  int flags, int share_mode);
    2499 NTSTATUS cli_open_recv(struct tevent_req *req, uint16_t *fnum);
    2500 NTSTATUS cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode, uint16_t *pfnum);
    2501 struct tevent_req *cli_close_create(TALLOC_CTX *mem_ctx,
    2502                                     struct event_context *ev,
    2503                                     struct cli_state *cli, uint16_t fnum,
    2504                                     struct tevent_req **psubreq);
    2505 struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx,
    2506                                   struct event_context *ev,
    2507                                   struct cli_state *cli, uint16_t fnum);
    2508 NTSTATUS cli_close_recv(struct tevent_req *req);
    2509 NTSTATUS cli_close(struct cli_state *cli, uint16_t fnum);
    2510 struct tevent_req *cli_ftruncate_send(TALLOC_CTX *mem_ctx,
    2511                                         struct event_context *ev,
    2512                                         struct cli_state *cli,
    2513                                         uint16_t fnum,
    2514                                         uint64_t size);
    2515 NTSTATUS cli_ftruncate_recv(struct tevent_req *req);
    2516 NTSTATUS cli_ftruncate(struct cli_state *cli, uint16_t fnum, uint64_t size);
    2517 NTSTATUS cli_locktype(struct cli_state *cli, uint16_t fnum,
    2518                       uint32_t offset, uint32_t len,
    2519                       int timeout, unsigned char locktype);
    2520 bool cli_lock(struct cli_state *cli, uint16_t fnum,
    2521               uint32_t offset, uint32_t len, int timeout, enum brl_type lock_type);
    2522 struct tevent_req *cli_unlock_send(TALLOC_CTX *mem_ctx,
    2523                                 struct event_context *ev,
    2524                                 struct cli_state *cli,
    2525                                 uint16_t fnum,
    2526                                 uint64_t offset,
    2527                                 uint64_t len);
    2528 NTSTATUS cli_unlock_recv(struct tevent_req *req);
    2529 NTSTATUS cli_unlock(struct cli_state *cli, uint16_t fnum, uint32_t offset, uint32_t len);
    2530 bool cli_lock64(struct cli_state *cli, uint16_t fnum,
    2531                 uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
    2532 struct tevent_req *cli_unlock64_send(TALLOC_CTX *mem_ctx,
    2533                                 struct event_context *ev,
    2534                                 struct cli_state *cli,
    2535                                 uint16_t fnum,
    2536                                 uint64_t offset,
    2537                                 uint64_t len);
    2538 NTSTATUS cli_unlock64_recv(struct tevent_req *req);
    2539 NTSTATUS cli_unlock64(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
    2540 struct tevent_req *cli_posix_lock_send(TALLOC_CTX *mem_ctx,
    2541                                         struct event_context *ev,
    2542                                         struct cli_state *cli,
    2543                                         uint16_t fnum,
    2544                                         uint64_t offset,
    2545                                         uint64_t len,
    2546                                         bool wait_lock,
    2547                                         enum brl_type lock_type);
    2548 NTSTATUS cli_posix_lock_recv(struct tevent_req *req);
    2549 NTSTATUS cli_posix_lock(struct cli_state *cli, uint16_t fnum,
    2550                         uint64_t offset, uint64_t len,
    2551                         bool wait_lock, enum brl_type lock_type);
    2552 struct tevent_req *cli_posix_unlock_send(TALLOC_CTX *mem_ctx,
    2553                                         struct event_context *ev,
    2554                                         struct cli_state *cli,
    2555                                         uint16_t fnum,
    2556                                         uint64_t offset,
    2557                                         uint64_t len);
    2558 NTSTATUS cli_posix_unlock_recv(struct tevent_req *req);
    2559 NTSTATUS cli_posix_unlock(struct cli_state *cli, uint16_t fnum, uint64_t offset, uint64_t len);
    2560 struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx,
    2561                                 struct event_context *ev,
    2562                                 struct cli_state *cli,
    2563                                 uint16_t fnum);
    2564 NTSTATUS cli_getattrE_recv(struct tevent_req *req,
    2565                         uint16_t *attr,
    2566                         SMB_OFF_T *size,
    2567                         time_t *change_time,
    2568                         time_t *access_time,
    2569                         time_t *write_time);
    2570 NTSTATUS cli_getattrE(struct cli_state *cli,
    2571                         uint16_t fnum,
    2572                         uint16_t *attr,
    2573                         SMB_OFF_T *size,
    2574                         time_t *change_time,
    2575                         time_t *access_time,
    2576                         time_t *write_time);
    2577 struct tevent_req *cli_setattrE_send(TALLOC_CTX *mem_ctx,
    2578                                 struct event_context *ev,
    2579                                 struct cli_state *cli,
    2580                                 uint16_t fnum,
    2581                                 time_t change_time,
    2582                                 time_t access_time,
    2583                                 time_t write_time);
    2584 NTSTATUS cli_setattrE_recv(struct tevent_req *req);
    2585 NTSTATUS cli_setattrE(struct cli_state *cli,
    2586                         uint16_t fnum,
    2587                         time_t change_time,
    2588                         time_t access_time,
    2589                         time_t write_time);
    2590 struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx,
    2591                                 struct event_context *ev,
    2592                                 struct cli_state *cli,
    2593                                 const char *fname);
    2594 NTSTATUS cli_getatr_recv(struct tevent_req *req,
    2595                                 uint16_t *attr,
    2596                                 SMB_OFF_T *size,
    2597                                 time_t *write_time);
    2598 NTSTATUS cli_getatr(struct cli_state *cli,
    2599                         const char *fname,
    2600                         uint16_t *attr,
    2601                         SMB_OFF_T *size,
    2602                         time_t *write_time);
    2603 struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx,
    2604                                 struct event_context *ev,
    2605                                 struct cli_state *cli,
    2606                                 const char *fname,
    2607                                 uint16_t attr,
    2608                                 time_t mtime);
    2609 NTSTATUS cli_setatr_recv(struct tevent_req *req);
    2610 NTSTATUS cli_setatr(struct cli_state *cli,
    2611                 const char *fname,
    2612                 uint16_t attr,
    2613                 time_t mtime);
    2614 struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx,
    2615                                   struct event_context *ev,
    2616                                   struct cli_state *cli,
    2617                                   const char *fname);
    2618 NTSTATUS cli_chkpath_recv(struct tevent_req *req);
    2619 NTSTATUS cli_chkpath(struct cli_state *cli, const char *path);
    2620 struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
    2621                                   struct event_context *ev,
    2622                                   struct cli_state *cli);
    2623 NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
    2624                           int *avail);
    2625 NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
    2626 struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
    2627                                 struct event_context *ev,
    2628                                 struct cli_state *cli,
    2629                                 const char *path);
    2630 NTSTATUS cli_ctemp_recv(struct tevent_req *req,
    2631                         TALLOC_CTX *ctx,
    2632                         uint16_t *pfnum,
    2633                         char **outfile);
    2634 NTSTATUS cli_ctemp(struct cli_state *cli,
    2635                         TALLOC_CTX *ctx,
    2636                         const char *path,
    2637                         uint16_t *pfnum,
    2638                         char **out_path);
    2639 NTSTATUS cli_raw_ioctl(struct cli_state *cli, uint16_t fnum, uint32_t code, DATA_BLOB *blob);
    2640 bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len);
    2641 bool cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum, const char *ea_name, const char *ea_val, size_t ea_len);
    2642 bool cli_get_ea_list_path(struct cli_state *cli, const char *path,
    2643                 TALLOC_CTX *ctx,
    2644                 size_t *pnum_eas,
    2645                 struct ea_struct **pea_list);
    2646 bool cli_get_ea_list_fnum(struct cli_state *cli, uint16_t fnum,
    2647                 TALLOC_CTX *ctx,
    2648                 size_t *pnum_eas,
    2649                 struct ea_struct **pea_list);
    2650 struct tevent_req *cli_posix_open_send(TALLOC_CTX *mem_ctx,
    2651                                         struct event_context *ev,
    2652                                         struct cli_state *cli,
    2653                                         const char *fname,
    2654                                         int flags,
    2655                                         mode_t mode);
    2656 NTSTATUS cli_posix_open_recv(struct tevent_req *req, uint16_t *pfnum);
    2657 NTSTATUS cli_posix_open(struct cli_state *cli, const char *fname,
    2658                         int flags, mode_t mode, uint16_t *fnum);
    2659 struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx,
    2660                                         struct event_context *ev,
    2661                                         struct cli_state *cli,
    2662                                         const char *fname,
    2663                                         mode_t mode);
    2664 NTSTATUS cli_posix_mkdir_recv(struct tevent_req *req);
    2665 NTSTATUS cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode);
    2666 
    2667 struct tevent_req *cli_posix_unlink_send(TALLOC_CTX *mem_ctx,
    2668                                         struct event_context *ev,
    2669                                         struct cli_state *cli,
    2670                                         const char *fname);
    2671 NTSTATUS cli_posix_unlink_recv(struct tevent_req *req);
    2672 NTSTATUS cli_posix_unlink(struct cli_state *cli, const char *fname);
    2673 
    2674 struct tevent_req *cli_posix_rmdir_send(TALLOC_CTX *mem_ctx,
    2675                                         struct event_context *ev,
    2676                                         struct cli_state *cli,
    2677                                         const char *fname);
    2678 NTSTATUS cli_posix_rmdir_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
    2679 NTSTATUS cli_posix_rmdir(struct cli_state *cli, const char *fname);
    2680 struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
    2681                                    struct tevent_context *ev,
    2682                                    struct cli_state *cli, uint16_t fnum,
    2683                                    uint32_t buffer_size,
    2684                                    uint32_t completion_filter, bool recursive);
    2685 NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
    2686                          uint32_t *pnum_changes,
    2687                          struct notify_change **pchanges);
    2688 
    2689 /* The following definitions come from libsmb/clifsinfo.c  */
    2690 
    2691 struct tevent_req *cli_unix_extensions_version_send(TALLOC_CTX *mem_ctx,
    2692                                                     struct tevent_context *ev,
    2693                                                     struct cli_state *cli);
    2694 NTSTATUS cli_unix_extensions_version_recv(struct tevent_req *req,
    2695                                           uint16_t *pmajor, uint16_t *pminor,
    2696                                           uint32_t *pcaplow,
    2697                                           uint32_t *pcaphigh);
    2698 NTSTATUS cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor,
    2699                                      uint16 *pminor, uint32 *pcaplow,
    2700                                      uint32 *pcaphigh);
    2701 bool cli_set_unix_extensions_capabilities(struct cli_state *cli, uint16 major, uint16 minor,
    2702                                         uint32 caplow, uint32 caphigh);
    2703 bool cli_get_fs_attr_info(struct cli_state *cli, uint32 *fs_attr);
    2704 bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number);
    2705 bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate);
    2706 bool cli_get_fs_full_size_info(struct cli_state *cli,
    2707                                uint64_t *total_allocation_units,
    2708                                uint64_t *caller_allocation_units,
    2709                                uint64_t *actual_allocation_units,
    2710                                uint64_t *sectors_per_allocation_unit,
    2711                                uint64_t *bytes_per_sector);
    2712 bool cli_get_posix_fs_info(struct cli_state *cli,
    2713                            uint32 *optimal_transfer_size,
    2714                            uint32 *block_size,
    2715                            uint64_t *total_blocks,
    2716                            uint64_t *blocks_available,
    2717                            uint64_t *user_blocks_available,
    2718                            uint64_t *total_file_nodes,
    2719                            uint64_t *free_file_nodes,
    2720                            uint64_t *fs_identifier);
    2721 NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
    2722                                 const char *user,
    2723                                 const char *pass,
    2724                                 const char *domain);
    2725 NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
    2726 NTSTATUS cli_force_encryption(struct cli_state *c,
    2727                         const char *username,
    2728                         const char *password,
    2729                         const char *domain);
    2730 
    2731 /* The following definitions come from libsmb/clikrb5.c  */
    2732 
    2733 bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx,
    2734                            DATA_BLOB *edata,
    2735                            DATA_BLOB *edata_out);
    2736 bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data);
    2737 
    2738 /* The following definitions come from libsmb/clilist.c  */
    2739 
    2740 int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute,
    2741                  void (*fn)(const char *, file_info *, const char *, void *), void *state);
    2742 int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute,
    2743                  void (*fn)(const char *, file_info *, const char *, void *), void *state);
    2744 int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
    2745              void (*fn)(const char *, file_info *, const char *, void *), void *state);
    2746 
    2747 /* The following definitions come from libsmb/climessage.c  */
    2748 
    2749 struct tevent_req *cli_message_send(TALLOC_CTX *mem_ctx,
    2750                                     struct tevent_context *ev,
    2751                                     struct cli_state *cli,
    2752                                     const char *host, const char *username,
    2753                                     const char *message);
    2754 NTSTATUS cli_message_recv(struct tevent_req *req);
    2755 NTSTATUS cli_message(struct cli_state *cli, const char *host,
    2756                      const char *username, const char *message);
    2757 
    2758 /* The following definitions come from libsmb/clioplock.c  */
    2759 
    2760 struct tevent_req *cli_oplock_ack_send(TALLOC_CTX *mem_ctx,
    2761                                        struct tevent_context *ev,
    2762                                        struct cli_state *cli,
    2763                                        uint16_t fnum, uint8_t level);
    2764 NTSTATUS cli_oplock_ack_recv(struct tevent_req *req);
    2765 NTSTATUS cli_oplock_ack(struct cli_state *cli, uint16_t fnum, unsigned char level);
    2766 void cli_oplock_handler(struct cli_state *cli,
    2767                         NTSTATUS (*handler)(struct cli_state *, uint16_t, unsigned char));
    2768 
    2769 /* The following definitions come from libsmb/cliprint.c  */
    2770 
    2771 int cli_print_queue(struct cli_state *cli,
    2772                     void (*fn)(struct print_job_info *));
    2773 int cli_printjob_del(struct cli_state *cli, int job);
    2774 int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode);
    2775 bool cli_spl_close(struct cli_state *cli, uint16_t fnum);
    2776 
    2777 /* The following definitions come from libsmb/cliquota.c  */
    2778 
    2779 NTSTATUS cli_get_quota_handle(struct cli_state *cli, uint16_t *quota_fnum);
    2780 void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list);
    2781 bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
    2782 bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
    2783 bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list);
    2784 bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
    2785 bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt);
    2786 void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
    2787 void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric));
    2788 
    2789 /* The following definitions come from libsmb/clirap.c  */
    2790 
    2791 bool cli_api(struct cli_state *cli,
    2792              char *param, int prcnt, int mprcnt,
    2793              char *data, int drcnt, int mdrcnt,
    2794              char **rparam, unsigned int *rprcnt,
    2795              char **rdata, unsigned int *rdrcnt);
    2796 bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
    2797 int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state);
    2798 bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
    2799                        void (*fn)(const char *, uint32, const char *, void *),
    2800                        void *state);
    2801 bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
    2802                              const char *old_password);
    2803 bool cli_qpathinfo(struct cli_state *cli,
    2804                         const char *fname,
    2805                         time_t *change_time,
    2806                         time_t *access_time,
    2807                         time_t *write_time,
    2808                         SMB_OFF_T *size,
    2809                         uint16 *mode);
    2810 bool cli_setpathinfo(struct cli_state *cli, const char *fname,
    2811                      time_t create_time,
    2812                      time_t access_time,
    2813                      time_t write_time,
    2814                      time_t change_time,
    2815                      uint16 mode);
    2816 bool cli_qpathinfo2(struct cli_state *cli, const char *fname,
    2817                     struct timespec *create_time,
    2818                     struct timespec *access_time,
    2819                     struct timespec *write_time,
    2820                     struct timespec *change_time,
    2821                     SMB_OFF_T *size, uint16 *mode,
    2822                     SMB_INO_T *ino);
    2823 bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname,
    2824                            TALLOC_CTX *mem_ctx,
    2825                            unsigned int *pnum_streams,
    2826                            struct stream_struct **pstreams);
    2827 bool cli_qfilename(struct cli_state *cli, uint16_t fnum, char *name, size_t namelen);
    2828 bool cli_qfileinfo(struct cli_state *cli, uint16_t fnum,
    2829                    uint16 *mode, SMB_OFF_T *size,
    2830                    struct timespec *create_time,
    2831                    struct timespec *access_time,
    2832                    struct timespec *write_time,
    2833                    struct timespec *change_time,
    2834                    SMB_INO_T *ino);
    2835 bool cli_qpathinfo_basic( struct cli_state *cli, const char *name,
    2836                           SMB_STRUCT_STAT *sbuf, uint32 *attributes );
    2837 bool cli_qfileinfo_test(struct cli_state *cli, uint16_t fnum, int level, char **poutdata, uint32 *poutlen);
    2838 NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name);
    2839 
    2840 /* The following definitions come from libsmb/clirap2.c  */
    2841 
    2842 int cli_NetGroupDelete(struct cli_state *cli, const char *group_name);
    2843 int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 *grinfo);
    2844 int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
    2845 int cli_RNetGroupEnum0(struct cli_state *cli,
    2846                        void (*fn)(const char *, void *),
    2847                        void *state);
    2848 int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name);
    2849 int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name);
    2850 int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state );
    2851 int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state );
    2852 int cli_NetUserDelete(struct cli_state *cli, const char * user_name );
    2853 int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo );
    2854 int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state);
    2855 int cli_RNetUserEnum0(struct cli_state *cli,
    2856                       void (*fn)(const char *, void *),
    2857                       void *state);
    2858 int cli_NetFileClose(struct cli_state *cli, uint32 file_id );
    2859 int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32));
    2860 int cli_NetFileEnum(struct cli_state *cli, const char * user,
    2861                     const char * base_path,
    2862                     void (*fn)(const char *, const char *, uint16, uint16,
    2863                                uint32));
    2864 int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo );
    2865 int cli_NetShareDelete(struct cli_state *cli, const char * share_name );
    2866 bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name);
    2867 bool cli_get_server_domain(struct cli_state *cli);
    2868 bool cli_get_server_type(struct cli_state *cli, uint32 *pstype);
    2869 bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli,
    2870                          char **servername);
    2871 bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype);
    2872 bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation);
    2873 int cli_NetPrintQEnum(struct cli_state *cli,
    2874                 void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
    2875                 void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*));
    2876 int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer,
    2877         void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16),
    2878         void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint_t,uint_t,const char*));
    2879 int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state);
    2880 int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, char *));
    2881 int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation,
    2882                 void (*fn)(const char *, const char *, uint16, uint16, uint16, uint_t, uint_t, uint_t, const char *));
    2883 int cli_NetSessionDel(struct cli_state *cli, const char *workstation);
    2884 int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier,
    2885                         void (*fn)(uint16_t conid, uint16_t contype,
    2886                                 uint16_t numopens, uint16_t numusers,
    2887                                 uint32_t contime, const char *username,
    2888                                 const char *netname));
    2889 
    2890 /* The following definitions come from libsmb/clireadwrite.c  */
    2891 
    2892 struct tevent_req *cli_read_andx_create(TALLOC_CTX *mem_ctx,
    2893                                         struct event_context *ev,
    2894                                         struct cli_state *cli, uint16_t fnum,
    2895                                         off_t offset, size_t size,
    2896                                         struct tevent_req **psmbreq);
    2897 struct tevent_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
    2898                                       struct event_context *ev,
    2899                                       struct cli_state *cli, uint16_t fnum,
    2900                                       off_t offset, size_t size);
    2901 NTSTATUS cli_read_andx_recv(struct tevent_req *req, ssize_t *received,
    2902                             uint8_t **rcvbuf);
    2903 struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
    2904                                  struct event_context *ev,
    2905                                  struct cli_state *cli,
    2906                                  uint16_t fnum, off_t start_offset,
    2907                                  SMB_OFF_T size, size_t window_size,
    2908                                  NTSTATUS (*sink)(char *buf, size_t n,
    2909                                                   void *priv),
    2910                                  void *priv);
    2911 NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received);
    2912 NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum,
    2913                   off_t start_offset, SMB_OFF_T size, size_t window_size,
    2914                   NTSTATUS (*sink)(char *buf, size_t n, void *priv),
    2915                   void *priv, SMB_OFF_T *received);
    2916 ssize_t cli_read(struct cli_state *cli, uint16_t fnum, char *buf,
    2917                  off_t offset, size_t size);
    2918 ssize_t cli_readraw(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size);
    2919 ssize_t cli_write(struct cli_state *cli,
    2920                  uint16_t fnum, uint16 write_mode,
    2921                  const char *buf, off_t offset, size_t size);
    2922 ssize_t cli_smbwrite(struct cli_state *cli,
    2923                      uint16_t fnum, char *buf, off_t offset, size_t size1);
    2924 struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
    2925                                          struct event_context *ev,
    2926                                          struct cli_state *cli, uint16_t fnum,
    2927                                          uint16_t mode, const uint8_t *buf,
    2928                                          off_t offset, size_t size,
    2929                                          struct tevent_req **reqs_before,
    2930                                          int num_reqs_before,
    2931                                          struct tevent_req **psmbreq);
    2932 struct tevent_req *cli_write_andx_send(TALLOC_CTX *mem_ctx,
    2933                                        struct event_context *ev,
    2934                                        struct cli_state *cli, uint16_t fnum,
    2935                                        uint16_t mode, const uint8_t *buf,
    2936                                        off_t offset, size_t size);
    2937 NTSTATUS cli_write_andx_recv(struct tevent_req *req, size_t *pwritten);
    2938 
    2939 struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    2940                                  struct cli_state *cli,
    2941                                  uint16_t fnum, uint16_t mode,
    2942                                  off_t start_offset, size_t window_size,
    2943                                  size_t (*source)(uint8_t *buf, size_t n,
    2944                                                   void *priv),
    2945                                  void *priv);
    2946 NTSTATUS cli_push_recv(struct tevent_req *req);
    2947 NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode,
    2948                   off_t start_offset, size_t window_size,
    2949                   size_t (*source)(uint8_t *buf, size_t n, void *priv),
    2950                   void *priv);
    2951 
    2952 /* The following definitions come from libsmb/clisecdesc.c  */
    2953 
    2954 SEC_DESC *cli_query_secdesc(struct cli_state *cli, uint16_t fnum,
    2955                             TALLOC_CTX *mem_ctx);
    2956 bool cli_set_secdesc(struct cli_state *cli, uint16_t fnum, SEC_DESC *sd);
    2957 
    29581074/* The following definitions come from libsmb/clispnego.c  */
    29591075
    2960 DATA_BLOB spnego_gen_negTokenInit(char guid[16],
    2961                                   const char *OIDs[],
     1076DATA_BLOB spnego_gen_negTokenInit(TALLOC_CTX *ctx,
     1077                                  const char *OIDs[],
     1078                                  DATA_BLOB *psecblob,
    29621079                                  const char *principal);
    2963 DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob);
    2964 bool spnego_parse_negTokenInit(DATA_BLOB blob,
     1080
     1081#ifndef ASN1_MAX_OIDS
     1082#define ASN1_MAX_OIDS 20
     1083#endif
     1084bool spnego_parse_negTokenInit(TALLOC_CTX *ctx,
     1085                               DATA_BLOB blob,
    29651086                               char *OIDs[ASN1_MAX_OIDS],
    2966                                char **principal);
    2967 DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob);
    2968 bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob);
    2969 DATA_BLOB spnego_gen_krb5_wrap(const DATA_BLOB ticket, const uint8 tok_id[2]);
    2970 bool spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
    2971 int spnego_gen_negTokenTarg(const char *principal, int time_offset,
    2972                             DATA_BLOB *targ, 
     1087                               char **principal,
     1088                               DATA_BLOB *secblob);
     1089DATA_BLOB spnego_gen_krb5_wrap(TALLOC_CTX *ctx, const DATA_BLOB ticket, const uint8 tok_id[2]);
     1090bool spnego_parse_krb5_wrap(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]);
     1091int spnego_gen_krb5_negTokenInit(TALLOC_CTX *ctx,
     1092                            const char *principal, int time_offset,
     1093                            DATA_BLOB *targ,
    29731094                            DATA_BLOB *session_key_krb5, uint32 extra_ap_opts,
    29741095                            time_t *expire_time);
    2975 bool spnego_parse_challenge(const DATA_BLOB blob,
     1096bool spnego_parse_challenge(TALLOC_CTX *ctx, const DATA_BLOB blob,
    29761097                            DATA_BLOB *chal1, DATA_BLOB *chal2);
    2977 DATA_BLOB spnego_gen_auth(DATA_BLOB blob);
    2978 bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth);
    2979 DATA_BLOB spnego_gen_auth_response(DATA_BLOB *reply, NTSTATUS nt_status,
     1098DATA_BLOB spnego_gen_auth(TALLOC_CTX *ctx, DATA_BLOB blob);
     1099bool spnego_parse_auth(TALLOC_CTX *ctx, DATA_BLOB blob, DATA_BLOB *auth);
     1100DATA_BLOB spnego_gen_auth_response(TALLOC_CTX *ctx, DATA_BLOB *reply, NTSTATUS nt_status,
    29801101                                   const char *mechOID);
    2981 bool spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status,
     1102bool spnego_parse_auth_response(TALLOC_CTX *ctx,
     1103                                DATA_BLOB blob, NTSTATUS nt_status,
    29821104                                const char *mechOID,
    29831105                                DATA_BLOB *auth);
    29841106
    2985 /* The following definitions come from libsmb/clistr.c  */
    2986 
    2987 size_t clistr_push_fn(const char *function,
    2988                         unsigned int line,
    2989                         struct cli_state *cli,
    2990                         void *dest,
    2991                         const char *src,
    2992                         int dest_len,
    2993                         int flags);
    2994 size_t clistr_pull_fn(const char *function,
    2995                         unsigned int line,
    2996                         const char *inbuf,
    2997                         char *dest,
    2998                         const void *src,
    2999                         int dest_len,
    3000                         int src_len,
    3001                         int flags);
    3002 size_t clistr_pull_talloc_fn(const char *function,
    3003                                 unsigned int line,
    3004                                 TALLOC_CTX *ctx,
    3005                                 const char *inbuf,
    3006                                 char **pp_dest,
    3007                                 const void *src,
    3008                                 int src_len,
    3009                                 int flags);
    3010 size_t clistr_align_out(struct cli_state *cli, const void *p, int flags);
    3011 size_t clistr_align_in(struct cli_state *cli, const void *p, int flags);
    3012 
    3013 /* The following definitions come from libsmb/clitrans.c  */
    3014 
    3015 bool cli_send_trans(struct cli_state *cli, int trans,
    3016                     const char *pipe_name,
    3017                     int fid, int flags,
    3018                     uint16 *setup, unsigned int lsetup, unsigned int msetup,
    3019                     const char *param, unsigned int lparam, unsigned int mparam,
    3020                     const char *data, unsigned int ldata, unsigned int mdata);
    3021 bool cli_receive_trans(struct cli_state *cli,int trans,
    3022                               char **param, unsigned int *param_len,
    3023                               char **data, unsigned int *data_len);
    3024 bool cli_send_nt_trans(struct cli_state *cli,
    3025                        int function,
    3026                        int flags,
    3027                        uint16 *setup, unsigned int lsetup, unsigned int msetup,
    3028                        char *param, unsigned int lparam, unsigned int mparam,
    3029                        char *data, unsigned int ldata, unsigned int mdata);
    3030 bool cli_receive_nt_trans(struct cli_state *cli,
    3031                           char **param, unsigned int *param_len,
    3032                           char **data, unsigned int *data_len);
    3033 struct tevent_req *cli_trans_send(
    3034         TALLOC_CTX *mem_ctx, struct event_context *ev,
    3035         struct cli_state *cli, uint8_t cmd,
    3036         const char *pipe_name, uint16_t fid, uint16_t function, int flags,
    3037         uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
    3038         uint8_t *param, uint32_t num_param, uint32_t max_param,
    3039         uint8_t *data, uint32_t num_data, uint32_t max_data);
    3040 NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
    3041                         uint16_t **setup, uint8_t *num_setup,
    3042                         uint8_t **param, uint32_t *num_param,
    3043                         uint8_t **data, uint32_t *num_data);
    3044 NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
    3045                    uint8_t trans_cmd,
    3046                    const char *pipe_name, uint16_t fid, uint16_t function,
    3047                    int flags,
    3048                    uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
    3049                    uint8_t *param, uint32_t num_param, uint32_t max_param,
    3050                    uint8_t *data, uint32_t num_data, uint32_t max_data,
    3051                    uint16_t **rsetup, uint8_t *num_rsetup,
    3052                    uint8_t **rparam, uint32_t *num_rparam,
    3053                    uint8_t **rdata, uint32_t *num_rdata);
     1107bool spnego_parse_auth_and_mic(TALLOC_CTX *ctx, DATA_BLOB blob,
     1108                                DATA_BLOB *auth, DATA_BLOB *signature);
     1109DATA_BLOB spnego_gen_auth_response_and_mic(TALLOC_CTX *ctx,
     1110                                           NTSTATUS nt_status,
     1111                                           const char *mechOID,
     1112                                           DATA_BLOB *reply,
     1113                                           DATA_BLOB *mechlistMIC);
     1114bool spnego_mech_list_blob(TALLOC_CTX *mem_ctx,
     1115                           char **oid_list, DATA_BLOB *data);
    30541116
    30551117/* The following definitions come from libsmb/conncache.c  */
    30561118
    3057 NTSTATUS check_negative_conn_cache_timeout( const char *domain, const char *server, unsigned int failed_cache_timeout );
    30581119NTSTATUS check_negative_conn_cache( const char *domain, const char *server);
    30591120void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ;
    30601121void flush_negative_conn_cache_for_domain(const char *domain);
    30611122
    3062 /* The following definitions come from ../librpc/rpc/dcerpc_error.c  */
    3063 
    3064 const char *dcerpc_errstr(TALLOC_CTX *mem_ctx, uint32_t fault_code);
    3065 
    30661123/* The following definitions come from libsmb/dsgetdcname.c  */
     1124
     1125struct netr_DsRGetDCNameInfo;
    30671126
    30681127void debug_dsdcinfo_flags(int lvl, uint32_t flags);
     
    30811140NTSTATUS werror_to_ntstatus(WERROR error);
    30821141WERROR ntstatus_to_werror(NTSTATUS error);
    3083 NTSTATUS map_nt_error_from_wbcErr(wbcErr wbc_err);
    30841142NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor);
    30851143
    30861144/* The following definitions come from libsmb/namecache.c  */
    30871145
    3088 bool namecache_enable(void);
    30891146bool namecache_store(const char *name,
    30901147                        int name_type,
     
    31121169bool saf_delete( const char *domain );
    31131170char *saf_fetch( const char *domain );
    3114 NODE_STATUS_STRUCT *node_status_query(int fd,
    3115                                         struct nmb_name *name,
    3116                                         const struct sockaddr_storage *to_ss,
    3117                                         int *num_names,
    3118                                         struct node_status_extra *extra);
     1171struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
     1172                                          struct tevent_context *ev,
     1173                                          struct nmb_name *name,
     1174                                          const struct sockaddr_storage *addr);
     1175NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
     1176                                struct node_status **pnode_status,
     1177                                int *pnum_names,
     1178                                struct node_status_extra *extra);
     1179NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
     1180                           const struct sockaddr_storage *addr,
     1181                           struct node_status **pnode_status,
     1182                           int *pnum_names,
     1183                           struct node_status_extra *extra);
    31191184bool name_status_find(const char *q_name,
    31201185                        int q_type,
     
    31231188                        fstring name);
    31241189int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2);
    3125 struct sockaddr_storage *name_query(int fd,
    3126                         const char *name,
    3127                         int name_type,
    3128                         bool bcast,
    3129                         bool recurse,
    3130                         const struct sockaddr_storage *to_ss,
    3131                         int *count,
    3132                         int *flags,
    3133                         bool *timed_out);
     1190struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
     1191                                   struct tevent_context *ev,
     1192                                   const char *name, int name_type,
     1193                                   bool bcast, bool recurse,
     1194                                   const struct sockaddr_storage *addr);
     1195NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
     1196                         struct sockaddr_storage **addrs, int *num_addrs,
     1197                         uint8_t *flags);
     1198NTSTATUS name_query(const char *name, int name_type,
     1199                    bool bcast, bool recurse,
     1200                    const struct sockaddr_storage *to_ss,
     1201                    TALLOC_CTX *mem_ctx,
     1202                    struct sockaddr_storage **addrs,
     1203                    int *num_addrs, uint8_t *flags);
    31341204NTSTATUS name_resolve_bcast(const char *name,
    31351205                        int name_type,
    3136                         struct ip_service **return_iplist,
     1206                        TALLOC_CTX *mem_ctx,
     1207                        struct sockaddr_storage **return_iplist,
    31371208                        int *return_count);
    31381209NTSTATUS resolve_wins(const char *name,
     
    31741245                struct sockaddr_storage *ss_out);
    31751246
    3176 /* The following definitions come from libsmb/nmblib.c  */
    3177 
    3178 void debug_nmb_packet(struct packet_struct *p);
    3179 void put_name(char *dest, const char *name, int pad, unsigned int name_type);
    3180 char *nmb_namestr(const struct nmb_name *n);
    3181 struct packet_struct *copy_packet(struct packet_struct *packet);
    3182 void free_packet(struct packet_struct *packet);
    3183 struct packet_struct *parse_packet(char *buf,int length,
    3184                                    enum packet_type packet_type,
    3185                                    struct in_addr ip,
    3186                                    int port);
    3187 struct packet_struct *read_packet(int fd,enum packet_type packet_type);
    3188 void make_nmb_name( struct nmb_name *n, const char *name, int type);
    3189 bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
    3190 int build_packet(char *buf, size_t buflen, struct packet_struct *p);
    3191 bool send_packet(struct packet_struct *p);
    3192 struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
    3193 struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id);
    3194 struct packet_struct *receive_dgram_packet(int fd, int t,
    3195                 const char *mailslot_name);
    3196 bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name);
    3197 int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len);
    3198 void sort_query_replies(char *data, int n, struct in_addr ip);
    3199 char *name_mangle(TALLOC_CTX *mem_ctx, const char *In, char name_type);
    3200 int name_extract(unsigned char *buf,size_t buf_len, unsigned int ofs, fstring name);
    3201 int name_len(unsigned char *s1, size_t buf_len);
    3202 
    32031247/* The following definitions come from libsmb/nterr.c  */
    32041248
     
    32101254
    32111255/* The following definitions come from libsmb/ntlmssp.c  */
    3212 
    3213 void debug_ntlmssp_flags(uint32 neg_flags);
    3214 NTSTATUS ntlmssp_set_username(NTLMSSP_STATE *ntlmssp_state, const char *user) ;
    3215 NTSTATUS ntlmssp_set_hashes(NTLMSSP_STATE *ntlmssp_state,
    3216                 const unsigned char lm_hash[16],
    3217                 const unsigned char nt_hash[16]) ;
    3218 NTSTATUS ntlmssp_set_password(NTLMSSP_STATE *ntlmssp_state, const char *password) ;
    3219 NTSTATUS ntlmssp_set_domain(NTLMSSP_STATE *ntlmssp_state, const char *domain) ;
    3220 NTSTATUS ntlmssp_set_workstation(NTLMSSP_STATE *ntlmssp_state, const char *workstation) ;
    3221 NTSTATUS ntlmssp_store_response(NTLMSSP_STATE *ntlmssp_state,
    3222                                 DATA_BLOB response) ;
    3223 void ntlmssp_want_feature_list(NTLMSSP_STATE *ntlmssp_state, char *feature_list);
    3224 void ntlmssp_want_feature(NTLMSSP_STATE *ntlmssp_state, uint32 feature);
    3225 NTSTATUS ntlmssp_update(NTLMSSP_STATE *ntlmssp_state,
     1256struct ntlmssp_state;
     1257NTSTATUS ntlmssp_set_username(struct ntlmssp_state *ntlmssp_state, const char *user) ;
     1258NTSTATUS ntlmssp_set_hashes(struct ntlmssp_state *ntlmssp_state,
     1259                            const uint8_t lm_hash[16],
     1260                            const uint8_t nt_hash[16]) ;
     1261NTSTATUS ntlmssp_set_password(struct ntlmssp_state *ntlmssp_state, const char *password) ;
     1262NTSTATUS ntlmssp_set_domain(struct ntlmssp_state *ntlmssp_state, const char *domain) ;
     1263void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *feature_list);
     1264void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
     1265NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
    32261266                        const DATA_BLOB in, DATA_BLOB *out) ;
    3227 void ntlmssp_end(NTLMSSP_STATE **ntlmssp_state);
    3228 DATA_BLOB ntlmssp_weaken_keys(NTLMSSP_STATE *ntlmssp_state, TALLOC_CTX *mem_ctx);
    3229 NTSTATUS ntlmssp_server_start(NTLMSSP_STATE **ntlmssp_state);
    3230 NTSTATUS ntlmssp_client_start(NTLMSSP_STATE **ntlmssp_state);
    3231 
    3232 /* The following definitions come from libsmb/ntlmssp_sign.c  */
    3233 
    3234 NTSTATUS ntlmssp_sign_packet(NTLMSSP_STATE *ntlmssp_state,
    3235                                     const uchar *data, size_t length,
    3236                                     const uchar *whole_pdu, size_t pdu_length,
    3237                                     DATA_BLOB *sig) ;
    3238 NTSTATUS ntlmssp_check_packet(NTLMSSP_STATE *ntlmssp_state,
    3239                                 const uchar *data, size_t length,
    3240                                 const uchar *whole_pdu, size_t pdu_length,
    3241                                 const DATA_BLOB *sig) ;
    3242 NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state,
    3243                              uchar *data, size_t length,
    3244                              uchar *whole_pdu, size_t pdu_length,
    3245                              DATA_BLOB *sig);
    3246 NTSTATUS ntlmssp_unseal_packet(NTLMSSP_STATE *ntlmssp_state,
    3247                                 uchar *data, size_t length,
    3248                                 uchar *whole_pdu, size_t pdu_length,
    3249                                 DATA_BLOB *sig);
    3250 NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state);
     1267NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
     1268                              bool is_standalone,
     1269                              const char *netbios_name,
     1270                              const char *netbios_domain,
     1271                              const char *dns_name,
     1272                              const char *dns_domain,
     1273                              struct ntlmssp_state **ntlmssp_state);
     1274NTSTATUS ntlmssp_client_start(TALLOC_CTX *mem_ctx,
     1275                              const char *netbios_name,
     1276                              const char *netbios_domain,
     1277                              bool use_ntlmv2,
     1278                              struct ntlmssp_state **_ntlmssp_state);
    32511279
    32521280/* The following definitions come from libsmb/passchange.c  */
     
    32601288bool netsamlogon_cache_init(void);
    32611289bool netsamlogon_cache_shutdown(void);
    3262 void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3);
     1290void netsamlogon_clear_cached_user(const struct dom_sid *user_sid);
    32631291bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3);
    3264 struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const DOM_SID *user_sid);
    3265 bool netsamlogon_cache_have(const DOM_SID *user_sid);
    3266 
    3267 /* The following definitions come from libsmb/smb_seal.c  */
    3268 
    3269 NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num);
    3270 bool common_encryption_on(struct smb_trans_enc_state *es);
    3271 NTSTATUS common_ntlm_decrypt_buffer(NTLMSSP_STATE *ntlmssp_state, char *buf);
    3272 NTSTATUS common_ntlm_encrypt_buffer(NTLMSSP_STATE *ntlmssp_state,
    3273                                 uint16 enc_ctx_num,
    3274                                 char *buf,
    3275                                 char **ppbuf_out);
    3276 NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out);
    3277 NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf);
    3278 void common_free_encryption_state(struct smb_trans_enc_state **pp_es);
    3279 void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf);
    3280 bool cli_encryption_on(struct cli_state *cli);
    3281 void cli_free_encryption_context(struct cli_state *cli);
    3282 void cli_free_enc_buffer(struct cli_state *cli, char *buf);
    3283 NTSTATUS cli_decrypt_message(struct cli_state *cli);
    3284 NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out);
    3285 
    3286 /* The following definitions come from libsmb/clisigning.c  */
    3287 
    3288 bool cli_simple_set_signing(struct cli_state *cli,
    3289                             const DATA_BLOB user_session_key,
    3290                             const DATA_BLOB response);
    3291 bool cli_temp_set_signing(struct cli_state *cli);
    3292 void cli_calculate_sign_mac(struct cli_state *cli, char *buf, uint32_t *seqnum);
    3293 bool cli_check_sign_mac(struct cli_state *cli, const char *buf, uint32_t seqnum);
    3294 bool client_is_signing_on(struct cli_state *cli);
    3295 bool client_is_signing_allowed(struct cli_state *cli);
    3296 bool client_is_signing_mandatory(struct cli_state *cli);
    3297 void cli_set_signing_negotiated(struct cli_state *cli);
    3298 
    3299 /* The following definitions come from smbd/signing.c  */
    3300 
    3301 struct smbd_server_connection;
    3302 bool srv_check_sign_mac(struct smbd_server_connection *conn,
    3303                         const char *inbuf, uint32_t *seqnum);
    3304 void srv_calculate_sign_mac(struct smbd_server_connection *conn,
    3305                             char *outbuf, uint32_t seqnum);
    3306 void srv_cancel_sign_response(struct smbd_server_connection *conn);
    3307 bool srv_init_signing(struct smbd_server_connection *conn);
    3308 void srv_set_signing_negotiated(struct smbd_server_connection *conn);
    3309 bool srv_is_signing_active(struct smbd_server_connection *conn);
    3310 bool srv_is_signing_negotiated(struct smbd_server_connection *conn);
    3311 void srv_set_signing(struct smbd_server_connection *conn,
    3312                      const DATA_BLOB user_session_key,
    3313                      const DATA_BLOB response);
     1292struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const struct dom_sid *user_sid);
     1293bool netsamlogon_cache_have(const struct dom_sid *user_sid);
    33141294
    33151295/* The following definitions come from libsmb/smberr.c  */
     
    33251305bool trustdom_cache_enable(void);
    33261306bool trustdom_cache_shutdown(void);
    3327 bool trustdom_cache_store(char* name, char* alt_name, const DOM_SID *sid,
     1307bool trustdom_cache_store(char* name, char* alt_name, const struct dom_sid *sid,
    33281308                          time_t timeout);
    3329 bool trustdom_cache_fetch(const char* name, DOM_SID* sid);
     1309bool trustdom_cache_fetch(const char* name, struct dom_sid* sid);
    33301310uint32 trustdom_cache_fetch_timestamp( void );
    33311311bool trustdom_cache_store_timestamp( uint32 t, time_t timeout );
     
    33451325bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
    33461326                                     char ***domain_names, uint32 *num_domains,
    3347                                      DOM_SID **sids );
    3348 
    3349 /* The following definitions come from libsmb/unexpected.c  */
    3350 
    3351 void unexpected_packet(struct packet_struct *p);
    3352 void clear_unexpected(time_t t);
    3353 struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
    3354                                          const char *mailslot_name);
    3355 
    3356 /* The following definitions come from locking/brlock.c  */
    3357 
    3358 bool brl_same_context(const struct lock_context *ctx1,
    3359                              const struct lock_context *ctx2);
    3360 NTSTATUS brl_lock_failed(files_struct *fsp, const struct lock_struct *lock, bool blocking_lock);
    3361 void brl_init(bool read_only);
    3362 void brl_shutdown(void);
    3363 
    3364 NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
    3365                 struct lock_struct *plock,
    3366                 bool blocking_lock);
    3367 
    3368 NTSTATUS brl_lock(struct messaging_context *msg_ctx,
    3369                 struct byte_range_lock *br_lck,
    3370                 uint32 smbpid,
    3371                 struct server_id pid,
    3372                 br_off start,
    3373                 br_off size,
    3374                 enum brl_type lock_type,
    3375                 enum brl_flavour lock_flav,
    3376                 bool blocking_lock,
    3377                 uint32 *psmbpid,
    3378                 struct blocking_lock_record *blr);
    3379 bool brl_unlock(struct messaging_context *msg_ctx,
    3380                 struct byte_range_lock *br_lck,
    3381                 uint32 smbpid,
    3382                 struct server_id pid,
    3383                 br_off start,
    3384                 br_off size,
    3385                 enum brl_flavour lock_flav);
    3386 bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
    3387                                struct byte_range_lock *br_lck,
    3388                                const struct lock_struct *plock);
    3389 bool brl_locktest(struct byte_range_lock *br_lck,
    3390                 uint32 smbpid,
    3391                 struct server_id pid,
    3392                 br_off start,
    3393                 br_off size,
    3394                 enum brl_type lock_type,
    3395                 enum brl_flavour lock_flav);
    3396 NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
    3397                 uint32 *psmbpid,
    3398                 struct server_id pid,
    3399                 br_off *pstart,
    3400                 br_off *psize,
    3401                 enum brl_type *plock_type,
    3402                 enum brl_flavour lock_flav);
    3403 bool brl_lock_cancel(struct byte_range_lock *br_lck,
    3404                 uint32 smbpid,
    3405                 struct server_id pid,
    3406                 br_off start,
    3407                 br_off size,
    3408                 enum brl_flavour lock_flav,
    3409                 struct blocking_lock_record *blr);
    3410 bool brl_lock_cancel_default(struct byte_range_lock *br_lck,
    3411                 struct lock_struct *plock);
    3412 void brl_close_fnum(struct messaging_context *msg_ctx,
    3413                     struct byte_range_lock *br_lck);
    3414 int brl_forall(void (*fn)(struct file_id id, struct server_id pid,
    3415                           enum brl_type lock_type,
    3416                           enum brl_flavour lock_flav,
    3417                           br_off start, br_off size,
    3418                           void *private_data),
    3419                void *private_data);
    3420 struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx,
    3421                                         files_struct *fsp);
    3422 struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp);
    3423 void brl_register_msgs(struct messaging_context *msg_ctx);
    3424 
    3425 /* The following definitions come from locking/locking.c  */
    3426 
    3427 const char *lock_type_name(enum brl_type lock_type);
    3428 const char *lock_flav_name(enum brl_flavour lock_flav);
    3429 void init_strict_lock_struct(files_struct *fsp,
    3430                                 uint32 smbpid,
    3431                                 br_off start,
    3432                                 br_off size,
    3433                                 enum brl_type lock_type,
    3434                                 struct lock_struct *plock);
    3435 bool strict_lock_default(files_struct *fsp,
    3436                                 struct lock_struct *plock);
    3437 void strict_unlock_default(files_struct *fsp,
    3438                                 struct lock_struct *plock);
    3439 NTSTATUS query_lock(files_struct *fsp,
    3440                         uint32 *psmbpid,
    3441                         uint64_t *pcount,
    3442                         uint64_t *poffset,
    3443                         enum brl_type *plock_type,
    3444                         enum brl_flavour lock_flav);
    3445 struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
    3446                         files_struct *fsp,
    3447                         uint32 lock_pid,
    3448                         uint64_t count,
    3449                         uint64_t offset,
    3450                         enum brl_type lock_type,
    3451                         enum brl_flavour lock_flav,
    3452                         bool blocking_lock,
    3453                         NTSTATUS *perr,
    3454                         uint32 *plock_pid,
    3455                         struct blocking_lock_record *blr);
    3456 NTSTATUS do_unlock(struct messaging_context *msg_ctx,
    3457                         files_struct *fsp,
    3458                         uint32 lock_pid,
    3459                         uint64_t count,
    3460                         uint64_t offset,
    3461                         enum brl_flavour lock_flav);
    3462 NTSTATUS do_lock_cancel(files_struct *fsp,
    3463                         uint32 lock_pid,
    3464                         uint64_t count,
    3465                         uint64_t offset,
    3466                         enum brl_flavour lock_flav,
    3467                         struct blocking_lock_record *blr);
    3468 void locking_close_file(struct messaging_context *msg_ctx,
    3469                         files_struct *fsp);
    3470 bool locking_init(void);
    3471 bool locking_init_readonly(void);
    3472 bool locking_end(void);
    3473 char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
    3474 struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
    3475                                             const struct file_id id,
    3476                                             const char *servicepath,
    3477                                             const struct smb_filename *smb_fname,
    3478                                             const struct timespec *old_write_time);
    3479 struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,
    3480                                                   const struct file_id id);
    3481 bool rename_share_filename(struct messaging_context *msg_ctx,
    3482                         struct share_mode_lock *lck,
    3483                         const char *servicepath,
    3484                         const struct smb_filename *smb_fname);
    3485 void get_file_infos(struct file_id id,
    3486                     bool *delete_on_close,
    3487                     struct timespec *write_time);
    3488 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
    3489 bool is_deferred_open_entry(const struct share_mode_entry *e);
    3490 bool is_unused_share_mode_entry(const struct share_mode_entry *e);
    3491 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
    3492                     uid_t uid, uint16 mid, uint16 op_type);
    3493 void add_deferred_open(struct share_mode_lock *lck, uint16 mid,
    3494                        struct timeval request_time,
    3495                        struct file_id id);
    3496 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp);
    3497 void del_deferred_open_entry(struct share_mode_lock *lck, uint16 mid);
    3498 bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
    3499 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
    3500 NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode);
    3501 void set_delete_on_close_token(struct share_mode_lock *lck, const UNIX_USER_TOKEN *tok);
    3502 void set_delete_on_close_lck(struct share_mode_lock *lck, bool delete_on_close, const UNIX_USER_TOKEN *tok);
    3503 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const UNIX_USER_TOKEN *tok);
    3504 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
    3505 bool set_write_time(struct file_id fileid, struct timespec write_time);
    3506 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
    3507                                  const char *, void *),
    3508                       void *private_data);
    3509 
    3510 /* The following definitions come from locking/posix.c  */
    3511 
    3512 bool is_posix_locked(files_struct *fsp,
    3513                         uint64_t *pu_offset,
    3514                         uint64_t *pu_count,
    3515                         enum brl_type *plock_type,
    3516                         enum brl_flavour lock_flav);
    3517 bool posix_locking_init(bool read_only);
    3518 bool posix_locking_end(void);
    3519 void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
    3520 int fd_close_posix(struct files_struct *fsp);
    3521 bool set_posix_lock_windows_flavour(files_struct *fsp,
    3522                         uint64_t u_offset,
    3523                         uint64_t u_count,
    3524                         enum brl_type lock_type,
    3525                         const struct lock_context *lock_ctx,
    3526                         const struct lock_struct *plocks,
    3527                         int num_locks,
    3528                         int *errno_ret);
    3529 bool release_posix_lock_windows_flavour(files_struct *fsp,
    3530                                 uint64_t u_offset,
    3531                                 uint64_t u_count,
    3532                                 enum brl_type deleted_lock_type,
    3533                                 const struct lock_context *lock_ctx,
    3534                                 const struct lock_struct *plocks,
    3535                                 int num_locks);
    3536 bool set_posix_lock_posix_flavour(files_struct *fsp,
    3537                         uint64_t u_offset,
    3538                         uint64_t u_count,
    3539                         enum brl_type lock_type,
    3540                         int *errno_ret);
    3541 bool release_posix_lock_posix_flavour(files_struct *fsp,
    3542                                 uint64_t u_offset,
    3543                                 uint64_t u_count,
    3544                                 const struct lock_context *lock_ctx,
    3545                                 const struct lock_struct *plocks,
    3546                                 int num_locks);
    3547 
    3548 /* The following definitions come from modules/vfs_default.c  */
    3549 
    3550 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
    3551 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
    3552 NTSTATUS vfs_default_init(void);
    3553 
    3554 /* The following definitions come from nmbd/asyncdns.c  */
    3555 
    3556 int asyncdns_fd(void);
    3557 void kill_async_dns_child(void);
    3558 void start_async_dns(void);
    3559 void run_dns_queue(void);
    3560 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
    3561 bool queue_dns_query(struct packet_struct *p,struct nmb_name *question);
    3562 void kill_async_dns_child(void);
    3563 
    3564 /* The following definitions come from nmbd/nmbd.c  */
    3565 
    3566 struct event_context *nmbd_event_context(void);
    3567 struct messaging_context *nmbd_messaging_context(void);
    3568 
    3569 /* The following definitions come from nmbd/nmbd_become_dmb.c  */
    3570 
    3571 void add_domain_names(time_t t);
    3572 
    3573 /* The following definitions come from nmbd/nmbd_become_lmb.c  */
    3574 
    3575 void insert_permanent_name_into_unicast( struct subnet_record *subrec,
    3576                                                 struct nmb_name *nmbname, uint16 nb_type );
    3577 void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
    3578                                    bool force_new_election);
    3579 void become_local_master_browser(struct subnet_record *subrec, struct work_record *work);
    3580 void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname);
    3581 
    3582 /* The following definitions come from nmbd/nmbd_browserdb.c  */
    3583 
    3584 void update_browser_death_time( struct browse_cache_record *browc );
    3585 struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name,
    3586                                                          const char *browser_name,
    3587                                                          struct in_addr ip );
    3588 struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name );
    3589 void expire_lmb_browsers( time_t t );
    3590 
    3591 /* The following definitions come from nmbd/nmbd_browsesync.c  */
    3592 
    3593 void dmb_expire_and_sync_browser_lists(time_t t);
    3594 void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
    3595                                                    struct work_record *work);
    3596 void collect_all_workgroup_names_from_wins_server(time_t t);
    3597 void sync_all_dmbs(time_t t);
    3598 
    3599 /* The following definitions come from nmbd/nmbd_elections.c  */
    3600 
    3601 void check_master_browser_exists(time_t t);
    3602 void run_elections(time_t t);
    3603 void process_election(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3604 bool check_elections(void);
    3605 void nmbd_message_election(struct messaging_context *msg,
    3606                            void *private_data,
    3607                            uint32_t msg_type,
    3608                            struct server_id server_id,
    3609                            DATA_BLOB *data);
    3610 
    3611 /* The following definitions come from nmbd/nmbd_incomingdgrams.c  */
    3612 
    3613 void tell_become_backup(void);
    3614 void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3615 void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3616 void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3617 void process_master_browser_announce(struct subnet_record *subrec,
    3618                                      struct packet_struct *p,char *buf);
    3619 void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
    3620 void process_get_backup_list_request(struct subnet_record *subrec,
    3621                                      struct packet_struct *p,char *buf);
    3622 void process_reset_browser(struct subnet_record *subrec,
    3623                                   struct packet_struct *p,char *buf);
    3624 void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf);
    3625 void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len);
    3626 
    3627 /* The following definitions come from nmbd/nmbd_incomingrequests.c  */
    3628 
    3629 void process_name_release_request(struct subnet_record *subrec,
    3630                                   struct packet_struct *p);
    3631 void process_name_refresh_request(struct subnet_record *subrec,
    3632                                   struct packet_struct *p);
    3633 void process_name_registration_request(struct subnet_record *subrec,
    3634                                        struct packet_struct *p);
    3635 void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p);
    3636 void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p);
    3637 
    3638 /* The following definitions come from nmbd/nmbd_lmhosts.c  */
    3639 
    3640 void load_lmhosts_file(const char *fname);
    3641 bool find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp);
    3642 
    3643 /* The following definitions come from nmbd/nmbd_logonnames.c  */
    3644 
    3645 void add_logon_names(void);
    3646 
    3647 /* The following definitions come from nmbd/nmbd_mynames.c  */
    3648 
    3649 void register_my_workgroup_one_subnet(struct subnet_record *subrec);
    3650 bool register_my_workgroup_and_names(void);
    3651 void release_wins_names(void);
    3652 void refresh_my_names(time_t t);
    3653 
    3654 /* The following definitions come from nmbd/nmbd_namelistdb.c  */
    3655 
    3656 void set_samba_nb_type(void);
    3657 void remove_name_from_namelist(struct subnet_record *subrec,
    3658                                 struct name_record *namerec );
    3659 struct name_record *find_name_on_subnet(struct subnet_record *subrec,
    3660                                 const struct nmb_name *nmbname,
    3661                                 bool self_only);
    3662 struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname,
    3663                                                 bool self_only);
    3664 void update_name_ttl( struct name_record *namerec, int ttl );
    3665 bool add_name_to_subnet( struct subnet_record *subrec,
    3666                         const char *name,
    3667                         int type,
    3668                         uint16 nb_flags,
    3669                         int ttl,
    3670                         enum name_source source,
    3671                         int num_ips,
    3672                         struct in_addr *iplist);
    3673 void standard_success_register(struct subnet_record *subrec,
    3674                              struct userdata_struct *userdata,
    3675                              struct nmb_name *nmbname, uint16 nb_flags, int ttl,
    3676                              struct in_addr registered_ip);
    3677 void standard_fail_register( struct subnet_record   *subrec,
    3678                              struct nmb_name        *nmbname );
    3679 bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip );
    3680 void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip );
    3681 void remove_ip_from_name_record( struct name_record *namerec,
    3682                                  struct in_addr      remove_ip );
    3683 void standard_success_release( struct subnet_record   *subrec,
    3684                                struct userdata_struct *userdata,
    3685                                struct nmb_name        *nmbname,
    3686                                struct in_addr          released_ip );
    3687 void expire_names(time_t t);
    3688 void add_samba_names_to_subnet( struct subnet_record *subrec );
    3689 void dump_name_record( struct name_record *namerec, XFILE *fp);
    3690 void dump_all_namelists(void);
    3691 
    3692 /* The following definitions come from nmbd/nmbd_namequery.c  */
    3693 
    3694 bool query_name(struct subnet_record *subrec, const char *name, int type,
    3695                    query_name_success_function success_fn,
    3696                    query_name_fail_function fail_fn,
    3697                    struct userdata_struct *userdata);
    3698 bool query_name_from_wins_server(struct in_addr ip_to,
    3699                    const char *name, int type,
    3700                    query_name_success_function success_fn,
    3701                    query_name_fail_function fail_fn,
    3702                    struct userdata_struct *userdata);
    3703 
    3704 /* The following definitions come from nmbd/nmbd_nameregister.c  */
    3705 
    3706 void register_name(struct subnet_record *subrec,
    3707                    const char *name, int type, uint16 nb_flags,
    3708                    register_name_success_function success_fn,
    3709                    register_name_fail_function fail_fn,
    3710                    struct userdata_struct *userdata);
    3711 void wins_refresh_name(struct name_record *namerec);
    3712 
    3713 /* The following definitions come from nmbd/nmbd_namerelease.c  */
    3714 
    3715 void release_name(struct subnet_record *subrec, struct name_record *namerec,
    3716                   release_name_success_function success_fn,
    3717                   release_name_fail_function fail_fn,
    3718                   struct userdata_struct *userdata);
    3719 
    3720 /* The following definitions come from nmbd/nmbd_nodestatus.c  */
    3721 
    3722 bool node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
    3723                  struct in_addr send_ip, node_status_success_function success_fn,
    3724                  node_status_fail_function fail_fn, struct userdata_struct *userdata);
    3725 
    3726 /* The following definitions come from nmbd/nmbd_packets.c  */
    3727 
    3728 uint16 get_nb_flags(char *buf);
    3729 void set_nb_flags(char *buf, uint16 nb_flags);
    3730 struct response_record *queue_register_name( struct subnet_record *subrec,
    3731                           response_function resp_fn,
    3732                           timeout_response_function timeout_fn,
    3733                           register_name_success_function success_fn,
    3734                           register_name_fail_function fail_fn,
    3735                           struct userdata_struct *userdata,
    3736                           struct nmb_name *nmbname,
    3737                           uint16 nb_flags);
    3738 void queue_wins_refresh(struct nmb_name *nmbname,
    3739                         response_function resp_fn,
    3740                         timeout_response_function timeout_fn,
    3741                         uint16 nb_flags,
    3742                         struct in_addr refresh_ip,
    3743                         const char *tag);
    3744 struct response_record *queue_register_multihomed_name( struct subnet_record *subrec,
    3745                                                         response_function resp_fn,
    3746                                                         timeout_response_function timeout_fn,
    3747                                                         register_name_success_function success_fn,
    3748                                                         register_name_fail_function fail_fn,
    3749                                                         struct userdata_struct *userdata,
    3750                                                         struct nmb_name *nmbname,
    3751                                                         uint16 nb_flags,
    3752                                                         struct in_addr register_ip,
    3753                                                         struct in_addr wins_ip);
    3754 struct response_record *queue_release_name( struct subnet_record *subrec,
    3755                                             response_function resp_fn,
    3756                                             timeout_response_function timeout_fn,
    3757                                             release_name_success_function success_fn,
    3758                                             release_name_fail_function fail_fn,
    3759                                             struct userdata_struct *userdata,
    3760                                             struct nmb_name *nmbname,
    3761                                             uint16 nb_flags,
    3762                                             struct in_addr release_ip,
    3763                                             struct in_addr dest_ip);
    3764 struct response_record *queue_query_name( struct subnet_record *subrec,
    3765                           response_function resp_fn,
    3766                           timeout_response_function timeout_fn,
    3767                           query_name_success_function success_fn,
    3768                           query_name_fail_function fail_fn,
    3769                           struct userdata_struct *userdata,
    3770                           struct nmb_name *nmbname);
    3771 struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip,
    3772                           response_function resp_fn,
    3773                           timeout_response_function timeout_fn,
    3774                           query_name_success_function success_fn,
    3775                           query_name_fail_function fail_fn,
    3776                           struct userdata_struct *userdata,
    3777                           struct nmb_name *nmbname);
    3778 struct response_record *queue_node_status( struct subnet_record *subrec,
    3779                           response_function resp_fn,
    3780                           timeout_response_function timeout_fn,
    3781                           node_status_success_function success_fn,
    3782                           node_status_fail_function fail_fn,
    3783                           struct userdata_struct *userdata,
    3784                           struct nmb_name *nmbname,
    3785                           struct in_addr send_ip);
    3786 void reply_netbios_packet(struct packet_struct *orig_packet,
    3787                           int rcode, enum netbios_reply_type_code rcv_code, int opcode,
    3788                           int ttl, char *data,int len);
    3789 void queue_packet(struct packet_struct *packet);
    3790 void run_packet_queue(void);
    3791 void retransmit_or_expire_response_records(time_t t);
    3792 bool listen_for_packets(bool run_election);
    3793 bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len,
    3794                    const char *srcname, int src_type,
    3795                    const char *dstname, int dest_type,
    3796                    struct in_addr dest_ip,struct in_addr src_ip,
    3797                    int dest_port);
    3798 
    3799 /* The following definitions come from nmbd/nmbd_processlogon.c  */
    3800 
    3801 bool initialize_nmbd_proxy_logon(void);
    3802 
    3803 void process_logon_packet(struct packet_struct *p, char *buf,int len,
    3804                           const char *mailslot);
    3805 
    3806 /* The following definitions come from nmbd/nmbd_responserecordsdb.c  */
    3807 
    3808 void remove_response_record(struct subnet_record *subrec,
    3809                                 struct response_record *rrec);
    3810 struct response_record *make_response_record( struct subnet_record *subrec,
    3811                                               struct packet_struct *p,
    3812                                               response_function resp_fn,
    3813                                               timeout_response_function timeout_fn,
    3814                                               success_function success_fn,
    3815                                               fail_function fail_fn,
    3816                                               struct userdata_struct *userdata);
    3817 struct response_record *find_response_record(struct subnet_record **ppsubrec,
    3818                                 uint16 id);
    3819 bool is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec);
    3820 
    3821 /* The following definitions come from nmbd/nmbd_sendannounce.c  */
    3822 
    3823 void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip);
    3824 void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work);
    3825 void announce_my_server_names(time_t t);
    3826 void announce_my_lm_server_names(time_t t);
    3827 void reset_announce_timer(void);
    3828 void announce_myself_to_domain_master_browser(time_t t);
    3829 void announce_my_servers_removed(void);
    3830 void announce_remote(time_t t);
    3831 void browse_sync_remote(time_t t);
    3832 
    3833 /* The following definitions come from nmbd/nmbd_serverlistdb.c  */
    3834 
    3835 void remove_all_servers(struct work_record *work);
    3836 struct server_record *find_server_in_workgroup(struct work_record *work, const char *name);
    3837 void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec);
    3838 struct server_record *create_server_on_workgroup(struct work_record *work,
    3839                                                  const char *name,int servertype,
    3840                                                  int ttl, const char *comment);
    3841 void update_server_ttl(struct server_record *servrec, int ttl);
    3842 void expire_servers(struct work_record *work, time_t t);
    3843 void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type,
    3844                 const char *local_master_browser_name, const char *description);
    3845 void write_browse_list(time_t t, bool force_write);
    3846 
    3847 /* The following definitions come from nmbd/nmbd_subnetdb.c  */
    3848 
    3849 void close_subnet(struct subnet_record *subrec);
    3850 struct subnet_record *make_normal_subnet(const struct interface *iface);
    3851 bool create_subnets(void);
    3852 bool we_are_a_wins_client(void);
    3853 struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec);
    3854 struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec);
    3855 
    3856 /* The following definitions come from nmbd/nmbd_synclists.c  */
    3857 
    3858 void sync_browse_lists(struct work_record *work,
    3859                        char *name, int nm_type,
    3860                        struct in_addr ip, bool local, bool servers);
    3861 void sync_check_completion(void);
    3862 
    3863 /* The following definitions come from nmbd/nmbd_winsproxy.c  */
    3864 
    3865 void make_wins_proxy_name_query_request( struct subnet_record *subrec,
    3866                                          struct packet_struct *incoming_packet,
    3867                                          struct nmb_name *question_name);
    3868 
    3869 /* The following definitions come from nmbd/nmbd_winsserver.c  */
    3870 
    3871 struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only);
    3872 bool wins_store_changed_namerec(const struct name_record *namerec);
    3873 bool add_name_to_wins_subnet(const struct name_record *namerec);
    3874 bool remove_name_from_wins_namelist(struct name_record *namerec);
    3875 void dump_wins_subnet_namelist(XFILE *fp);
    3876 bool packet_is_for_wins_server(struct packet_struct *packet);
    3877 bool initialise_wins(void);
    3878 void wins_process_name_refresh_request( struct subnet_record *subrec,
    3879                                         struct packet_struct *p );
    3880 void wins_process_name_registration_request(struct subnet_record *subrec,
    3881                                             struct packet_struct *p);
    3882 void wins_process_multihomed_name_registration_request( struct subnet_record *subrec,
    3883                                                         struct packet_struct *p);
    3884 void fetch_all_active_wins_1b_names(void);
    3885 void send_wins_name_query_response(int rcode, struct packet_struct *p,
    3886                                           struct name_record *namerec);
    3887 void wins_process_name_query_request(struct subnet_record *subrec,
    3888                                      struct packet_struct *p);
    3889 void wins_process_name_release_request(struct subnet_record *subrec,
    3890                                        struct packet_struct *p);
    3891 void initiate_wins_processing(time_t t);
    3892 void wins_write_name_record(struct name_record *namerec, XFILE *fp);
    3893 void wins_write_database(time_t t, bool background);
    3894 void nmbd_wins_new_entry(struct messaging_context *msg,
    3895                                        void *private_data,
    3896                                        uint32_t msg_type,
    3897                                        struct server_id server_id,
    3898                                        DATA_BLOB *data);
    3899 
    3900 /* The following definitions come from nmbd/nmbd_workgroupdb.c  */
    3901 
    3902 struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec,
    3903                                              const char *name);
    3904 struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec,
    3905                                                const char *name, int ttl);
    3906 void update_workgroup_ttl(struct work_record *work, int ttl);
    3907 void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work);
    3908 void dump_workgroups(bool force_write);
    3909 void expire_workgroups_and_servers(time_t t);
     1327                                     struct dom_sid **sids );
     1328NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
    39101329
    39111330/* The following definitions come from param/loadparm.c  */
     
    39781397char *lp_abort_shutdown_script(void);
    39791398char *lp_username_map_script(void);
     1399int lp_username_map_cache_time(void);
    39801400char *lp_check_password_script(void);
    39811401char *lp_wins_hook(void);
     
    39951415bool lp_winbind_rpc_only(void);
    39961416bool lp_create_krb5_conf(void);
    3997 const char **lp_idmap_domains(void);
     1417int lp_winbind_max_domain_connections(void);
    39981418const char *lp_idmap_backend(void);
    3999 char *lp_idmap_alloc_backend(void);
    40001419int lp_idmap_cache_time(void);
    40011420int lp_idmap_negative_cache_time(void);
     
    40281447bool lp_disable_netbios(void);
    40291448bool lp_reset_on_zero_vc(void);
     1449bool lp_log_writeable_files_on_exit(void);
    40301450bool lp_ms_add_printer_wizard(void);
    40311451bool lp_dns_proxy(void);
     
    40391459bool lp_load_printers(void);
    40401460bool lp_readraw(void);
     1461bool _lp_readraw(void);
    40411462bool lp_large_readwrite(void);
    40421463bool lp_writeraw(void);
     1464bool _lp_writeraw(void);
    40431465bool lp_null_passwords(void);
    40441466bool lp_obey_pam_restrictions(void);
    40451467bool lp_encrypted_passwords(void);
    4046 bool lp_update_encrypted(void);
    40471468int lp_client_schannel(void);
    40481469int lp_server_schannel(void);
     
    40821503bool lp_client_use_spnego(void);
    40831504bool lp_client_use_spnego_principal(void);
     1505bool lp_send_spnego_principal(void);
    40841506bool lp_hostname_lookups(void);
    40851507bool lp_change_notify(const struct share_params *p );
     
    41221544const char *lp_socket_options(void);
    41231545int lp_config_backend(void);
     1546int lp_smb2_max_read(void);
     1547int lp_smb2_max_write(void);
     1548int lp_smb2_max_trans(void);
     1549int lp_smb2_max_credits(void);
    41241550char *lp_preexec(int );
    41251551char *lp_postexec(int );
     
    41441570bool lp_clustering(void);
    41451571int lp_ctdb_timeout(void);
     1572int lp_ctdb_locktime_warn_threshold(void);
    41461573char *lp_printcommand(int );
    41471574char *lp_lpqcommand(int );
     
    41891616bool lp_administrative_share(int );
    41901617bool lp_print_ok(int );
     1618bool lp_print_notify_backchannel(int );
    41911619bool lp_map_hidden(int );
    41921620bool lp_map_archive(int );
     
    42141642bool lp_dos_filetime_resolution(int );
    42151643bool lp_fake_dir_create_times(int);
     1644bool lp_async_smb_echo_handler(void);
     1645bool lp_multicast_dns_register(void);
    42161646bool lp_blocking_locks(int );
    42171647bool lp_inherit_perms(int );
     
    42581688int lp_winbind_cache_time(void);
    42591689int lp_winbind_reconnect_delay(void);
     1690int lp_winbind_max_clients(void);
    42601691const char **lp_winbind_nss_info(void);
    42611692int lp_algorithmic_rid_base(void);
     
    42721703int lp_parm_enum(int snum, const char *type, const char *option,
    42731704                 const struct enum_list *_enum, int def);
     1705char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src);
    42741706bool lp_add_home(const char *pszHomename, int iDefaultService,
    42751707                 const char *user, const char *pszHomedir);
     
    43031735void *lp_local_ptr_by_snum(int snum, void *ptr);
    43041736bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue);
     1737bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
     1738bool lp_set_option(const char *option);
    43051739void init_locals(void);
    43061740bool lp_is_default(int snum, struct parm_struct *parm);
     
    43091743struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
    43101744bool lp_snum_ok(int iService);
    4311 void lp_add_one_printer(const char *name, const char *comment, void *pdata);
     1745void lp_add_one_printer(const char *name, const char *comment,
     1746                        const char *location, void *pdata);
    43121747bool lp_loaded(void);
    43131748void lp_killunused(bool (*snumused) (int));
     
    43231758                        char **pp_sharepath,
    43241759                        char **pp_comment,
    4325                         SEC_DESC **ppsd,
     1760                        char **pp_cp_share_name,
     1761                        struct security_descriptor **ppsd,
    43261762                        bool *pallow_guest);
    43271763int load_usershare_service(const char *servicename);
     
    43301766void lp_set_in_client(bool b);
    43311767bool lp_is_in_client(void);
    4332 bool lp_load_ex(const char *pszFname,
    4333                 bool global_only,
    4334                 bool save_defaults,
    4335                 bool add_ipc,
    4336                 bool initialize_globals,
    4337                 bool allow_include_registry,
    4338                 bool allow_registry_shares);
    43391768bool lp_load(const char *pszFname,
    43401769             bool global_only,
     
    43601789struct share_params *snum2params_static(int snum);
    43611790const char *volume_label(int snum);
    4362 int lp_server_role(void);
    43631791bool lp_domain_master(void);
     1792bool lp_domain_master_true_or_auto(void);
    43641793bool lp_preferred_master(void);
    43651794void lp_remove_service(int snum);
     
    43761805void lp_set_spoolss_state( uint32 state );
    43771806uint32 lp_get_spoolss_state( void );
     1807struct smb_signing_state;
    43781808bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state);
    43791809void set_use_sendfile(int snum, bool val);
     
    43881818void lp_set_passdb_backend(const char *backend);
    43891819void widelinks_warning(int snum);
     1820char *lp_ncalrpc_dir(void);
     1821
     1822/* The following definitions come from param/loadparm_server_role.c  */
     1823
     1824int lp_server_role(void);
     1825void set_server_role(void);
    43901826
    43911827/* The following definitions come from param/util.c  */
     
    43941830char* get_string_param( const char* param );
    43951831
    4396 /* The following definitions come from passdb/login_cache.c  */
    4397 
    4398 bool login_cache_init(void);
    4399 bool login_cache_shutdown(void);
    4400 LOGIN_CACHE * login_cache_read(struct samu *sampass);
    4401 bool login_cache_write(const struct samu *sampass, LOGIN_CACHE entry);
    4402 bool login_cache_delentry(const struct samu *sampass);
    4403 
    4404 /* The following definitions come from passdb/lookup_sid.c  */
    4405 
    4406 bool lookup_name(TALLOC_CTX *mem_ctx,
    4407                  const char *full_name, int flags,
    4408                  const char **ret_domain, const char **ret_name,
    4409                  DOM_SID *ret_sid, enum lsa_SidType *ret_type);
    4410 bool lookup_name_smbconf(TALLOC_CTX *mem_ctx,
    4411                  const char *full_name, int flags,
    4412                  const char **ret_domain, const char **ret_name,
    4413                  DOM_SID *ret_sid, enum lsa_SidType *ret_type);
    4414 NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
    4415                      const DOM_SID **sids, int level,
    4416                      struct lsa_dom_info **ret_domains,
    4417                      struct lsa_name_info **ret_names);
    4418 bool lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
    4419                 const char **ret_domain, const char **ret_name,
    4420                 enum lsa_SidType *ret_type);
    4421 void store_uid_sid_cache(const DOM_SID *psid, uid_t uid);
    4422 void store_gid_sid_cache(const DOM_SID *psid, gid_t gid);
    4423 void uid_to_sid(DOM_SID *psid, uid_t uid);
    4424 void gid_to_sid(DOM_SID *psid, gid_t gid);
    4425 bool sid_to_uid(const DOM_SID *psid, uid_t *puid);
    4426 bool sid_to_gid(const DOM_SID *psid, gid_t *pgid);
    4427 
    4428 /* The following definitions come from passdb/machine_sid.c  */
    4429 
    4430 DOM_SID *get_global_sam_sid(void);
    4431 void reset_global_sam_sid(void) ;
    4432 bool sid_check_is_domain(const DOM_SID *sid);
    4433 bool sid_check_is_in_our_domain(const DOM_SID *sid);
    4434 
    4435 /* The following definitions come from passdb/passdb.c  */
    4436 
    4437 const char *my_sam_name(void);
    4438 struct samu *samu_new( TALLOC_CTX *ctx );
    4439 NTSTATUS samu_set_unix(struct samu *user, const struct passwd *pwd);
    4440 NTSTATUS samu_alloc_rid_unix(struct samu *user, const struct passwd *pwd);
    4441 char *pdb_encode_acct_ctrl(uint32 acct_ctrl, size_t length);
    4442 uint32 pdb_decode_acct_ctrl(const char *p);
    4443 void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32 acct_ctrl);
    4444 bool pdb_gethexpwd(const char *p, unsigned char *pwd);
    4445 void pdb_sethexhours(char *p, const unsigned char *hours);
    4446 bool pdb_gethexhours(const char *p, unsigned char *hours);
    4447 int algorithmic_rid_base(void);
    4448 uid_t algorithmic_pdb_user_rid_to_uid(uint32 user_rid);
    4449 uid_t max_algorithmic_uid(void);
    4450 uint32 algorithmic_pdb_uid_to_user_rid(uid_t uid);
    4451 gid_t pdb_group_rid_to_gid(uint32 group_rid);
    4452 gid_t max_algorithmic_gid(void);
    4453 uint32 algorithmic_pdb_gid_to_group_rid(gid_t gid);
    4454 bool algorithmic_pdb_rid_is_user(uint32 rid);
    4455 bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid,
    4456                             enum lsa_SidType *type);
    4457 NTSTATUS local_password_change(const char *user_name,
    4458                                 int local_flags,
    4459                                 const char *new_passwd,
    4460                                 char **pp_err_str,
    4461                                 char **pp_msg_str);
    4462 bool init_samu_from_buffer(struct samu *sampass, uint32_t level,
    4463                            uint8 *buf, uint32 buflen);
    4464 uint32 init_buffer_from_samu (uint8 **buf, struct samu *sampass, bool size_only);
    4465 bool pdb_copy_sam_account(struct samu *dst, struct samu *src );
    4466 bool pdb_update_bad_password_count(struct samu *sampass, bool *updated);
    4467 bool pdb_update_autolock_flag(struct samu *sampass, bool *updated);
    4468 bool pdb_increment_bad_password_count(struct samu *sampass);
    4469 bool is_dc_trusted_domain_situation(const char *domain_name);
    4470 bool get_trust_pw_clear(const char *domain, char **ret_pwd,
    4471                         const char **account_name,
    4472                         enum netr_SchannelType *channel);
    4473 bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16],
    4474                        const char **account_name,
    4475                        enum netr_SchannelType *channel);
    4476 struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx,
    4477                                                 struct samu *pw);
    4478 /* The following definitions come from passdb/pdb_compat.c  */
    4479 
    4480 uint32 pdb_get_user_rid (const struct samu *sampass);
    4481 uint32 pdb_get_group_rid (struct samu *sampass);
    4482 bool pdb_set_user_sid_from_rid (struct samu *sampass, uint32 rid, enum pdb_value_state flag);
    4483 bool pdb_set_group_sid_from_rid (struct samu *sampass, uint32 grid, enum pdb_value_state flag);
    4484 
    4485 /* The following definitions come from passdb/pdb_get_set.c  */
    4486 
    4487 uint32 pdb_get_acct_ctrl(const struct samu *sampass);
    4488 time_t pdb_get_logon_time(const struct samu *sampass);
    4489 time_t pdb_get_logoff_time(const struct samu *sampass);
    4490 time_t pdb_get_kickoff_time(const struct samu *sampass);
    4491 time_t pdb_get_bad_password_time(const struct samu *sampass);
    4492 time_t pdb_get_pass_last_set_time(const struct samu *sampass);
    4493 time_t pdb_get_pass_can_change_time(const struct samu *sampass);
    4494 time_t pdb_get_pass_can_change_time_noncalc(const struct samu *sampass);
    4495 time_t pdb_get_pass_must_change_time(const struct samu *sampass);
    4496 bool pdb_get_pass_can_change(const struct samu *sampass);
    4497 uint16 pdb_get_logon_divs(const struct samu *sampass);
    4498 uint32 pdb_get_hours_len(const struct samu *sampass);
    4499 const uint8 *pdb_get_hours(const struct samu *sampass);
    4500 const uint8 *pdb_get_nt_passwd(const struct samu *sampass);
    4501 const uint8 *pdb_get_lanman_passwd(const struct samu *sampass);
    4502 const uint8 *pdb_get_pw_history(const struct samu *sampass, uint32 *current_hist_len);
    4503 const char *pdb_get_plaintext_passwd(const struct samu *sampass);
    4504 const DOM_SID *pdb_get_user_sid(const struct samu *sampass);
    4505 const DOM_SID *pdb_get_group_sid(struct samu *sampass);
    4506 enum pdb_value_state pdb_get_init_flags(const struct samu *sampass, enum pdb_elements element);
    4507 const char *pdb_get_username(const struct samu *sampass);
    4508 const char *pdb_get_domain(const struct samu *sampass);
    4509 const char *pdb_get_nt_username(const struct samu *sampass);
    4510 const char *pdb_get_fullname(const struct samu *sampass);
    4511 const char *pdb_get_homedir(const struct samu *sampass);
    4512 const char *pdb_get_dir_drive(const struct samu *sampass);
    4513 const char *pdb_get_logon_script(const struct samu *sampass);
    4514 const char *pdb_get_profile_path(const struct samu *sampass);
    4515 const char *pdb_get_acct_desc(const struct samu *sampass);
    4516 const char *pdb_get_workstations(const struct samu *sampass);
    4517 const char *pdb_get_comment(const struct samu *sampass);
    4518 const char *pdb_get_munged_dial(const struct samu *sampass);
    4519 uint16 pdb_get_bad_password_count(const struct samu *sampass);
    4520 uint16 pdb_get_logon_count(const struct samu *sampass);
    4521 uint32 pdb_get_unknown_6(const struct samu *sampass);
    4522 void *pdb_get_backend_private_data(const struct samu *sampass, const struct pdb_methods *my_methods);
    4523 bool pdb_set_acct_ctrl(struct samu *sampass, uint32 acct_ctrl, enum pdb_value_state flag);
    4524 bool pdb_set_logon_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4525 bool pdb_set_logoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4526 bool pdb_set_kickoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4527 bool pdb_set_bad_password_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4528 bool pdb_set_pass_can_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4529 bool pdb_set_pass_must_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4530 bool pdb_set_pass_last_set_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag);
    4531 bool pdb_set_hours_len(struct samu *sampass, uint32 len, enum pdb_value_state flag);
    4532 bool pdb_set_logon_divs(struct samu *sampass, uint16 hours, enum pdb_value_state flag);
    4533 bool pdb_set_init_flags(struct samu *sampass, enum pdb_elements element, enum pdb_value_state value_flag);
    4534 bool pdb_set_user_sid(struct samu *sampass, const DOM_SID *u_sid, enum pdb_value_state flag);
    4535 bool pdb_set_user_sid_from_string(struct samu *sampass, fstring u_sid, enum pdb_value_state flag);
    4536 bool pdb_set_group_sid(struct samu *sampass, const DOM_SID *g_sid, enum pdb_value_state flag);
    4537 bool pdb_set_username(struct samu *sampass, const char *username, enum pdb_value_state flag);
    4538 bool pdb_set_domain(struct samu *sampass, const char *domain, enum pdb_value_state flag);
    4539 bool pdb_set_nt_username(struct samu *sampass, const char *nt_username, enum pdb_value_state flag);
    4540 bool pdb_set_fullname(struct samu *sampass, const char *full_name, enum pdb_value_state flag);
    4541 bool pdb_set_logon_script(struct samu *sampass, const char *logon_script, enum pdb_value_state flag);
    4542 bool pdb_set_profile_path(struct samu *sampass, const char *profile_path, enum pdb_value_state flag);
    4543 bool pdb_set_dir_drive(struct samu *sampass, const char *dir_drive, enum pdb_value_state flag);
    4544 bool pdb_set_homedir(struct samu *sampass, const char *home_dir, enum pdb_value_state flag);
    4545 bool pdb_set_acct_desc(struct samu *sampass, const char *acct_desc, enum pdb_value_state flag);
    4546 bool pdb_set_workstations(struct samu *sampass, const char *workstations, enum pdb_value_state flag);
    4547 bool pdb_set_comment(struct samu *sampass, const char *comment, enum pdb_value_state flag);
    4548 bool pdb_set_munged_dial(struct samu *sampass, const char *munged_dial, enum pdb_value_state flag);
    4549 bool pdb_set_nt_passwd(struct samu *sampass, const uint8 pwd[NT_HASH_LEN], enum pdb_value_state flag);
    4550 bool pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], enum pdb_value_state flag);
    4551 bool pdb_set_pw_history(struct samu *sampass, const uint8 *pwd, uint32 historyLen, enum pdb_value_state flag);
    4552 bool pdb_set_plaintext_pw_only(struct samu *sampass, const char *password, enum pdb_value_state flag);
    4553 bool pdb_set_bad_password_count(struct samu *sampass, uint16 bad_password_count, enum pdb_value_state flag);
    4554 bool pdb_set_logon_count(struct samu *sampass, uint16 logon_count, enum pdb_value_state flag);
    4555 bool pdb_set_unknown_6(struct samu *sampass, uint32 unkn, enum pdb_value_state flag);
    4556 bool pdb_set_hours(struct samu *sampass, const uint8 *hours, enum pdb_value_state flag);
    4557 bool pdb_set_backend_private_data(struct samu *sampass, void *private_data,
    4558                                    void (*free_fn)(void **),
    4559                                    const struct pdb_methods *my_methods,
    4560                                    enum pdb_value_state flag);
    4561 bool pdb_set_pass_can_change(struct samu *sampass, bool canchange);
    4562 bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext);
    4563 uint32 pdb_build_fields_present(struct samu *sampass);
    4564 
    4565 /* The following definitions come from passdb/pdb_interface.c  */
    4566 
    4567 NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function init) ;
    4568 struct pdb_init_function_entry *pdb_find_backend_entry(const char *name);
    4569 struct event_context *pdb_get_event_context(void);
    4570 NTSTATUS make_pdb_method_name(struct pdb_methods **methods, const char *selected);
    4571 struct pdb_domain_info *pdb_get_domain_info(TALLOC_CTX *mem_ctx);
    4572 bool pdb_getsampwnam(struct samu *sam_acct, const char *username) ;
    4573 bool guest_user_info( struct samu *user );
    4574 bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid) ;
    4575 NTSTATUS pdb_create_user(TALLOC_CTX *mem_ctx, const char *name, uint32 flags,
    4576                          uint32 *rid);
    4577 NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct);
    4578 NTSTATUS pdb_add_sam_account(struct samu *sam_acct) ;
    4579 NTSTATUS pdb_update_sam_account(struct samu *sam_acct) ;
    4580 NTSTATUS pdb_delete_sam_account(struct samu *sam_acct) ;
    4581 NTSTATUS pdb_rename_sam_account(struct samu *oldname, const char *newname);
    4582 NTSTATUS pdb_update_login_attempts(struct samu *sam_acct, bool success);
    4583 bool pdb_getgrsid(GROUP_MAP *map, DOM_SID sid);
    4584 bool pdb_getgrgid(GROUP_MAP *map, gid_t gid);
    4585 bool pdb_getgrnam(GROUP_MAP *map, const char *name);
    4586 NTSTATUS pdb_create_dom_group(TALLOC_CTX *mem_ctx, const char *name,
    4587                               uint32 *rid);
    4588 NTSTATUS pdb_delete_dom_group(TALLOC_CTX *mem_ctx, uint32 rid);
    4589 NTSTATUS pdb_add_group_mapping_entry(GROUP_MAP *map);
    4590 NTSTATUS pdb_update_group_mapping_entry(GROUP_MAP *map);
    4591 NTSTATUS pdb_delete_group_mapping_entry(DOM_SID sid);
    4592 bool pdb_enum_group_mapping(const DOM_SID *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap,
    4593                             size_t *p_num_entries, bool unix_only);
    4594 NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx,
    4595                                 const DOM_SID *sid,
    4596                                 uint32 **pp_member_rids,
    4597                                 size_t *p_num_members);
    4598 NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user,
    4599                                     DOM_SID **pp_sids, gid_t **pp_gids,
    4600                                     size_t *p_num_groups);
    4601 NTSTATUS pdb_set_unix_primary_group(TALLOC_CTX *mem_ctx, struct samu *user);
    4602 NTSTATUS pdb_add_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid,
    4603                           uint32 member_rid);
    4604 NTSTATUS pdb_del_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid,
    4605                           uint32 member_rid);
    4606 NTSTATUS pdb_create_alias(const char *name, uint32 *rid);
    4607 NTSTATUS pdb_delete_alias(const DOM_SID *sid);
    4608 NTSTATUS pdb_get_aliasinfo(const DOM_SID *sid, struct acct_info *info);
    4609 NTSTATUS pdb_set_aliasinfo(const DOM_SID *sid, struct acct_info *info);
    4610 NTSTATUS pdb_add_aliasmem(const DOM_SID *alias, const DOM_SID *member);
    4611 NTSTATUS pdb_del_aliasmem(const DOM_SID *alias, const DOM_SID *member);
    4612 NTSTATUS pdb_enum_aliasmem(const DOM_SID *alias, TALLOC_CTX *mem_ctx,
    4613                            DOM_SID **pp_members, size_t *p_num_members);
    4614 NTSTATUS pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx,
    4615                                     const DOM_SID *domain_sid,
    4616                                     const DOM_SID *members, size_t num_members,
    4617                                     uint32 **pp_alias_rids,
    4618                                     size_t *p_num_alias_rids);
    4619 NTSTATUS pdb_lookup_rids(const DOM_SID *domain_sid,
    4620                          int num_rids,
    4621                          uint32 *rids,
    4622                          const char **names,
    4623                          enum lsa_SidType *attrs);
    4624 NTSTATUS pdb_lookup_names(const DOM_SID *domain_sid,
    4625                           int num_names,
    4626                           const char **names,
    4627                           uint32 *rids,
    4628                           enum lsa_SidType *attrs);
    4629 bool pdb_get_account_policy(enum pdb_policy_type type, uint32_t *value);
    4630 bool pdb_set_account_policy(enum pdb_policy_type type, uint32_t value);
    4631 bool pdb_get_seq_num(time_t *seq_num);
    4632 bool pdb_uid_to_sid(uid_t uid, DOM_SID *sid);
    4633 bool pdb_gid_to_sid(gid_t gid, DOM_SID *sid);
    4634 bool pdb_sid_to_id(const DOM_SID *sid, union unid_t *id,
    4635                    enum lsa_SidType *type);
    4636 uint32_t pdb_capabilities(void);
    4637 bool pdb_new_rid(uint32 *rid);
    4638 bool initialize_password_db(bool reload, struct event_context *event_ctx);
    4639 struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx,
    4640                                    enum pdb_search_type type);
    4641 struct pdb_search *pdb_search_users(TALLOC_CTX *mem_ctx, uint32 acct_flags);
    4642 struct pdb_search *pdb_search_groups(TALLOC_CTX *mem_ctx);
    4643 struct pdb_search *pdb_search_aliases(TALLOC_CTX *mem_ctx, const DOM_SID *sid);
    4644 uint32 pdb_search_entries(struct pdb_search *search,
    4645                           uint32 start_idx, uint32 max_entries,
    4646                           struct samr_displayentry **result);
    4647 bool pdb_get_trusteddom_pw(const char *domain, char** pwd, DOM_SID *sid,
    4648                            time_t *pass_last_set_time);
    4649 bool pdb_set_trusteddom_pw(const char* domain, const char* pwd,
    4650                            const DOM_SID *sid);
    4651 bool pdb_del_trusteddom_pw(const char *domain);
    4652 NTSTATUS pdb_enum_trusteddoms(TALLOC_CTX *mem_ctx, uint32 *num_domains,
    4653                               struct trustdom_info ***domains);
    4654 NTSTATUS make_pdb_method( struct pdb_methods **methods ) ;
    4655 
    4656 /* The following definitions come from passdb/pdb_ldap.c  */
    4657 
    4658 const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver );
    4659 int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state,
    4660                                           const char *user,
    4661                                           LDAPMessage ** result,
    4662                                           const char **attr);
    4663 const char **talloc_attrs(TALLOC_CTX *mem_ctx, ...);
    4664 NTSTATUS pdb_init_ldapsam_compat(struct pdb_methods **pdb_method, const char *location);
    4665 NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location);
    4666 NTSTATUS pdb_ldap_init(void);
    4667 
    4668 /* The following definitions come from passdb/pdb_nds.c  */
    4669 
    4670 int pdb_nds_get_password(
    4671         struct smbldap_state *ldap_state,
    4672         char *object_dn,
    4673         size_t *pwd_len,
    4674         char *pwd );
    4675 int pdb_nds_set_password(
    4676         struct smbldap_state *ldap_state,
    4677         char *object_dn,
    4678         const char *pwd );
    4679 NTSTATUS pdb_nds_init(void);
    4680 
    4681 /* The following definitions come from passdb/pdb_smbpasswd.c  */
    4682 
    4683 NTSTATUS pdb_smbpasswd_init(void) ;
    4684 
    4685 /* The following definitions come from passdb/pdb_wbc_sam.c  */
    4686 
    4687 NTSTATUS pdb_wbc_sam_init(void);
    4688 
    4689 /* The following definitions come from passdb/pdb_tdb.c  */
    4690 
    4691 bool init_sam_from_buffer_v2(struct samu *sampass, uint8 *buf, uint32 buflen);
    4692 NTSTATUS pdb_tdbsam_init(void);
    4693 
    4694 /* The following definitions come from passdb/secrets.c  */
    4695 
    4696 bool secrets_init(void);
    4697 struct db_context *secrets_db_ctx(void);
    4698 void secrets_shutdown(void);
    4699 void *secrets_fetch(const char *key, size_t *size);
    4700 bool secrets_store(const char *key, const void *data, size_t size);
    4701 bool secrets_delete(const char *key);
    4702 bool secrets_store_domain_sid(const char *domain, const DOM_SID *sid);
    4703 bool secrets_fetch_domain_sid(const char *domain, DOM_SID *sid);
    4704 bool secrets_store_domain_guid(const char *domain, struct GUID *guid);
    4705 bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid);
    4706 void *secrets_get_trust_account_lock(TALLOC_CTX *mem_ctx, const char *domain);
    4707 enum netr_SchannelType get_default_sec_channel(void);
    4708 bool secrets_fetch_trust_account_password_legacy(const char *domain,
    4709                                                  uint8 ret_pwd[16],
    4710                                                  time_t *pass_last_set_time,
    4711                                                  enum netr_SchannelType *channel);
    4712 bool secrets_fetch_trust_account_password(const char *domain, uint8 ret_pwd[16],
    4713                                           time_t *pass_last_set_time,
    4714                                           enum netr_SchannelType *channel);
    4715 bool secrets_fetch_trusted_domain_password(const char *domain, char** pwd,
    4716                                            DOM_SID *sid, time_t *pass_last_set_time);
    4717 bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
    4718                                            const DOM_SID *sid);
    4719 bool secrets_delete_machine_password(const char *domain);
    4720 bool secrets_delete_machine_password_ex(const char *domain);
    4721 bool secrets_delete_domain_sid(const char *domain);
    4722 bool secrets_store_machine_password(const char *pass, const char *domain, enum netr_SchannelType sec_channel);
    4723 char *secrets_fetch_prev_machine_password(const char *domain);
    4724 char *secrets_fetch_machine_password(const char *domain,
    4725                                      time_t *pass_last_set_time,
    4726                                      enum netr_SchannelType *channel);
    4727 bool trusted_domain_password_delete(const char *domain);
    4728 bool secrets_store_ldap_pw(const char* dn, char* pw);
    4729 bool fetch_ldap_pw(char **dn, char** pw);
    4730 NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
    4731                                  struct trustdom_info ***domains);
    4732 bool secrets_store_afs_keyfile(const char *cell, const struct afs_keyfile *keyfile);
    4733 bool secrets_fetch_afs_key(const char *cell, struct afs_key *result);
    4734 void secrets_fetch_ipc_userpass(char **username, char **domain, char **password);
    4735 bool secrets_store_generic(const char *owner, const char *key, const char *secret);
    4736 char *secrets_fetch_generic(const char *owner, const char *key);
    4737 bool secrets_delete_generic(const char *owner, const char *key);
    4738 bool secrets_store_local_schannel_key(uint8_t schannel_key[16]);
    4739 bool secrets_fetch_local_schannel_key(uint8_t schannel_key[16]);
    4740 
    4741 /* The following definitions come from passdb/secrets_schannel.c  */
    4742 
    4743 TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx);
    4744 NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
    4745                                     const char *computer_name,
    4746                                     struct netlogon_creds_CredentialState **pcreds);
    4747 NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
    4748                                     struct netlogon_creds_CredentialState *creds);
    4749 
    4750 /* The following definitions come from passdb/util_builtin.c  */
    4751 
    4752 bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name);
    4753 bool lookup_builtin_name(const char *name, uint32 *rid);
    4754 const char *builtin_domain_name(void);
    4755 bool sid_check_is_builtin(const DOM_SID *sid);
    4756 bool sid_check_is_in_builtin(const DOM_SID *sid);
    4757 
    4758 /* The following definitions come from passdb/util_unixsids.c  */
    4759 
    4760 bool sid_check_is_unix_users(const DOM_SID *sid);
    4761 bool sid_check_is_in_unix_users(const DOM_SID *sid);
    4762 bool uid_to_unix_users_sid(uid_t uid, DOM_SID *sid);
    4763 bool gid_to_unix_groups_sid(gid_t gid, DOM_SID *sid);
    4764 const char *unix_users_domain_name(void);
    4765 bool lookup_unix_user_name(const char *name, DOM_SID *sid);
    4766 bool sid_check_is_unix_groups(const DOM_SID *sid);
    4767 bool sid_check_is_in_unix_groups(const DOM_SID *sid);
    4768 const char *unix_groups_domain_name(void);
    4769 bool lookup_unix_group_name(const char *name, DOM_SID *sid);
    4770 
    4771 /* The following definitions come from passdb/util_wellknown.c  */
    4772 
    4773 bool sid_check_is_wellknown_domain(const DOM_SID *sid, const char **name);
    4774 bool sid_check_is_in_wellknown_domain(const DOM_SID *sid);
    4775 bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid,
     1832/* The following definitions come from lib/server_contexts.c  */
     1833struct tevent_context *server_event_context(void);
     1834void server_event_context_free(void);
     1835struct messaging_context *server_messaging_context(void);
     1836void server_messaging_context_free(void);
     1837
     1838/* The following definitions come from lib/sessionid_tdb.c  */
     1839struct sessionid;
     1840bool sessionid_init(void);
     1841struct db_record *sessionid_fetch_record(TALLOC_CTX *mem_ctx, const char *key);
     1842int sessionid_traverse(int (*fn)(struct db_record *rec, const char *key,
     1843                                 struct sessionid *session,
     1844                                 void *private_data),
     1845                       void *private_data);
     1846int sessionid_traverse_read(int (*fn)(const char *key,
     1847                                      struct sessionid *session,
     1848                                      void *private_data),
     1849                            void *private_data);
     1850
     1851/* The following definitions come from utils/passwd_util.c  */
     1852
     1853char *stdin_new_passwd( void);
     1854char *get_pass( const char *prompt, bool stdin_get);
     1855
     1856/* The following definitions come from lib/avahi.c */
     1857
     1858struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
     1859                                    struct tevent_context *ev);
     1860
     1861/* The following definitions come from lib/fncall.c */
     1862
     1863struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
     1864                                           int max_threads);
     1865struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
     1866                               struct fncall_context *ctx,
     1867                               void (*fn)(void *private_data),
     1868                               void *private_data);
     1869int fncall_recv(struct tevent_req *req, int *perr);
     1870
     1871/* The following definitions come from libsmb/smbsock_connect.c */
     1872
     1873struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
     1874                                        struct tevent_context *ev,
     1875                                        const struct sockaddr_storage *addr,
     1876                                        uint16_t port,
     1877                                        const char *called_name,
     1878                                        int called_type,
     1879                                        const char *calling_name,
     1880                                        int calling_type);
     1881NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
     1882                              uint16_t *ret_port);
     1883NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
     1884                         const char *called_name, int called_type,
     1885                         const char *calling_name, int calling_type,
     1886                         int *pfd, uint16_t *ret_port, int sec_timeout);
     1887
     1888struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
     1889                                            struct tevent_context *ev,
     1890                                            const struct sockaddr_storage *addrs,
     1891                                            const char **called_names,
     1892                                            int *called_types,
     1893                                            const char **calling_names,
     1894                                            int *calling_types,
     1895                                            size_t num_addrs, uint16_t port);
     1896NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
     1897                                  size_t *chosen_index, uint16_t *chosen_port);
     1898NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
     1899                             const char **called_names,
     1900                             int *called_types,
     1901                             const char **calling_names,
     1902                             int *calling_types,
     1903                             size_t num_addrs,
     1904                             uint16_t port,
     1905                             int sec_timeout,
     1906                             int *pfd, size_t *chosen_index,
     1907                             uint16_t *chosen_port);
     1908
     1909/* The following definitions come from lib/util_wellknown.c  */
     1910
     1911bool sid_check_is_wellknown_domain(const struct dom_sid *sid, const char **name);
     1912bool sid_check_is_in_wellknown_domain(const struct dom_sid *sid);
     1913bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
    47761914                          const char **domain, const char **name);
    47771915bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name,
    4778                            DOM_SID *sid, const char **domain);
    4779 
    4780 /* The following definitions come from printing/load.c  */
    4781 
    4782 void load_printers(void);
    4783 
    4784 /* The following definitions come from printing/lpq_parse.c  */
    4785 
    4786 bool parse_lpq_entry(enum printing_types printing_type,char *line,
    4787                      print_queue_struct *buf,
    4788                      print_status_struct *status,bool first);
    4789 uint32_t print_parse_jobid(const char *fname);
    4790 
    4791 /* The following definitions come from printing/notify.c  */
    4792 
    4793 int print_queue_snum(const char *qname);
    4794 void print_notify_send_messages(struct messaging_context *msg_ctx,
    4795                                 unsigned int timeout);
    4796 void notify_printer_status_byname(const char *sharename, uint32 status);
    4797 void notify_printer_status(int snum, uint32 status);
    4798 void notify_job_status_byname(const char *sharename, uint32 jobid, uint32 status,
    4799                               uint32 flags);
    4800 void notify_job_status(const char *sharename, uint32 jobid, uint32 status);
    4801 void notify_job_total_bytes(const char *sharename, uint32 jobid,
    4802                             uint32 size);
    4803 void notify_job_total_pages(const char *sharename, uint32 jobid,
    4804                             uint32 pages);
    4805 void notify_job_username(const char *sharename, uint32 jobid, char *name);
    4806 void notify_job_name(const char *sharename, uint32 jobid, char *name);
    4807 void notify_job_submitted(const char *sharename, uint32 jobid,
    4808                           time_t submitted);
    4809 void notify_printer_driver(int snum, char *driver_name);
    4810 void notify_printer_comment(int snum, char *comment);
    4811 void notify_printer_sharename(int snum, char *share_name);
    4812 void notify_printer_printername(int snum, char *printername);
    4813 void notify_printer_port(int snum, char *port_name);
    4814 void notify_printer_location(int snum, char *location);
    4815 void notify_printer_byname( const char *printername, uint32 change, const char *value );
    4816 
    4817 /* The following definitions come from printing/nt_printing.c  */
    4818 
    4819 bool nt_printing_init(struct messaging_context *msg_ctx);
    4820 uint32 update_c_setprinter(bool initialize);
    4821 uint32 get_c_setprinter(void);
    4822 int get_builtin_ntforms(nt_forms_struct **list);
    4823 bool get_a_builtin_ntform_by_string(const char *form_name, nt_forms_struct *form);
    4824 int get_ntforms(nt_forms_struct **list);
    4825 int write_ntforms(nt_forms_struct **list, int number);
    4826 bool add_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int *count);
    4827 bool delete_a_form(nt_forms_struct **list, const char *del_name, int *count, WERROR *ret);
    4828 void update_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int count);
    4829 int get_ntdrivers(fstring **list, const char *architecture, uint32 version);
    4830 const char *get_short_archi(const char *long_archi);
    4831 WERROR clean_up_driver_struct(struct pipes_struct *rpc_pipe,
    4832                               struct spoolss_AddDriverInfoCtr *r);
    4833 WERROR move_driver_to_download_area(struct pipes_struct *p,
    4834                                     struct spoolss_AddDriverInfoCtr *r,
    4835                                     WERROR *perr);
    4836 int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen);
    4837 uint32 del_a_printer(const char *sharename);
    4838 NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename);
    4839 void free_nt_devicemode(NT_DEVICEMODE **devmode_ptr);
    4840 int unpack_devicemode(NT_DEVICEMODE **nt_devmode, const uint8 *buf, int buflen);
    4841 int add_new_printer_key( NT_PRINTER_DATA *data, const char *name );
    4842 int delete_printer_key( NT_PRINTER_DATA *data, const char *name );
    4843 int lookup_printerkey( NT_PRINTER_DATA *data, const char *name );
    4844 int get_printer_subkeys( NT_PRINTER_DATA *data, const char* key, fstring **subkeys );
    4845 WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action);
    4846 WERROR check_published_printers(void);
    4847 bool is_printer_published(Printer_entry *print_hnd, int snum,
    4848                           struct GUID *guid);
    4849 WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action);
    4850 WERROR check_published_printers(void);
    4851 bool is_printer_published(Printer_entry *print_hnd, int snum,
    4852                           struct GUID *guid);
    4853 WERROR delete_all_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key );
    4854 WERROR delete_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
    4855 WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value,
    4856                            uint32 type, uint8 *data, int real_len );
    4857 struct regval_blob* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value );
    4858 WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
    4859 bool set_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level);
    4860 bool del_driver_init(const char *drivername);
    4861 WERROR save_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level, uint8 *data, uint32 data_len);
    4862 WERROR get_a_printer( Printer_entry *print_hnd,
    4863                         NT_PRINTER_INFO_LEVEL **pp_printer,
    4864                         uint32 level,
    4865                         const char *sharename);
    4866 WERROR get_a_printer_search( Printer_entry *print_hnd,
    4867                         NT_PRINTER_INFO_LEVEL **pp_printer,
    4868                         uint32 level,
    4869                         const char *sharename);
    4870 uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level);
    4871 uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
    4872                               struct spoolss_AddDriverInfoCtr *r,
    4873                               char **driver_name,
    4874                               uint32_t *version);
    4875 WERROR get_a_printer_driver(TALLOC_CTX *mem_ctx,
    4876                             struct spoolss_DriverInfo8 **driver_p,
    4877                             const char *drivername, const char *architecture,
    4878                             uint32_t version);
    4879 uint32_t free_a_printer_driver(struct spoolss_DriverInfo8 *driver);
    4880 bool printer_driver_in_use(const struct spoolss_DriverInfo8 *r);
    4881 bool printer_driver_files_in_use(TALLOC_CTX *mem_ctx,
    4882                                  struct spoolss_DriverInfo8 *r);
    4883 WERROR delete_printer_driver(struct pipes_struct *rpc_pipe,
    4884                              const struct spoolss_DriverInfo8 *r,
    4885                              uint32 version, bool delete_files );
    4886 WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr);
    4887 bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **secdesc_ctr);
    4888 void map_printer_permissions(SEC_DESC *sd);
    4889 void map_job_permissions(SEC_DESC *sd);
    4890 bool print_access_check(struct auth_serversupplied_info *server_info, int snum,
    4891                         int access_type);
    4892 bool print_time_access_check(const char *servicename);
    4893 char* get_server_name( Printer_entry *printer );
    4894 
    4895 /* The following definitions come from printing/pcap.c  */
    4896 
    4897 bool pcap_cache_add_specific(struct pcap_cache **ppcache, const char *name, const char *comment);
    4898 void pcap_cache_destroy_specific(struct pcap_cache **ppcache);
    4899 bool pcap_cache_add(const char *name, const char *comment);
    4900 bool pcap_cache_loaded(void);
    4901 void pcap_cache_replace(const struct pcap_cache *cache);
    4902 void pcap_cache_reload(void (*post_cache_fill_fn)(void));
    4903 bool pcap_printername_ok(const char *printername);
    4904 void pcap_printer_fn_specific(const struct pcap_cache *, void (*fn)(const char *, const char *, void *), void *);
    4905 void pcap_printer_fn(void (*fn)(const char *, const char *, void *), void *);
    4906 
    4907 /* The following definitions come from printing/print_aix.c  */
    4908 
    4909 bool aix_cache_reload(void);
    4910 
    4911 /* The following definitions come from printing/print_cups.c  */
    4912 
    4913 bool cups_cache_reload(void (*post_cache_fill_fn)(void));
    4914 bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer);
    4915 
    4916 /* The following definitions come from printing/print_generic.c  */
    4917 
    4918 
    4919 /* The following definitions come from printing/print_iprint.c  */
    4920 
    4921 bool iprint_cache_reload(void);
    4922 
    4923 /* The following definitions come from printing/print_svid.c  */
    4924 
    4925 bool sysv_cache_reload(void);
    4926 
    4927 /* The following definitions come from printing/printfsp.c  */
    4928 
    4929 NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
    4930                         const char *fname,
    4931                         uint16_t current_vuid, files_struct *fsp);
    4932 void print_fsp_end(files_struct *fsp, enum file_close_type close_type);
    4933 
    4934 /* The following definitions come from printing/printing.c  */
    4935 
    4936 uint16 pjobid_to_rap(const char* sharename, uint32 jobid);
    4937 bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid);
    4938 bool print_backend_init(struct messaging_context *msg_ctx);
    4939 void printing_end(void);
    4940 int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob );
    4941 uint32 sysjob_to_jobid(int unix_jobid);
    4942 void pjob_delete(const char* sharename, uint32 jobid);
    4943 void start_background_queue(void);
    4944 bool print_notify_register_pid(int snum);
    4945 bool print_notify_deregister_pid(int snum);
    4946 bool print_job_exists(const char* sharename, uint32 jobid);
    4947 int print_job_fd(const char* sharename, uint32 jobid);
    4948 char *print_job_fname(const char* sharename, uint32 jobid);
    4949 NT_DEVICEMODE *print_job_devmode(const char* sharename, uint32 jobid);
    4950 bool print_job_set_place(const char *sharename, uint32 jobid, int place);
    4951 bool print_job_set_name(const char *sharename, uint32 jobid, char *name);
    4952 bool print_job_delete(struct auth_serversupplied_info *server_info, int snum,
    4953                       uint32 jobid, WERROR *errcode);
    4954 bool print_job_pause(struct auth_serversupplied_info *server_info, int snum,
    4955                      uint32 jobid, WERROR *errcode);
    4956 bool print_job_resume(struct auth_serversupplied_info *server_info, int snum,
    4957                       uint32 jobid, WERROR *errcode);
    4958 ssize_t print_job_write(int snum, uint32 jobid, const char *buf, SMB_OFF_T pos, size_t size);
    4959 int print_queue_length(int snum, print_status_struct *pstatus);
    4960 uint32 print_job_start(struct auth_serversupplied_info *server_info, int snum,
    4961                        const char *jobname, NT_DEVICEMODE *nt_devmode );
    4962 void print_job_endpage(int snum, uint32 jobid);
    4963 bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type);
    4964 int print_queue_status(int snum,
    4965                        print_queue_struct **ppqueue,
    4966                        print_status_struct *status);
    4967 WERROR print_queue_pause(struct auth_serversupplied_info *server_info, int snum);
    4968 WERROR print_queue_resume(struct auth_serversupplied_info *server_info, int snum);
    4969 WERROR print_queue_purge(struct auth_serversupplied_info *server_info, int snum);
    4970 
    4971 /* The following definitions come from printing/printing_db.c  */
    4972 
    4973 struct tdb_print_db *get_print_db_byname(const char *printername);
    4974 void release_print_db( struct tdb_print_db *pdb);
    4975 void close_all_print_db(void);
    4976 TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, bool cleanlist);
    4977 
    4978 /* The following definitions come from profile/profile.c  */
    4979 
    4980 void set_profile_level(int level, struct server_id src);
    4981 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
    4982 
    4983 /* The following definitions come from registry/reg_api.c  */
    4984 
    4985 WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive,
    4986                     uint32 desired_access,
    4987                     const struct nt_user_token *token,
    4988                     struct registry_key **pkey);
    4989 WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent,
    4990                    const char *name, uint32 desired_access,
    4991                    struct registry_key **pkey);
    4992 WERROR reg_enumkey(TALLOC_CTX *mem_ctx, struct registry_key *key,
    4993                    uint32 idx, char **name, NTTIME *last_write_time);
    4994 WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
    4995                      uint32 idx, char **pname, struct registry_value **pval);
    4996 WERROR reg_queryvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
    4997                       const char *name, struct registry_value **pval);
    4998 WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys,
    4999                         uint32_t *max_subkeylen, uint32_t *max_subkeysize,
    5000                         uint32_t *num_values, uint32_t *max_valnamelen,
    5001                         uint32_t *max_valbufsize, uint32_t *secdescsize,
    5002                         NTTIME *last_changed_time);
    5003 WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
    5004                      const char *subkeypath, uint32 desired_access,
    5005                      struct registry_key **pkey,
    5006                      enum winreg_CreateAction *paction);
    5007 WERROR reg_deletekey(struct registry_key *parent, const char *path);
    5008 WERROR reg_setvalue(struct registry_key *key, const char *name,
    5009                     const struct registry_value *val);
    5010 WERROR reg_deletevalue(struct registry_key *key, const char *name);
    5011 WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key,
    5012                           struct security_descriptor **psecdesc);
    5013 WERROR reg_setkeysecurity(struct registry_key *key,
    5014                           struct security_descriptor *psecdesc);
    5015 WERROR reg_getversion(uint32_t *version);
    5016 WERROR reg_restorekey(struct registry_key *key, const char *fname);
    5017 WERROR reg_savekey(struct registry_key *key, const char *fname);
    5018 WERROR reg_deleteallvalues(struct registry_key *key);
    5019 WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path,
    5020                      uint32 desired_access, const struct nt_user_token *token,
    5021                      struct registry_key **pkey);
    5022 WERROR reg_deletekey_recursive(TALLOC_CTX *ctx,
    5023                                struct registry_key *parent,
    5024                                const char *path);
    5025 WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx,
    5026                                    struct registry_key *parent,
    5027                                    const char *path);
    5028 WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path,
    5029                        uint32 desired_access,
    5030                        const struct nt_user_token *token,
    5031                        enum winreg_CreateAction *paction,
    5032                        struct registry_key **pkey);
    5033 WERROR reg_delete_path(const struct nt_user_token *token,
    5034                        const char *orig_path);
    5035 
    5036 /* The following definitions come from registry/reg_backend_current_version.c  */
    5037 
    5038 
    5039 /* The following definitions come from registry/reg_backend_db.c  */
    5040 
    5041 WERROR init_registry_key(const char *add_path);
    5042 WERROR init_registry_data(void);
    5043 WERROR regdb_init(void);
    5044 WERROR regdb_open( void );
    5045 int regdb_close( void );
    5046 WERROR regdb_transaction_start(void);
    5047 WERROR regdb_transaction_commit(void);
    5048 WERROR regdb_transaction_cancel(void);
    5049 int regdb_get_seqnum(void);
    5050 bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr);
    5051 int regdb_fetch_keys(const char *key, struct regsubkey_ctr *ctr);
    5052 int regdb_fetch_values(const char* key, struct regval_ctr *values);
    5053 bool regdb_store_values(const char *key, struct regval_ctr *values);
    5054 bool regdb_subkeys_need_update(struct regsubkey_ctr *subkeys);
    5055 bool regdb_values_need_update(struct regval_ctr *values);
    5056 
    5057 /* The following definitions come from registry/reg_backend_hkpt_params.c  */
    5058 
    5059 
    5060 /* The following definitions come from registry/reg_backend_netlogon_params.c  */
    5061 
    5062 
    5063 /* The following definitions come from registry/reg_backend_perflib.c  */
    5064 
    5065 
    5066 /* The following definitions come from registry/reg_backend_printing.c  */
    5067 
    5068 
    5069 /* The following definitions come from registry/reg_backend_prod_options.c  */
    5070 
    5071 
    5072 /* The following definitions come from registry/reg_backend_shares.c  */
    5073 
    5074 
    5075 /* The following definitions come from registry/reg_backend_smbconf.c  */
    5076 
    5077 
    5078 /* The following definitions come from registry/reg_backend_tcpip_params.c  */
    5079 
    5080 
    5081 /* The following definitions come from registry/reg_cachehook.c  */
    5082 
    5083 WERROR reghook_cache_init(void);
    5084 WERROR reghook_cache_add(const char *keyname, struct registry_ops *ops);
    5085 struct registry_ops *reghook_cache_find(const char *keyname);
    5086 void reghook_dump_cache( int debuglevel );
    5087 
    5088 /* The following definitions come from registry/reg_dispatcher.c  */
    5089 
    5090 bool store_reg_keys(struct registry_key_handle *key,
    5091                     struct regsubkey_ctr *subkeys);
    5092 bool store_reg_values(struct registry_key_handle *key, struct regval_ctr *val);
    5093 WERROR create_reg_subkey(struct registry_key_handle *key, const char *subkey);
    5094 WERROR delete_reg_subkey(struct registry_key_handle *key, const char *subkey);
    5095 int fetch_reg_keys(struct registry_key_handle *key,
    5096                    struct regsubkey_ctr *subkey_ctr);
    5097 int fetch_reg_values(struct registry_key_handle *key, struct regval_ctr *val);
    5098 bool regkey_access_check(struct registry_key_handle *key, uint32 requested,
    5099                          uint32 *granted,
    5100                          const struct nt_user_token *token);
    5101 WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, struct registry_key_handle *key,
    5102                           struct security_descriptor **psecdesc);
    5103 WERROR regkey_set_secdesc(struct registry_key_handle *key,
    5104                           struct security_descriptor *psecdesc);
    5105 bool reg_subkeys_need_update(struct registry_key_handle *key,
    5106                              struct regsubkey_ctr *subkeys);
    5107 bool reg_values_need_update(struct registry_key_handle *key,
    5108                             struct regval_ctr *values);
    5109 
    5110 /* The following definitions come from registry/reg_eventlog.c  */
    5111 
    5112 bool eventlog_init_keys(void);
    5113 bool eventlog_add_source( const char *eventlog, const char *sourcename,
    5114                           const char *messagefile );
    5115 
    5116 /* The following definitions come from registry/reg_init_basic.c  */
    5117 
    5118 WERROR registry_init_common(void);
    5119 WERROR registry_init_basic(void);
    5120 
    5121 /* The following definitions come from registry/reg_init_full.c  */
    5122 
    5123 WERROR registry_init_full(void);
    5124 
    5125 /* The following definitions come from registry/reg_init_smbconf.c  */
    5126 
    5127 NTSTATUS registry_create_admin_token(TALLOC_CTX *mem_ctx,
    5128                                      NT_USER_TOKEN **ptoken);
    5129 WERROR registry_init_smbconf(const char *keyname);
    5130 
    5131 /* The following definitions come from registry/reg_objects.c  */
    5132 
    5133 WERROR regsubkey_ctr_init(TALLOC_CTX *mem_ctx, struct regsubkey_ctr **ctr);
    5134 WERROR regsubkey_ctr_reinit(struct regsubkey_ctr *ctr);
    5135 WERROR regsubkey_ctr_set_seqnum(struct regsubkey_ctr *ctr, int seqnum);
    5136 int regsubkey_ctr_get_seqnum(struct regsubkey_ctr *ctr);
    5137 WERROR regsubkey_ctr_addkey( struct regsubkey_ctr *ctr, const char *keyname );
    5138 WERROR regsubkey_ctr_delkey( struct regsubkey_ctr *ctr, const char *keyname );
    5139 bool regsubkey_ctr_key_exists( struct regsubkey_ctr *ctr, const char *keyname );
    5140 int regsubkey_ctr_numkeys( struct regsubkey_ctr *ctr );
    5141 char* regsubkey_ctr_specific_key( struct regsubkey_ctr *ctr, uint32 key_index );
    5142 int regval_ctr_numvals(struct regval_ctr *ctr);
    5143 struct regval_blob* dup_registry_value(struct regval_blob *val);
    5144 void free_registry_value(struct regval_blob *val);
    5145 uint8* regval_data_p(struct regval_blob *val);
    5146 uint32 regval_size(struct regval_blob *val);
    5147 char* regval_name(struct regval_blob *val);
    5148 uint32 regval_type(struct regval_blob *val);
    5149 struct regval_blob* regval_ctr_specific_value(struct regval_ctr *ctr,
    5150                                               uint32 idx);
    5151 bool regval_ctr_key_exists(struct regval_ctr *ctr, const char *value);
    5152 struct regval_blob *regval_compose(TALLOC_CTX *ctx, const char *name,
    5153                                    uint16 type,
    5154                                    const char *data_p, size_t size);
    5155 int regval_ctr_addvalue(struct regval_ctr *ctr, const char *name, uint16 type,
    5156                         const char *data_p, size_t size);
    5157 int regval_ctr_addvalue_sz(struct regval_ctr *ctr, const char *name, const char *data);
    5158 int regval_ctr_addvalue_multi_sz(struct regval_ctr *ctr, const char *name, const char **data);
    5159 int regval_ctr_copyvalue(struct regval_ctr *ctr, struct regval_blob *val);
    5160 int regval_ctr_delvalue(struct regval_ctr *ctr, const char *name);
    5161 struct regval_blob* regval_ctr_getvalue(struct regval_ctr *ctr,
    5162                                         const char *name);
    5163 uint32 regval_dword(struct regval_blob *val);
    5164 const char *regval_sz(struct regval_blob *val);
    5165 
    5166 /* The following definitions come from registry/reg_perfcount.c  */
    5167 
    5168 void perfcount_init_keys( void );
    5169 uint32 reg_perfcount_get_base_index(void);
    5170 uint32 reg_perfcount_get_last_counter(uint32 base_index);
    5171 uint32 reg_perfcount_get_last_help(uint32 last_counter);
    5172 uint32 reg_perfcount_get_counter_help(uint32 base_index, char **retbuf);
    5173 uint32 reg_perfcount_get_counter_names(uint32 base_index, char **retbuf);
    5174 WERROR reg_perfcount_get_hkpd(prs_struct *ps, uint32 max_buf_size, uint32 *outbuf_len, const char *object_ids);
    5175 
    5176 /* The following definitions come from registry/reg_util.c  */
    5177 
    5178 bool reg_split_path(char *path, char **base, char **new_path);
    5179 bool reg_split_key(char *path, char **base, char **key);
    5180 char *normalize_reg_path(TALLOC_CTX *ctx, const char *keyname );
    5181 void normalize_dbkey(char *key);
    5182 char *reg_remaining_path(TALLOC_CTX *ctx, const char *key);
    5183 
    5184 /* The following definitions come from registry/reg_util_legacy.c  */
    5185 
    5186 WERROR regkey_open_internal(TALLOC_CTX *ctx,
    5187                             struct registry_key_handle **regkey,
    5188                             const char *path,
    5189                             const struct nt_user_token *token,
    5190                             uint32 access_desired );
    5191 
    5192 /* The following definitions come from registry/regfio.c  */
    5193 
    5194 
    5195 /* The following definitions come from rpc_client/cli_lsarpc.c  */
    5196 
    5197 NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
    5198                                 TALLOC_CTX *mem_ctx,
    5199                                 bool sec_qos, uint32 des_access,
    5200                                 struct policy_handle *pol);
    5201 NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
    5202                                  TALLOC_CTX *mem_ctx, bool sec_qos,
    5203                                  uint32 des_access, struct policy_handle *pol);
    5204 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
    5205                                 TALLOC_CTX *mem_ctx,
    5206                                 struct policy_handle *pol,
    5207                                 int num_sids,
    5208                                 const DOM_SID *sids,
    5209                                 char ***pdomains,
    5210                                 char ***pnames,
    5211                                 enum lsa_SidType **ptypes);
    5212 NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli,
    5213                                  TALLOC_CTX *mem_ctx,
    5214                                  struct policy_handle *pol,
    5215                                  int num_sids,
    5216                                  const DOM_SID *sids,
    5217                                  char ***pdomains,
    5218                                  char ***pnames,
    5219                                  enum lsa_SidType **ptypes);
    5220 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
    5221                                  TALLOC_CTX *mem_ctx,
    5222                                  struct policy_handle *pol, int num_names,
    5223                                  const char **names,
    5224                                  const char ***dom_names,
    5225                                  int level,
    5226                                  DOM_SID **sids,
    5227                                  enum lsa_SidType **types);
    5228 NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
    5229                                   TALLOC_CTX *mem_ctx,
    5230                                   struct policy_handle *pol, int num_names,
    5231                                   const char **names,
    5232                                   const char ***dom_names,
    5233                                   int level,
    5234                                   DOM_SID **sids,
    5235                                   enum lsa_SidType **types);
    5236 
    5237 bool fetch_domain_sid( char *domain, char *remote_machine, DOM_SID *psid);
    5238 
    5239 /* The following definitions come from rpc_client/cli_netlogon.c  */
    5240 
    5241 NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
    5242                                      const char *server_name,
    5243                                      const char *domain,
    5244                                      const char *clnt_name,
    5245                                      const char *machine_account,
    5246                                      const unsigned char machine_pwd[16],
    5247                                      enum netr_SchannelType sec_chan_type,
    5248                                      uint32_t *neg_flags_inout);
    5249 NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
    5250                                    TALLOC_CTX *mem_ctx,
    5251                                    uint32 logon_parameters,
    5252                                    const char *domain,
    5253                                    const char *username,
    5254                                    const char *password,
    5255                                    const char *workstation,
    5256                                    int logon_type);
    5257 NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
    5258                                            TALLOC_CTX *mem_ctx,
    5259                                            uint32 logon_parameters,
    5260                                            const char *server,
    5261                                            const char *username,
    5262                                            const char *domain,
    5263                                            const char *workstation,
    5264                                            const uint8 chal[8],
    5265                                            uint16_t validation_level,
    5266                                            DATA_BLOB lm_response,
    5267                                            DATA_BLOB nt_response,
    5268                                            struct netr_SamInfo3 **info3);
    5269 NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
    5270                                               TALLOC_CTX *mem_ctx,
    5271                                               uint32 logon_parameters,
    5272                                               const char *server,
    5273                                               const char *username,
    5274                                               const char *domain,
    5275                                               const char *workstation,
    5276                                               const uint8 chal[8],
    5277                                               uint16_t validation_level,
    5278                                               DATA_BLOB lm_response,
    5279                                               DATA_BLOB nt_response,
    5280                                               struct netr_SamInfo3 **info3);
    5281 NTSTATUS rpccli_netlogon_set_trust_password(struct rpc_pipe_client *cli,
    5282                                             TALLOC_CTX *mem_ctx,
    5283                                             const char *account_name,
    5284                                             const unsigned char orig_trust_passwd_hash[16],
    5285                                             const char *new_trust_pwd_cleartext,
    5286                                             const unsigned char new_trust_passwd_hash[16],
    5287                                             enum netr_SchannelType sec_channel_type);
    5288 
    5289 /* The following definitions come from rpc_client/cli_pipe.c  */
    5290 
    5291 struct tevent_req *rpc_api_pipe_req_send(TALLOC_CTX *mem_ctx,
    5292                                          struct event_context *ev,
    5293                                          struct rpc_pipe_client *cli,
    5294                                          uint8_t op_num,
    5295                                          prs_struct *req_data);
    5296 NTSTATUS rpc_api_pipe_req_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
    5297                                prs_struct *reply_pdu);
    5298 struct tevent_req *rpc_pipe_bind_send(TALLOC_CTX *mem_ctx,
    5299                                       struct event_context *ev,
    5300                                       struct rpc_pipe_client *cli,
    5301                                       struct cli_pipe_auth_data *auth);
    5302 NTSTATUS rpc_pipe_bind_recv(struct tevent_req *req);
    5303 NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
    5304                        struct cli_pipe_auth_data *auth);
    5305 unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
    5306                                 unsigned int timeout);
    5307 bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli);
    5308 bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
    5309 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
    5310                                struct cli_pipe_auth_data **presult);
    5311 NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
    5312                                    enum dcerpc_AuthLevel auth_level,
    5313                                    struct netlogon_creds_CredentialState *creds,
    5314                                    struct cli_pipe_auth_data **presult);
    5315 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
    5316                            const struct ndr_syntax_id *abstract_syntax,
    5317                            struct rpc_pipe_client **presult);
    5318 NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
    5319                                const struct ndr_syntax_id *abstract_syntax,
    5320                                struct rpc_pipe_client **presult);
    5321 NTSTATUS rpc_pipe_open_internal(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *abstract_syntax,
    5322                                 NTSTATUS (*dispatch) (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, uint32_t opnum, void *r),
    5323                                 struct auth_serversupplied_info *serversupplied_info,
    5324                                 struct rpc_pipe_client **presult);
    5325 NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
    5326                                   const struct ndr_syntax_id *interface,
    5327                                   struct rpc_pipe_client **presult);
    5328 NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
    5329                                             enum dcerpc_transport_t transport,
    5330                                             const struct ndr_syntax_id *interface,
    5331                                             struct rpc_pipe_client **presult);
    5332 NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
    5333                                    const struct ndr_syntax_id *interface,
    5334                                    enum dcerpc_transport_t transport,
    5335                                    enum dcerpc_AuthLevel auth_level,
    5336                                    const char *domain,
    5337                                    const char *username,
    5338                                    const char *password,
    5339                                    struct rpc_pipe_client **presult);
    5340 NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
    5341                                           const struct ndr_syntax_id *interface,
    5342                                           enum dcerpc_transport_t transport,
    5343                                           enum dcerpc_AuthLevel auth_level,
    5344                                           const char *domain,
    5345                                           const char *username,
    5346                                           const char *password,
    5347                                           struct rpc_pipe_client **presult);
    5348 NTSTATUS get_schannel_session_key(struct cli_state *cli,
    5349                                   const char *domain,
    5350                                   uint32 *pneg_flags,
    5351                                   struct rpc_pipe_client **presult);
    5352 NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
    5353                                              const struct ndr_syntax_id *interface,
    5354                                              enum dcerpc_transport_t transport,
    5355                                              enum dcerpc_AuthLevel auth_level,
    5356                                              const char *domain,
    5357                                              struct netlogon_creds_CredentialState **pdc,
    5358                                              struct rpc_pipe_client **presult);
    5359 NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
    5360                                                  const struct ndr_syntax_id *interface,
    5361                                                  enum dcerpc_transport_t transport,
    5362                                                  enum dcerpc_AuthLevel auth_level,
    5363                                                  const char *domain,
    5364                                                  const char *username,
    5365                                                  const char *password,
    5366                                                  struct rpc_pipe_client **presult);
    5367 NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
    5368                                     const struct ndr_syntax_id *interface,
    5369                                     enum dcerpc_transport_t transport,
    5370                                     enum dcerpc_AuthLevel auth_level,
    5371                                     const char *domain,
    5372                                     struct rpc_pipe_client **presult);
    5373 NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
    5374                                 const struct ndr_syntax_id *interface,
    5375                                 enum dcerpc_AuthLevel auth_level,
    5376                                 const char *service_princ,
    5377                                 const char *username,
    5378                                 const char *password,
    5379                                 struct rpc_pipe_client **presult);
    5380 NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx,
    5381                              struct rpc_pipe_client *cli,
    5382                              DATA_BLOB *session_key);
    5383 NTSTATUS rpc_pipe_open_local(TALLOC_CTX *mem_ctx,
    5384                              struct rpc_cli_smbd_conn *conn,
    5385                              const struct ndr_syntax_id *syntax,
    5386                              struct rpc_pipe_client **presult);
    5387 
    5388 /* The following definitions come from rpc_client/rpc_transport_np.c  */
    5389 
    5390 struct tevent_req *rpc_transport_np_init_send(TALLOC_CTX *mem_ctx,
    5391                                               struct event_context *ev,
    5392                                               struct cli_state *cli,
    5393                                               const struct ndr_syntax_id *abstract_syntax);
    5394 NTSTATUS rpc_transport_np_init_recv(struct tevent_req *req,
    5395                                     TALLOC_CTX *mem_ctx,
    5396                                     struct rpc_cli_transport **presult);
    5397 NTSTATUS rpc_transport_np_init(TALLOC_CTX *mem_ctx, struct cli_state *cli,
    5398                                const struct ndr_syntax_id *abstract_syntax,
    5399                                struct rpc_cli_transport **presult);
    5400 struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p);
    5401 
    5402 /* The following definitions come from rpc_client/rpc_transport_smbd.c  */
    5403 
    5404 struct tevent_req *rpc_cli_smbd_conn_init_send(TALLOC_CTX *mem_ctx,
    5405                                                struct event_context *ev,
    5406                                                void (*stdout_callback)(char *buf,
    5407                                                                        size_t len,
    5408                                                                        void *priv),
    5409                                                void *priv);
    5410 NTSTATUS rpc_cli_smbd_conn_init_recv(struct tevent_req *req,
    5411                                      TALLOC_CTX *mem_ctx,
    5412                                      struct rpc_cli_smbd_conn **pconn);
    5413 NTSTATUS rpc_cli_smbd_conn_init(TALLOC_CTX *mem_ctx,
    5414                                 struct rpc_cli_smbd_conn **pconn,
    5415                                 void (*stdout_callback)(char *buf,
    5416                                                         size_t len,
    5417                                                         void *priv),
    5418                                 void *priv);
    5419 
    5420 struct tevent_req *rpc_transport_smbd_init_send(TALLOC_CTX *mem_ctx,
    5421                                                 struct event_context *ev,
    5422                                                 struct rpc_cli_smbd_conn *conn,
    5423                                                 const struct ndr_syntax_id *abstract_syntax);
    5424 NTSTATUS rpc_transport_smbd_init_recv(struct tevent_req *req,
    5425                                       TALLOC_CTX *mem_ctx,
    5426                                       struct rpc_cli_transport **presult);
    5427 NTSTATUS rpc_transport_smbd_init(TALLOC_CTX *mem_ctx,
    5428                                  struct rpc_cli_smbd_conn *conn,
    5429                                  const struct ndr_syntax_id *abstract_syntax,
    5430                                  struct rpc_cli_transport **presult);
    5431 struct cli_state *rpc_pipe_smbd_smb_conn(struct rpc_pipe_client *p);
    5432 
    5433 /* The following definitions come from rpc_client/rpc_transport_sock.c  */
    5434 
    5435 NTSTATUS rpc_transport_sock_init(TALLOC_CTX *mem_ctx, int fd,
    5436                                  struct rpc_cli_transport **presult);
    5437 
    5438 /* The following definitions come from rpc_client/cli_samr.c  */
    5439 
    5440 NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli,
    5441                                     TALLOC_CTX *mem_ctx,
    5442                                     struct policy_handle *user_handle,
    5443                                     const char *newpassword,
    5444                                     const char *oldpassword);
    5445 NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli,
    5446                                      TALLOC_CTX *mem_ctx,
    5447                                      const char *username,
    5448                                      const char *newpassword,
    5449                                      const char *oldpassword);
    5450 NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli,
    5451                                          TALLOC_CTX *mem_ctx,
    5452                                          const char *username,
    5453                                          DATA_BLOB new_nt_password_blob,
    5454                                          DATA_BLOB old_nt_hash_enc_blob,
    5455                                          DATA_BLOB new_lm_password_blob,
    5456                                          DATA_BLOB old_lm_hash_enc_blob);
    5457 NTSTATUS rpccli_samr_chgpasswd_user3(struct rpc_pipe_client *cli,
    5458                                      TALLOC_CTX *mem_ctx,
    5459                                      const char *username,
    5460                                      const char *newpassword,
    5461                                      const char *oldpassword,
    5462                                      struct samr_DomInfo1 **dominfo1,
    5463                                      struct samr_ChangeReject **reject);
    5464 void get_query_dispinfo_params(int loop_count, uint32 *max_entries,
    5465                                uint32 *max_size);
    5466 NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli,
    5467                                   TALLOC_CTX *mem_ctx,
    5468                                   uint32_t access_mask,
    5469                                   struct policy_handle *connect_pol);
    5470 
    5471 /* The following definitions come from rpc_client/cli_spoolss.c  */
    5472 
    5473 WERROR rpccli_spoolss_openprinter_ex(struct rpc_pipe_client *cli,
    5474                                      TALLOC_CTX *mem_ctx,
    5475                                      const char *printername,
    5476                                      uint32_t access_desired,
    5477                                      struct policy_handle *handle);
    5478 WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli,
    5479                                        TALLOC_CTX *mem_ctx,
    5480                                        struct policy_handle *handle,
    5481                                        const char *architecture,
    5482                                        uint32_t level,
    5483                                        uint32_t offered,
    5484                                        union spoolss_DriverInfo *info);
    5485 WERROR rpccli_spoolss_getprinterdriver2(struct rpc_pipe_client *cli,
    5486                                         TALLOC_CTX *mem_ctx,
    5487                                         struct policy_handle *handle,
    5488                                         const char *architecture,
    5489                                         uint32_t level,
    5490                                         uint32_t offered,
    5491                                         uint32_t client_major_version,
    5492                                         uint32_t client_minor_version,
    5493                                         union spoolss_DriverInfo *info,
    5494                                         uint32_t *server_major_version,
    5495                                         uint32_t *server_minor_version);
    5496 WERROR rpccli_spoolss_addprinterex(struct rpc_pipe_client *cli,
    5497                                    TALLOC_CTX *mem_ctx,
    5498                                    struct spoolss_SetPrinterInfoCtr *info_ctr);
    5499 WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli,
    5500                                  TALLOC_CTX *mem_ctx,
    5501                                  struct policy_handle *handle,
    5502                                  uint32_t level,
    5503                                  uint32_t offered,
    5504                                  union spoolss_PrinterInfo *info);
    5505 WERROR rpccli_spoolss_getjob(struct rpc_pipe_client *cli,
    5506                              TALLOC_CTX *mem_ctx,
    5507                              struct policy_handle *handle,
    5508                              uint32_t job_id,
    5509                              uint32_t level,
    5510                              uint32_t offered,
    5511                              union spoolss_JobInfo *info);
    5512 WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli,
    5513                                 TALLOC_CTX *mem_ctx,
    5514                                 struct policy_handle *handle,
    5515                                 uint32_t level,
    5516                                 uint32_t offered,
    5517                                 uint32_t *count,
    5518                                 union spoolss_FormInfo **info);
    5519 WERROR rpccli_spoolss_enumprintprocessors(struct rpc_pipe_client *cli,
    5520                                           TALLOC_CTX *mem_ctx,
    5521                                           const char *servername,
    5522                                           const char *environment,
    5523                                           uint32_t level,
    5524                                           uint32_t offered,
    5525                                           uint32_t *count,
    5526                                           union spoolss_PrintProcessorInfo **info);
    5527 WERROR rpccli_spoolss_enumprintprocessordatatypes(struct rpc_pipe_client *cli,
    5528                                                   TALLOC_CTX *mem_ctx,
    5529                                                   const char *servername,
    5530                                                   const char *print_processor_name,
    5531                                                   uint32_t level,
    5532                                                   uint32_t offered,
    5533                                                   uint32_t *count,
    5534                                                   union spoolss_PrintProcDataTypesInfo **info);
    5535 WERROR rpccli_spoolss_enumports(struct rpc_pipe_client *cli,
    5536                                 TALLOC_CTX *mem_ctx,
    5537                                 const char *servername,
    5538                                 uint32_t level,
    5539                                 uint32_t offered,
    5540                                 uint32_t *count,
    5541                                 union spoolss_PortInfo **info);
    5542 WERROR rpccli_spoolss_enummonitors(struct rpc_pipe_client *cli,
    5543                                    TALLOC_CTX *mem_ctx,
    5544                                    const char *servername,
    5545                                    uint32_t level,
    5546                                    uint32_t offered,
    5547                                    uint32_t *count,
    5548                                    union spoolss_MonitorInfo **info);
    5549 WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli,
    5550                                TALLOC_CTX *mem_ctx,
    5551                                struct policy_handle *handle,
    5552                                uint32_t firstjob,
    5553                                uint32_t numjobs,
    5554                                uint32_t level,
    5555                                uint32_t offered,
    5556                                uint32_t *count,
    5557                                union spoolss_JobInfo **info);
    5558 WERROR rpccli_spoolss_enumprinterdrivers(struct rpc_pipe_client *cli,
    5559                                          TALLOC_CTX *mem_ctx,
    5560                                          const char *server,
    5561                                          const char *environment,
    5562                                          uint32_t level,
    5563                                          uint32_t offered,
    5564                                          uint32_t *count,
    5565                                          union spoolss_DriverInfo **info);
    5566 WERROR rpccli_spoolss_enumprinters(struct rpc_pipe_client *cli,
    5567                                    TALLOC_CTX *mem_ctx,
    5568                                    uint32_t flags,
    5569                                    const char *server,
    5570                                    uint32_t level,
    5571                                    uint32_t offered,
    5572                                    uint32_t *count,
    5573                                    union spoolss_PrinterInfo **info);
    5574 WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
    5575                                      TALLOC_CTX *mem_ctx,
    5576                                      struct policy_handle *handle,
    5577                                      const char *value_name,
    5578                                      uint32_t offered,
    5579                                      enum winreg_Type *type,
    5580                                      uint32_t *needed_p,
    5581                                      uint8_t **data_p);
    5582 WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli,
    5583                                      TALLOC_CTX *mem_ctx,
    5584                                      struct policy_handle *handle,
    5585                                      const char *key_name,
    5586                                      const char ***key_buffer,
    5587                                      uint32_t offered);
    5588 WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli,
    5589                                         TALLOC_CTX *mem_ctx,
    5590                                         struct policy_handle *handle,
    5591                                         const char *key_name,
    5592                                         uint32_t offered,
    5593                                         uint32_t *count,
    5594                                         struct spoolss_PrinterEnumValues **info);
    5595 
    5596 /* The following definitions come from rpc_client/init_spoolss.c  */
    5597 
    5598 bool init_systemtime(struct spoolss_Time *r,
    5599                      struct tm *unixtime);
    5600 WERROR pull_spoolss_PrinterData(TALLOC_CTX *mem_ctx,
    5601                                 const DATA_BLOB *blob,
    5602                                 union spoolss_PrinterData *data,
    5603                                 enum winreg_Type type);
    5604 WERROR push_spoolss_PrinterData(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
    5605                                 enum winreg_Type type,
    5606                                 union spoolss_PrinterData *data);
    5607 void spoolss_printerinfo2_to_setprinterinfo2(const struct spoolss_PrinterInfo2 *i,
    5608                                              struct spoolss_SetPrinterInfo2 *s);
    5609 
    5610 /* The following definitions come from rpc_client/init_lsa.c  */
    5611 
    5612 void init_lsa_String(struct lsa_String *name, const char *s);
    5613 void init_lsa_StringLarge(struct lsa_StringLarge *name, const char *s);
    5614 void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s);
    5615 void init_lsa_AsciiStringLarge(struct lsa_AsciiStringLarge *name, const char *s);
    5616 
    5617 /* The following definitions come from rpc_client/init_netlogon.c  */
    5618 
    5619 NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info,
    5620                                 uint8_t *pipe_session_key,
    5621                                 size_t pipe_session_key_len,
    5622                                 struct netr_SamInfo2 *sam2);
    5623 NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info,
    5624                                 uint8_t *pipe_session_key,
    5625                                 size_t pipe_session_key_len,
    5626                                 struct netr_SamInfo3 *sam3);
    5627 NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info,
    5628                                 uint8_t *pipe_session_key,
    5629                                 size_t pipe_session_key_len,
    5630                                 struct netr_SamInfo6 *sam6);
    5631 void init_netr_CryptPassword(const char *pwd,
    5632                              unsigned char session_key[16],
    5633                              struct netr_CryptPassword *pwd_buf);
    5634 
    5635 /* The following definitions come from rpc_client/init_samr.c  */
    5636 
    5637 void init_samr_CryptPasswordEx(const char *pwd,
    5638                                DATA_BLOB *session_key,
    5639                                struct samr_CryptPasswordEx *pwd_buf);
    5640 void init_samr_CryptPassword(const char *pwd,
    5641                              DATA_BLOB *session_key,
    5642                              struct samr_CryptPassword *pwd_buf);
    5643 
    5644 /* The following definitions come from rpc_client/ndr.c  */
    5645 
    5646 struct tevent_req *cli_do_rpc_ndr_send(TALLOC_CTX *mem_ctx,
    5647                                        struct tevent_context *ev,
    5648                                        struct rpc_pipe_client *cli,
    5649                                        const struct ndr_interface_table *table,
    5650                                        uint32_t opnum,
    5651                                        void *r);
    5652 NTSTATUS cli_do_rpc_ndr_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx);
    5653 NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
    5654                         TALLOC_CTX *mem_ctx,
    5655                         const struct ndr_interface_table *table,
    5656                         uint32 opnum, void *r);
    5657 
    5658 /* The following definitions come from rpc_parse/parse_misc.c  */
    5659 
    5660 bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth);
    5661 bool smb_io_uuid(const char *desc, struct GUID *uuid,
    5662                  prs_struct *ps, int depth);
    5663 
    5664 /* The following definitions come from rpc_parse/parse_prs.c  */
    5665 
    5666 void prs_dump(const char *name, int v, prs_struct *ps);
    5667 void prs_dump_before(const char *name, int v, prs_struct *ps);
    5668 void prs_dump_region(const char *name, int v, prs_struct *ps,
    5669                      int from_off, int to_off);
    5670 void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name);
    5671 bool prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, bool io);
    5672 void prs_mem_free(prs_struct *ps);
    5673 void prs_mem_clear(prs_struct *ps);
    5674 char *prs_alloc_mem_(prs_struct *ps, size_t size, unsigned int count);
    5675 char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count);
    5676 TALLOC_CTX *prs_get_mem_context(prs_struct *ps);
    5677 void prs_give_memory(prs_struct *ps, char *buf, uint32 size, bool is_dynamic);
    5678 char *prs_take_memory(prs_struct *ps, uint32 *psize);
    5679 bool prs_set_buffer_size(prs_struct *ps, uint32 newsize);
    5680 bool prs_grow(prs_struct *ps, uint32 extra_space);
    5681 bool prs_force_grow(prs_struct *ps, uint32 extra_space);
    5682 char *prs_data_p(prs_struct *ps);
    5683 uint32 prs_data_size(prs_struct *ps);
    5684 uint32 prs_offset(prs_struct *ps);
    5685 bool prs_set_offset(prs_struct *ps, uint32 offset);
    5686 bool prs_append_prs_data(prs_struct *dst, prs_struct *src);
    5687 bool prs_append_some_data(prs_struct *dst, void *src_base, uint32_t start,
    5688                           uint32_t len);
    5689 bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len);
    5690 bool prs_copy_data_in(prs_struct *dst, const char *src, uint32 len);
    5691 bool prs_copy_data_out(char *dst, prs_struct *src, uint32 len);
    5692 bool prs_copy_all_data_out(char *dst, prs_struct *src);
    5693 void prs_set_endian_data(prs_struct *ps, bool endian);
    5694 bool prs_align(prs_struct *ps);
    5695 bool prs_align_uint16(prs_struct *ps);
    5696 bool prs_align_uint64(prs_struct *ps);
    5697 bool prs_align_custom(prs_struct *ps, uint8 boundary);
    5698 bool prs_align_needed(prs_struct *ps, uint32 needed);
    5699 char *prs_mem_get(prs_struct *ps, uint32 extra_size);
    5700 void prs_switch_type(prs_struct *ps, bool io);
    5701 void prs_force_dynamic(prs_struct *ps);
    5702 void prs_set_session_key(prs_struct *ps, const char sess_key[16]);
    5703 bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8);
    5704 bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16);
    5705 bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32);
    5706 bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32);
    5707 bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64);
    5708 bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status);
    5709 bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len);
    5710 bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len);
    5711 bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len);
    5712 bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str);
    5713 bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
    5714 bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
    5715 
    5716 /* The following definitions come from rpc_parse/parse_rpc.c  */
    5717 
    5718 bool smb_register_ndr_interface(const struct ndr_interface_table *interface);
    5719 const struct ndr_interface_table *get_iface_from_syntax(
    5720         const struct ndr_syntax_id *syntax);
    5721 const char *get_pipe_name_from_syntax(TALLOC_CTX *mem_ctx,
    5722                                       const struct ndr_syntax_id *syntax);
    5723 void init_rpc_hdr(RPC_HDR *hdr, enum dcerpc_pkt_type pkt_type, uint8 flags,
    5724                                 uint32 call_id, int data_len, int auth_len);
    5725 bool smb_io_rpc_hdr(const char *desc,  RPC_HDR *rpc, prs_struct *ps, int depth);
    5726 void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id,
    5727                       const struct ndr_syntax_id *abstract,
    5728                       const struct ndr_syntax_id *transfer);
    5729 void init_rpc_hdr_rb(RPC_HDR_RB *rpc,
    5730                                 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
    5731                                 RPC_CONTEXT *context);
    5732 bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth);
    5733 bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth);
    5734 void init_rpc_hdr_ba(RPC_HDR_BA *rpc,
    5735                                 uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid,
    5736                                 const char *pipe_addr,
    5737                                 uint8 num_results, uint16 result, uint16 reason,
    5738                                 const struct ndr_syntax_id *transfer);
    5739 bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth);
    5740 void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum);
    5741 bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth);
    5742 bool smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth);
    5743 bool smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth);
    5744 void init_rpc_hdr_auth(RPC_HDR_AUTH *rai,
    5745                                 uint8 auth_type, uint8 auth_level,
    5746                                 uint8 auth_pad_len,
    5747                                 uint32 auth_context_id);
    5748 bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth);
    5749 
    5750 /* The following definitions come from lib/eventlog/eventlog.c  */
    5751 
    5752 TDB_CONTEXT *elog_init_tdb( char *tdbfilename );
    5753 char *elog_tdbname(TALLOC_CTX *ctx, const char *name );
    5754 int elog_tdb_size( TDB_CONTEXT * tdb, int *MaxSize, int *Retention );
    5755 bool prune_eventlog( TDB_CONTEXT * tdb );
    5756 ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only );
    5757 int elog_close_tdb( ELOG_TDB *etdb, bool force_close );
    5758 bool parse_logentry( TALLOC_CTX *mem_ctx, char *line, struct eventlog_Record_tdb *entry, bool * eor );
    5759 size_t fixup_eventlog_record_tdb(struct eventlog_Record_tdb *r);
    5760 struct eventlog_Record_tdb *evlog_pull_record_tdb(TALLOC_CTX *mem_ctx,
    5761                                                   TDB_CONTEXT *tdb,
    5762                                                   uint32_t record_number);
    5763 NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx,
    5764                                TDB_CONTEXT *tdb,
    5765                                struct eventlog_Record_tdb *r,
    5766                                uint32_t *record_number);
    5767 NTSTATUS evlog_push_record(TALLOC_CTX *mem_ctx,
    5768                            TDB_CONTEXT *tdb,
    5769                            struct EVENTLOGRECORD *r,
    5770                            uint32_t *record_number);
    5771 struct EVENTLOGRECORD *evlog_pull_record(TALLOC_CTX *mem_ctx,
    5772                                          TDB_CONTEXT *tdb,
    5773                                          uint32_t record_number);
    5774 NTSTATUS evlog_evt_entry_to_tdb_entry(TALLOC_CTX *mem_ctx,
    5775                                       const struct EVENTLOGRECORD *e,
    5776                                       struct eventlog_Record_tdb *t);
    5777 NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
    5778                                       const struct eventlog_Record_tdb *t,
    5779                                       struct EVENTLOGRECORD *e);
    5780 NTSTATUS evlog_convert_tdb_to_evt(TALLOC_CTX *mem_ctx,
    5781                                   ELOG_TDB *etdb,
    5782                                   DATA_BLOB *blob_p,
    5783                                   uint32_t *num_records_p);
    5784 
    5785 /* The following definitions come from rpc_server/srv_eventlog_nt.c  */
    5786 
    5787 /* The following definitions come from rpc_server/srv_lsa_hnd.c  */
    5788 
    5789 size_t num_pipe_handles(struct handle_list *list);
    5790 bool init_pipe_handle_list(pipes_struct *p,
    5791                            const struct ndr_syntax_id *syntax);
    5792 bool create_policy_hnd(pipes_struct *p, struct policy_handle *hnd, void *data_ptr);
    5793 bool find_policy_by_hnd(pipes_struct *p, const struct policy_handle *hnd,
    5794                         void **data_p);
    5795 bool close_policy_hnd(pipes_struct *p, struct policy_handle *hnd);
    5796 void close_policy_by_pipe(pipes_struct *p);
    5797 bool pipe_access_check(pipes_struct *p);
    5798 
    5799 void *_policy_handle_create(struct pipes_struct *p, struct policy_handle *hnd,
    5800                             uint32_t access_granted, size_t data_size,
    5801                             const char *type, NTSTATUS *pstatus);
    5802 #define policy_handle_create(_p, _hnd, _access, _type, _pstatus) \
    5803         (_type *)_policy_handle_create((_p), (_hnd), (_access), sizeof(_type), #_type, \
    5804                                        (_pstatus))
    5805 
    5806 void *_policy_handle_find(struct pipes_struct *p,
    5807                           const struct policy_handle *hnd,
    5808                           uint32_t access_required, uint32_t *paccess_granted,
    5809                           const char *name, const char *location,
    5810                           NTSTATUS *pstatus);
    5811 #define policy_handle_find(_p, _hnd, _access_required, _access_granted, _type, _pstatus) \
    5812         (_type *)_policy_handle_find((_p), (_hnd), (_access_required), \
    5813                                      (_access_granted), #_type, __location__, (_pstatus))
    5814 
    5815 
    5816 /* The following definitions come from rpc_server/srv_pipe.c  */
    5817 
    5818 bool create_next_pdu(pipes_struct *p);
    5819 bool api_pipe_bind_auth3(pipes_struct *p, prs_struct *rpc_in_p);
    5820 bool setup_fault_pdu(pipes_struct *p, NTSTATUS status);
    5821 bool setup_cancel_ack_reply(pipes_struct *p, prs_struct *rpc_in_p);
    5822 NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
    5823                                     const char *srv,
    5824                                     const struct ndr_syntax_id *interface,
    5825                                     const struct api_struct *cmds, int size);
    5826 NTSTATUS rpc_srv_register(int version, const char *clnt,
    5827                           const char *srv,
    5828                           const struct ndr_interface_table *iface,
    5829                           const struct api_struct *cmds, int size);
    5830 bool is_known_pipename(const char *cli_filename, struct ndr_syntax_id *syntax);
    5831 bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p);
    5832 bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p);
    5833 bool api_pipe_ntlmssp_auth_process(pipes_struct *p, prs_struct *rpc_in,
    5834                                         uint32 *p_ss_padding_len, NTSTATUS *pstatus);
    5835 bool api_pipe_schannel_process(pipes_struct *p, prs_struct *rpc_in, uint32 *p_ss_padding_len);
    5836 void free_pipe_rpc_context( PIPE_RPC_FNS *list );
    5837 bool api_pipe_request(pipes_struct *p);
    5838 
    5839 /* The following definitions come from rpc_server/srv_pipe_hnd.c  */
    5840 
    5841 pipes_struct *get_first_internal_pipe(void);
    5842 pipes_struct *get_next_internal_pipe(pipes_struct *p);
    5843 
    5844 bool fsp_is_np(struct files_struct *fsp);
    5845 NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name,
    5846                  const char *client_address,
    5847                  struct auth_serversupplied_info *server_info,
    5848                  struct fake_file_handle **phandle);
    5849 struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    5850                                  struct fake_file_handle *handle,
    5851                                  const uint8_t *data, size_t len);
    5852 NTSTATUS np_write_recv(struct tevent_req *req, ssize_t *pnwritten);
    5853 struct tevent_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
    5854                                 struct fake_file_handle *handle,
    5855                                 uint8_t *data, size_t len);
    5856 NTSTATUS np_read_recv(struct tevent_req *req, ssize_t *nread,
    5857                       bool *is_data_outstanding);
    5858 
    5859 /* The following definitions come from rpc_server/srv_samr_util.c  */
    5860 
    5861 void copy_id2_to_sam_passwd(struct samu *to,
    5862                             struct samr_UserInfo2 *from);
    5863 void copy_id4_to_sam_passwd(struct samu *to,
    5864                             struct samr_UserInfo4 *from);
    5865 void copy_id6_to_sam_passwd(struct samu *to,
    5866                             struct samr_UserInfo6 *from);
    5867 void copy_id8_to_sam_passwd(struct samu *to,
    5868                             struct samr_UserInfo8 *from);
    5869 void copy_id10_to_sam_passwd(struct samu *to,
    5870                              struct samr_UserInfo10 *from);
    5871 void copy_id11_to_sam_passwd(struct samu *to,
    5872                              struct samr_UserInfo11 *from);
    5873 void copy_id12_to_sam_passwd(struct samu *to,
    5874                              struct samr_UserInfo12 *from);
    5875 void copy_id13_to_sam_passwd(struct samu *to,
    5876                              struct samr_UserInfo13 *from);
    5877 void copy_id14_to_sam_passwd(struct samu *to,
    5878                              struct samr_UserInfo14 *from);
    5879 void copy_id16_to_sam_passwd(struct samu *to,
    5880                              struct samr_UserInfo16 *from);
    5881 void copy_id17_to_sam_passwd(struct samu *to,
    5882                              struct samr_UserInfo17 *from);
    5883 void copy_id18_to_sam_passwd(struct samu *to,
    5884                              struct samr_UserInfo18 *from);
    5885 void copy_id20_to_sam_passwd(struct samu *to,
    5886                              struct samr_UserInfo20 *from);
    5887 void copy_id21_to_sam_passwd(const char *log_prefix,
    5888                              struct samu *to,
    5889                              struct samr_UserInfo21 *from);
    5890 void copy_id23_to_sam_passwd(struct samu *to,
    5891                              struct samr_UserInfo23 *from);
    5892 void copy_id24_to_sam_passwd(struct samu *to,
    5893                              struct samr_UserInfo24 *from);
    5894 void copy_id25_to_sam_passwd(struct samu *to,
    5895                              struct samr_UserInfo25 *from);
    5896 void copy_id26_to_sam_passwd(struct samu *to,
    5897                              struct samr_UserInfo26 *from);
    5898 
    5899 /* The following definitions come from rpc_server/srv_spoolss_nt.c  */
    5900 
    5901 void do_drv_upgrade_printer(struct messaging_context *msg,
    5902                             void *private_data,
    5903                             uint32_t msg_type,
    5904                             struct server_id server_id,
    5905                             DATA_BLOB *data);
    5906 void update_monitored_printq_cache( void );
    5907 void reset_all_printerdata(struct messaging_context *msg,
    5908                            void *private_data,
    5909                            uint32_t msg_type,
    5910                            struct server_id server_id,
    5911                            DATA_BLOB *data);
    5912 bool convert_devicemode(const char *printername,
    5913                         const struct spoolss_DeviceMode *devmode,
    5914                         NT_DEVICEMODE **pp_nt_devmode);
    5915 WERROR set_printer_dataex(NT_PRINTER_INFO_LEVEL *printer,
    5916                           const char *key, const char *value,
    5917                           uint32_t type, uint8_t *data, int real_len);
    5918 void spoolss_notify_server_name(int snum,
    5919                                        struct spoolss_Notify *data,
    5920                                        print_queue_struct *queue,
    5921                                        NT_PRINTER_INFO_LEVEL *printer,
    5922                                        TALLOC_CTX *mem_ctx);
    5923 void spoolss_notify_printer_name(int snum,
    5924                                         struct spoolss_Notify *data,
    5925                                         print_queue_struct *queue,
    5926                                         NT_PRINTER_INFO_LEVEL *printer,
    5927                                         TALLOC_CTX *mem_ctx);
    5928 void spoolss_notify_share_name(int snum,
    5929                                       struct spoolss_Notify *data,
    5930                                       print_queue_struct *queue,
    5931                                       NT_PRINTER_INFO_LEVEL *printer,
    5932                                       TALLOC_CTX *mem_ctx);
    5933 void spoolss_notify_port_name(int snum,
    5934                                      struct spoolss_Notify *data,
    5935                                      print_queue_struct *queue,
    5936                                      NT_PRINTER_INFO_LEVEL *printer,
    5937                                      TALLOC_CTX *mem_ctx);
    5938 void spoolss_notify_driver_name(int snum,
    5939                                        struct spoolss_Notify *data,
    5940                                        print_queue_struct *queue,
    5941                                        NT_PRINTER_INFO_LEVEL *printer,
    5942                                        TALLOC_CTX *mem_ctx);
    5943 void spoolss_notify_comment(int snum,
    5944                                    struct spoolss_Notify *data,
    5945                                    print_queue_struct *queue,
    5946                                    NT_PRINTER_INFO_LEVEL *printer,
    5947                                    TALLOC_CTX *mem_ctx);
    5948 void spoolss_notify_location(int snum,
    5949                                     struct spoolss_Notify *data,
    5950                                     print_queue_struct *queue,
    5951                                     NT_PRINTER_INFO_LEVEL *printer,
    5952                                     TALLOC_CTX *mem_ctx);
    5953 void spoolss_notify_sepfile(int snum,
    5954                                    struct spoolss_Notify *data,
    5955                                    print_queue_struct *queue,
    5956                                    NT_PRINTER_INFO_LEVEL *printer,
    5957                                    TALLOC_CTX *mem_ctx);
    5958 void spoolss_notify_print_processor(int snum,
    5959                                            struct spoolss_Notify *data,
    5960                                            print_queue_struct *queue,
    5961                                            NT_PRINTER_INFO_LEVEL *printer,
    5962                                            TALLOC_CTX *mem_ctx);
    5963 void spoolss_notify_parameters(int snum,
    5964                                       struct spoolss_Notify *data,
    5965                                       print_queue_struct *queue,
    5966                                       NT_PRINTER_INFO_LEVEL *printer,
    5967                                       TALLOC_CTX *mem_ctx);
    5968 void spoolss_notify_datatype(int snum,
    5969                                     struct spoolss_Notify *data,
    5970                                     print_queue_struct *queue,
    5971                                     NT_PRINTER_INFO_LEVEL *printer,
    5972                                     TALLOC_CTX *mem_ctx);
    5973 void spoolss_notify_attributes(int snum,
    5974                                       struct spoolss_Notify *data,
    5975                                       print_queue_struct *queue,
    5976                                       NT_PRINTER_INFO_LEVEL *printer,
    5977                                       TALLOC_CTX *mem_ctx);
    5978 void spoolss_notify_cjobs(int snum,
    5979                                  struct spoolss_Notify *data,
    5980                                  print_queue_struct *queue,
    5981                                  NT_PRINTER_INFO_LEVEL *printer,
    5982                                  TALLOC_CTX *mem_ctx);
    5983 void construct_info_data(struct spoolss_Notify *info_data,
    5984                          enum spoolss_NotifyType type,
    5985                          uint16_t field,
    5986                          int id);
    5987 struct spoolss_DeviceMode *construct_dev_mode(TALLOC_CTX *mem_ctx,
    5988                                               const char *servicename);
    5989 bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer);
    5990 
    5991 /* The following definitions come from rpc_server/srv_srvsvc_nt.c  */
    5992 
    5993 char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
    5994 
    5995 /* The following definitions come from rpc_server/srv_svcctl_nt.c  */
    5996 
    5997 bool init_service_op_table( void );
    5998 
    5999 /* The following definitions come from rpcclient/cmd_dfs.c  */
    6000 
    6001 
    6002 /* The following definitions come from rpcclient/cmd_dssetup.c  */
    6003 
    6004 
    6005 /* The following definitions come from rpcclient/cmd_echo.c  */
    6006 
    6007 
    6008 /* The following definitions come from rpcclient/cmd_lsarpc.c  */
    6009 
    6010 
    6011 /* The following definitions come from rpcclient/cmd_netlogon.c  */
    6012 
    6013 
    6014 /* The following definitions come from rpcclient/cmd_ntsvcs.c  */
    6015 
    6016 
    6017 /* The following definitions come from rpcclient/cmd_samr.c  */
    6018 
    6019 
    6020 /* The following definitions come from rpcclient/cmd_shutdown.c  */
    6021 
    6022 
    6023 /* The following definitions come from rpcclient/cmd_spoolss.c  */
    6024 
    6025 
    6026 /* The following definitions come from rpcclient/cmd_srvsvc.c  */
    6027 
    6028 
    6029 /* The following definitions come from rpcclient/cmd_test.c  */
    6030 
    6031 
    6032 /* The following definitions come from rpcclient/cmd_wkssvc.c  */
    6033 
    6034 
    6035 /* The following definitions come from rpcclient/rpcclient.c  */
    6036 
    6037 
    6038 /* The following definitions come from services/services_db.c  */
    6039 
    6040 void svcctl_init_keys( void );
    6041 SEC_DESC *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token );
    6042 bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc, NT_USER_TOKEN *token );
    6043 const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token );
    6044 const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token );
    6045 struct regval_ctr *svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token );
    6046 
    6047 /* The following definitions come from services/svc_netlogon.c  */
    6048 
    6049 
    6050 /* The following definitions come from services/svc_rcinit.c  */
    6051 
    6052 
    6053 /* The following definitions come from services/svc_spoolss.c  */
    6054 
    6055 
    6056 /* The following definitions come from services/svc_winreg.c  */
    6057 
    6058 
    6059 /* The following definitions come from services/svc_wins.c  */
    6060 
    6061 
    6062 /* The following definitions come from smbd/aio.c  */
    6063 
    6064 void initialize_async_io_handler(void);
    6065 bool schedule_aio_read_and_X(connection_struct *conn,
    6066                              struct smb_request *req,
    6067                              files_struct *fsp, SMB_OFF_T startpos,
    6068                              size_t smb_maxcnt);
    6069 bool schedule_aio_write_and_X(connection_struct *conn,
    6070                               struct smb_request *req,
    6071                               files_struct *fsp, char *data,
    6072                               SMB_OFF_T startpos,
    6073                               size_t numtowrite);
    6074 int wait_for_aio_completion(files_struct *fsp);
    6075 void cancel_aio_by_fsp(files_struct *fsp);
    6076 void smbd_aio_complete_mid(unsigned int mid);
    6077 
    6078 /* The following definitions come from smbd/blocking.c  */
    6079 
    6080 void process_blocking_lock_queue(void);
    6081 bool push_blocking_lock_request( struct byte_range_lock *br_lck,
    6082                 struct smb_request *req,
    6083                 files_struct *fsp,
    6084                 int lock_timeout,
    6085                 int lock_num,
    6086                 uint32 lock_pid,
    6087                 enum brl_type lock_type,
    6088                 enum brl_flavour lock_flav,
    6089                 uint64_t offset,
    6090                 uint64_t count,
    6091                 uint32 blocking_pid);
    6092 void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lock *br_lck);
    6093 void remove_pending_lock_requests_by_mid(int mid);
    6094 bool blocking_lock_was_deferred(int mid);
    6095 struct blocking_lock_record *blocking_lock_cancel(files_struct *fsp,
    6096                         uint32 lock_pid,
    6097                         uint64_t offset,
    6098                         uint64_t count,
    6099                         enum brl_flavour lock_flav,
    6100                         unsigned char locktype,
    6101                         NTSTATUS err);
    6102 
    6103 /* The following definitions come from smbd/change_trust_pw.c  */
    6104 
    6105 NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine);
    6106 
    6107 /* The following definitions come from smbd/chgpasswd.c  */
    6108 
    6109 bool chgpasswd(const char *name, const struct passwd *pass,
    6110                const char *oldpass, const char *newpass, bool as_root);
    6111 bool chgpasswd(const char *name, const struct passwd *pass,
    6112                const char *oldpass, const char *newpass, bool as_root);
    6113 bool check_lanman_password(char *user, uchar * pass1,
    6114                            uchar * pass2, struct samu **hnd);
    6115 bool change_lanman_password(struct samu *sampass, uchar *pass2);
    6116 NTSTATUS pass_oem_change(char *user,
    6117                          uchar password_encrypted_with_lm_hash[516],
    6118                          const uchar old_lm_hash_encrypted[16],
    6119                          uchar password_encrypted_with_nt_hash[516],
    6120                          const uchar old_nt_hash_encrypted[16],
    6121                          uint32 *reject_reason);
    6122 bool password_in_history(uint8_t nt_pw[NT_HASH_LEN],
    6123                          uint32_t pw_history_len,
    6124                          const uint8_t *pw_history);
    6125 NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passwd, bool as_root, uint32 *samr_reject_reason);
    6126 
    6127 /* The following definitions come from smbd/close.c  */
    6128 
    6129 void set_close_write_time(struct files_struct *fsp, struct timespec ts);
    6130 NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
    6131                     enum file_close_type close_type);
    6132 void msg_close_file(struct messaging_context *msg_ctx,
    6133                     void *private_data,
    6134                     uint32_t msg_type,
    6135                     struct server_id server_id,
    6136                     DATA_BLOB *data);
    6137 NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
    6138 
    6139 /* The following definitions come from smbd/conn.c  */
    6140 
    6141 void conn_init(struct smbd_server_connection *sconn);
    6142 int conn_num_open(struct smbd_server_connection *sconn);
    6143 bool conn_snum_used(int snum);
    6144 connection_struct *conn_find(struct smbd_server_connection *sconn,
    6145                              unsigned cnum);
    6146 connection_struct *conn_new(struct smbd_server_connection *sconn);
    6147 bool conn_close_all(struct smbd_server_connection *sconn);
    6148 bool conn_idle_all(struct smbd_server_connection *sconn, time_t t);
    6149 void conn_clear_vuid_caches(struct smbd_server_connection *sconn, uint16 vuid);
    6150 void conn_free(connection_struct *conn);
    6151 void msg_force_tdis(struct messaging_context *msg,
    6152                     void *private_data,
    6153                     uint32_t msg_type,
    6154                     struct server_id server_id,
    6155                     DATA_BLOB *data);
    6156 
    6157 /* The following definitions come from smbd/connection.c  */
    6158 
    6159 bool yield_connection(connection_struct *conn, const char *name);
    6160 int count_current_connections( const char *sharename, bool clear  );
    6161 int count_all_current_connections(void);
    6162 bool claim_connection(connection_struct *conn, const char *name,
    6163                       uint32 msg_flags);
    6164 bool register_message_flags(bool doreg, uint32 msg_flags);
    6165 
    6166 /* The following definitions come from smbd/dfree.c  */
    6167 
    6168 uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query,
    6169                               uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    6170 uint64_t get_dfree_info(connection_struct *conn,
    6171                         const char *path,
    6172                         bool small_query,
    6173                         uint64_t *bsize,
    6174                         uint64_t *dfree,
    6175                         uint64_t *dsize);
    6176 
    6177 /* The following definitions come from smbd/dir.c  */
    6178 
    6179 bool make_dir_struct(TALLOC_CTX *ctx,
    6180                         char *buf,
    6181                         const char *mask,
    6182                         const char *fname,
    6183                         SMB_OFF_T size,
    6184                         uint32 mode,
    6185                         time_t date,
    6186                         bool uc);
    6187 bool init_dptrs(struct smbd_server_connection *sconn);
    6188 char *dptr_path(struct smbd_server_connection *sconn, int key);
    6189 char *dptr_wcard(struct smbd_server_connection *sconn, int key);
    6190 uint16 dptr_attr(struct smbd_server_connection *sconn, int key);
    6191 void dptr_close(struct smbd_server_connection *sconn, int *key);
    6192 void dptr_closecnum(connection_struct *conn);
    6193 void dptr_idlecnum(connection_struct *conn);
    6194 void dptr_closepath(struct smbd_server_connection *sconn,
    6195                     char *path,uint16 spid);
    6196 NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, bool expect_close,uint16 spid,
    6197                 const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
    6198 int dptr_CloseDir(struct dptr_struct *dptr);
    6199 void dptr_SeekDir(struct dptr_struct *dptr, long offset);
    6200 long dptr_TellDir(struct dptr_struct *dptr);
    6201 bool dptr_has_wild(struct dptr_struct *dptr);
    6202 int dptr_dnum(struct dptr_struct *dptr);
    6203 char *dptr_ReadDirName(TALLOC_CTX *ctx,
    6204                         struct dptr_struct *dptr,
    6205                         long *poffset,
    6206                         SMB_STRUCT_STAT *pst);
    6207 bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst);
    6208 void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset);
    6209 void dptr_init_search_op(struct dptr_struct *dptr);
    6210 bool dptr_fill(struct smbd_server_connection *sconn,
    6211                char *buf1,unsigned int key);
    6212 struct dptr_struct *dptr_fetch(struct smbd_server_connection *sconn,
    6213                                char *buf,int *num);
    6214 struct dptr_struct *dptr_fetch_lanman2(struct smbd_server_connection *sconn,
    6215                                        int dptr_num);
    6216 bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype);
    6217 bool get_dir_entry(TALLOC_CTX *ctx,
    6218                 struct dptr_struct *dirptr,
    6219                 const char *mask,
    6220                 uint32 dirtype,
    6221                 char **pp_fname_out,
    6222                 SMB_OFF_T *size,
    6223                 uint32 *mode,
    6224                 struct timespec *date,
    6225                 bool check_descend,
    6226                 bool ask_sharemode);
    6227 bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto);
    6228 struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn,
    6229                         const char *name, const char *mask, uint32 attr);
    6230 const char *ReadDirName(struct smb_Dir *dirp, long *poffset,
    6231                         SMB_STRUCT_STAT *sbuf, char **talloced);
    6232 void RewindDir(struct smb_Dir *dirp, long *poffset);
    6233 void SeekDir(struct smb_Dir *dirp, long offset);
    6234 long TellDir(struct smb_Dir *dirp);
    6235 void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset);
    6236 bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset);
    6237 NTSTATUS can_delete_directory(struct connection_struct *conn,
    6238                                 const char *dirname);
    6239 
    6240 /* The following definitions come from smbd/dmapi.c  */
    6241 
    6242 const void *dmapi_get_current_session(void);
    6243 bool dmapi_have_session(void);
    6244 bool dmapi_new_session(void);
    6245 bool dmapi_destroy_session(void);
    6246 uint32 dmapi_file_flags(const char * const path);
    6247 
    6248 /* The following definitions come from smbd/dnsregister.c  */
    6249 
    6250 bool smbd_setup_mdns_registration(struct tevent_context *ev,
    6251                                   TALLOC_CTX *mem_ctx,
    6252                                   uint16_t port);
    6253 
    6254 /* The following definitions come from smbd/dosmode.c  */
    6255 
    6256 mode_t unix_mode(connection_struct *conn, int dosmode,
    6257                  const struct smb_filename *smb_fname,
    6258                  const char *inherit_from_dir);
    6259 uint32 dos_mode_msdfs(connection_struct *conn,
    6260                       const struct smb_filename *smb_fname);
    6261 int dos_attributes_to_stat_dos_flags(uint32_t dosmode);
    6262 uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname);
    6263 int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
    6264                      uint32 dosmode, const char *parent_dir, bool newfile);
    6265 int file_ntimes(connection_struct *conn, const struct smb_filename *smb_fname,
    6266                 struct smb_file_time *ft);
    6267 bool set_sticky_write_time_path(struct file_id fileid, struct timespec mtime);
    6268 bool set_sticky_write_time_fsp(struct files_struct *fsp,
    6269                                struct timespec mtime);
    6270 
    6271 NTSTATUS set_create_timespec_ea(connection_struct *conn,
    6272                                 const struct smb_filename *smb_fname,
    6273                                 struct timespec create_time);
    6274 
    6275 struct timespec get_create_timespec(connection_struct *conn,
    6276                                 struct files_struct *fsp,
    6277                                 const struct smb_filename *smb_fname);
    6278 
    6279 struct timespec get_change_timespec(connection_struct *conn,
    6280                                 struct files_struct *fsp,
    6281                                 const struct smb_filename *smb_fname);
    6282 
    6283 /* The following definitions come from smbd/error.c  */
    6284 
    6285 bool use_nt_status(void);
    6286 void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
    6287 int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file);
    6288 void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus,
    6289                     int line, const char *file);
    6290 void reply_force_dos_error(struct smb_request *req, uint8 eclass, uint32 ecode,
    6291                     int line, const char *file);
    6292 void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode,
    6293                       NTSTATUS status, int line, const char *file);
    6294 void reply_openerror(struct smb_request *req, NTSTATUS status);
    6295 
    6296 /* The following definitions come from smbd/fake_file.c  */
    6297 
    6298 enum FAKE_FILE_TYPE is_fake_file_path(const char *path);
    6299 enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname);
    6300 NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
    6301                                 uint16_t current_vuid,
    6302                                 enum FAKE_FILE_TYPE fake_file_type,
    6303                                 const struct smb_filename *smb_fname,
    6304                                 uint32 access_mask,
    6305                                 files_struct **result);
    6306 NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
    6307 
    6308 /* The following definitions come from smbd/file_access.c  */
    6309 
    6310 bool can_access_file_acl(struct connection_struct *conn,
    6311                          const struct smb_filename *smb_fname,
    6312                          uint32_t access_mask);
    6313 bool can_delete_file_in_directory(connection_struct *conn,
    6314                                   struct smb_filename *smb_fname);
    6315 bool can_access_file_data(connection_struct *conn,
    6316                           const struct smb_filename *smb_fname,
    6317                           uint32 access_mask);
    6318 bool can_write_to_file(connection_struct *conn,
    6319                        const struct smb_filename *smb_fname);
    6320 bool directory_has_default_acl(connection_struct *conn, const char *fname);
    6321 
    6322 /* The following definitions come from smbd/fileio.c  */
    6323 
    6324 ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n);
    6325 void update_write_time_handler(struct event_context *ctx,
    6326                                       struct timed_event *te,
    6327                                       struct timeval now,
    6328                                       void *private_data);
    6329 void trigger_write_time_update(struct files_struct *fsp);
    6330 void trigger_write_time_update_immediate(struct files_struct *fsp);
    6331 ssize_t write_file(struct smb_request *req,
    6332                         files_struct *fsp,
    6333                         const char *data,
    6334                         SMB_OFF_T pos,
    6335                         size_t n);
    6336 void delete_write_cache(files_struct *fsp);
    6337 void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size);
    6338 ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason);
    6339 NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through);
    6340 int fsp_stat(files_struct *fsp);
    6341 
    6342 /* The following definitions come from smbd/filename.c  */
    6343 
    6344 NTSTATUS unix_convert(TALLOC_CTX *ctx,
    6345                       connection_struct *conn,
    6346                       const char *orig_path,
    6347                       struct smb_filename **smb_fname,
    6348                       uint32_t ucf_flags);
    6349 NTSTATUS check_name(connection_struct *conn, const char *name);
    6350 int get_real_filename(connection_struct *conn, const char *path,
    6351                       const char *name, TALLOC_CTX *mem_ctx,
    6352                       char **found_name);
    6353 NTSTATUS filename_convert(TALLOC_CTX *mem_ctx,
    6354                         connection_struct *conn,
    6355                         bool dfs_path,
    6356                         const char *name_in,
    6357                         uint32_t ucf_flags,
    6358                         bool *ppath_contains_wcard,
    6359                         struct smb_filename **pp_smb_fname);
    6360 
    6361 /* The following definitions come from smbd/filename_utils.c */
     1916                           struct dom_sid *sid, const char **domain);
     1917
     1918/* The following definitions come from lib/util_unixsids.c  */
     1919
     1920bool sid_check_is_unix_users(const struct dom_sid *sid);
     1921bool sid_check_is_in_unix_users(const struct dom_sid *sid);
     1922void uid_to_unix_users_sid(uid_t uid, struct dom_sid *sid);
     1923void gid_to_unix_groups_sid(gid_t gid, struct dom_sid *sid);
     1924const char *unix_users_domain_name(void);
     1925bool lookup_unix_user_name(const char *name, struct dom_sid *sid);
     1926bool sid_check_is_unix_groups(const struct dom_sid *sid);
     1927bool sid_check_is_in_unix_groups(const struct dom_sid *sid);
     1928const char *unix_groups_domain_name(void);
     1929bool lookup_unix_group_name(const char *name, struct dom_sid *sid);
     1930
     1931/* The following definitions come from lib/filename_util.c */
    63621932
    63631933NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_fname,
     
    63791949bool is_ntfs_default_stream_smb_fname(const struct smb_filename *smb_fname);
    63801950
    6381 /* The following definitions come from smbd/files.c  */
    6382 
    6383 NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
    6384                   files_struct **result);
    6385 void file_close_conn(connection_struct *conn);
    6386 void file_close_pid(uint16 smbpid, int vuid);
    6387 void file_init(void);
    6388 void file_close_user(int vuid);
    6389 void file_dump_open_table(void);
    6390 struct files_struct *file_walk_table(
    6391         struct files_struct *(*fn)(struct files_struct *fsp,
    6392                                    void *private_data),
    6393         void *private_data);
    6394 files_struct *file_find_fd(int fd);
    6395 files_struct *file_find_dif(struct file_id id, unsigned long gen_id);
    6396 files_struct *file_find_fsp(files_struct *orig_fsp);
    6397 files_struct *file_find_di_first(struct file_id id);
    6398 files_struct *file_find_di_next(files_struct *start_fsp);
    6399 files_struct *file_find_print(void);
    6400 bool file_find_subpath(files_struct *dir_fsp);
    6401 void file_sync_all(connection_struct *conn);
    6402 void file_free(struct smb_request *req, files_struct *fsp);
    6403 files_struct *file_fnum(uint16 fnum);
    6404 files_struct *file_fsp(struct smb_request *req, uint16 fid);
    6405 NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
    6406                       uint32 access_mask, uint32 share_access,
    6407                       uint32 create_options, files_struct *to);
    6408 NTSTATUS fsp_set_smb_fname(struct files_struct *fsp,
    6409                            const struct smb_filename *smb_fname_in);
    6410 
    6411 /* The following definitions come from smbd/ipc.c  */
    6412 
    6413 void send_trans_reply(connection_struct *conn,
    6414                       struct smb_request *req,
    6415                       char *rparam, int rparam_len,
    6416                       char *rdata, int rdata_len,
    6417                       bool buffer_too_large);
    6418 void reply_trans(struct smb_request *req);
    6419 void reply_transs(struct smb_request *req);
    6420 
    6421 /* The following definitions come from smbd/lanman.c  */
    6422 
    6423 void api_reply(connection_struct *conn, uint16 vuid,
    6424                struct smb_request *req,
    6425                char *data, char *params,
    6426                int tdscnt, int tpscnt,
    6427                int mdrcnt, int mprcnt);
    6428 
    6429 /* The following definitions come from smbd/mangle.c  */
    6430 
    6431 void mangle_reset_cache(void);
    6432 void mangle_change_to_posix(void);
    6433 bool mangle_is_mangled(const char *s, const struct share_params *p);
    6434 bool mangle_is_8_3(const char *fname, bool check_case,
    6435                    const struct share_params *p);
    6436 bool mangle_is_8_3_wildcards(const char *fname, bool check_case,
    6437                              const struct share_params *p);
    6438 bool mangle_must_mangle(const char *fname,
    6439                    const struct share_params *p);
    6440 bool mangle_lookup_name_from_8_3(TALLOC_CTX *ctx,
    6441                         const char *in,
    6442                         char **out, /* talloced on the given context. */
    6443                         const struct share_params *p);
    6444 bool name_to_8_3(const char *in,
    6445                 char out[13],
    6446                 bool cache83,
    6447                 const struct share_params *p);
    6448 
    6449 /* The following definitions come from smbd/mangle_hash.c  */
    6450 
    6451 const struct mangle_fns *mangle_hash_init(void);
    6452 
    6453 /* The following definitions come from smbd/mangle_hash2.c  */
    6454 
    6455 const struct mangle_fns *mangle_hash2_init(void);
    6456 const struct mangle_fns *posix_mangle_init(void);
    6457 
    6458 /* The following definitions come from smbd/map_username.c  */
    6459 
    6460 bool map_username(struct smbd_server_connection *sconn, fstring user);
    6461 
    6462 /* The following definitions come from smbd/message.c  */
    6463 
    6464 void reply_sends(struct smb_request *req);
    6465 void reply_sendstrt(struct smb_request *req);
    6466 void reply_sendtxt(struct smb_request *req);
    6467 void reply_sendend(struct smb_request *req);
    6468 
    6469 /* The following definitions come from smbd/msdfs.c  */
    6470 
    6471 bool is_msdfs_link(connection_struct *conn,
    6472                 const char *path,
    6473                 SMB_STRUCT_STAT *sbufp);
    6474 NTSTATUS get_referred_path(TALLOC_CTX *ctx,
    6475                         struct auth_serversupplied_info *server_info,
    6476                         const char *dfs_path,
    6477                         struct junction_map *jucn,
    6478                         int *consumedcntp,
    6479                         bool *self_referralp);
    6480 int setup_dfs_referral(connection_struct *orig_conn,
    6481                         const char *dfs_path,
    6482                         int max_referral_level,
    6483                         char **ppdata, NTSTATUS *pstatus);
    6484 bool create_junction(TALLOC_CTX *ctx,
    6485                 const char *dfs_path,
    6486                 struct junction_map *jucn);
    6487 bool create_msdfs_link(const struct junction_map *jucn);
    6488 bool remove_msdfs_link(const struct junction_map *jucn);
    6489 struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn);
    6490 NTSTATUS resolve_dfspath(TALLOC_CTX *ctx,
    6491                         connection_struct *conn,
    6492                         bool dfs_pathnames,
    6493                         const char *name_in,
    6494                         char **pp_name_out);
    6495 NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx,
    6496                                 connection_struct *conn,
    6497                                 bool dfs_pathnames,
    6498                                 const char *name_in,
    6499                                 bool allow_wcards,
    6500                                 char **pp_name_out,
    6501                                 bool *ppath_contains_wcard);
    6502 NTSTATUS create_conn_struct(TALLOC_CTX *ctx,
    6503                                 connection_struct **pconn,
    6504                                 int snum,
    6505                                 const char *path,
    6506                                 struct auth_serversupplied_info *server_info,
    6507                                 char **poldcwd);
    6508 
    6509 /* The following definitions come from smbd/negprot.c  */
    6510 
    6511 void reply_negprot(struct smb_request *req);
    6512 
    6513 /* The following definitions come from smbd/notify.c  */
    6514 
    6515 void change_notify_reply(connection_struct *conn,
    6516                          struct smb_request *req,
    6517                          NTSTATUS error_code,
    6518                          uint32_t max_param,
    6519                          struct notify_change_buf *notify_buf,
    6520                          void (*reply_fn)(struct smb_request *req,
    6521                                 NTSTATUS error_code,
    6522                                 uint8_t *buf, size_t len));
    6523 NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
    6524                               bool recursive);
    6525 NTSTATUS change_notify_add_request(struct smb_request *req,
    6526                                 uint32 max_param,
    6527                                 uint32 filter, bool recursive,
    6528                                 struct files_struct *fsp,
    6529                                 void (*reply_fn)(struct smb_request *req,
    6530                                         NTSTATUS error_code,
    6531                                         uint8_t *buf, size_t len));
    6532 void remove_pending_change_notify_requests_by_mid(uint16 mid);
    6533 void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
    6534                                                   NTSTATUS status);
    6535 void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
    6536                   const char *path);
    6537 char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter);
    6538 struct sys_notify_context *sys_notify_context_create(connection_struct *conn,
    6539                                                      TALLOC_CTX *mem_ctx,
    6540                                                      struct event_context *ev);
    6541 NTSTATUS sys_notify_watch(struct sys_notify_context *ctx,
    6542                           struct notify_entry *e,
    6543                           void (*callback)(struct sys_notify_context *ctx,
    6544                                            void *private_data,
    6545                                            struct notify_event *ev),
    6546                           void *private_data, void *handle);
    6547 
    6548 /* The following definitions come from smbd/notify_inotify.c  */
    6549 
    6550 NTSTATUS inotify_watch(struct sys_notify_context *ctx,
    6551                        struct notify_entry *e,
    6552                        void (*callback)(struct sys_notify_context *ctx,
    6553                                         void *private_data,
    6554                                         struct notify_event *ev),
    6555                        void *private_data,
    6556                        void *handle_p);
    6557 
    6558 /* The following definitions come from smbd/notify_internal.c  */
    6559 
    6560 struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
    6561                                    struct messaging_context *messaging_ctx,
    6562                                    struct event_context *ev,
    6563                                    connection_struct *conn);
    6564 NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
    6565                     void (*callback)(void *, const struct notify_event *),
    6566                     void *private_data);
    6567 NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
    6568 NTSTATUS notify_remove_onelevel(struct notify_context *notify,
    6569                                 const struct file_id *fid,
    6570                                 void *private_data);
    6571 void notify_onelevel(struct notify_context *notify, uint32_t action,
    6572                      uint32_t filter, struct file_id fid, const char *name);
    6573 void notify_trigger(struct notify_context *notify,
    6574                     uint32_t action, uint32_t filter, const char *path);
    6575 
    6576 /* The following definitions come from smbd/ntquotas.c  */
    6577 
    6578 int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid, SMB_NTQUOTA_STRUCT *qt);
    6579 int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid, SMB_NTQUOTA_STRUCT *qt);
    6580 int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
    6581 void *init_quota_handle(TALLOC_CTX *mem_ctx);
    6582 
    6583 /* The following definitions come from smbd/nttrans.c  */
    6584 
    6585 void send_nt_replies(connection_struct *conn,
    6586                         struct smb_request *req, NTSTATUS nt_error,
    6587                      char *params, int paramsize,
    6588                      char *pdata, int datasize);
    6589 void reply_ntcreate_and_X(struct smb_request *req);
    6590 struct ea_list *read_nttrans_ea_list(TALLOC_CTX *ctx, const char *pdata, size_t data_size);
    6591 void reply_ntcancel(struct smb_request *req);
    6592 void reply_ntrename(struct smb_request *req);
    6593 void reply_nttrans(struct smb_request *req);
    6594 void reply_nttranss(struct smb_request *req);
    6595 
    6596 /* The following definitions come from smbd/open.c  */
    6597 
    6598 NTSTATUS smb1_file_se_access_check(connection_struct *conn,
    6599                           const struct security_descriptor *sd,
    6600                           const NT_USER_TOKEN *token,
    6601                           uint32_t access_desired,
    6602                           uint32_t *access_granted);
    6603 NTSTATUS fd_close(files_struct *fsp);
    6604 void change_file_owner_to_parent(connection_struct *conn,
    6605                                  const char *inherit_from_dir,
    6606                                  files_struct *fsp);
    6607 NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
    6608                                     const char *inherit_from_dir,
    6609                                     const char *fname,
    6610                                     SMB_STRUCT_STAT *psbuf);
    6611 bool is_executable(const char *fname);
    6612 bool is_stat_open(uint32 access_mask);
    6613 bool request_timed_out(struct timeval request_time,
    6614                        struct timeval timeout);
    6615 bool open_match_attributes(connection_struct *conn,
    6616                            uint32 old_dos_attr,
    6617                            uint32 new_dos_attr,
    6618                            mode_t existing_unx_mode,
    6619                            mode_t new_unx_mode,
    6620                            mode_t *returned_unx_mode);
    6621 NTSTATUS fcb_or_dos_open(struct smb_request *req,
    6622                          connection_struct *conn,
    6623                          files_struct *fsp_to_dup_into,
    6624                          const struct smb_filename *smb_fname,
    6625                          struct file_id id,
    6626                          uint16 file_pid,
    6627                          uint16 vuid,
    6628                          uint32 access_mask,
    6629                          uint32 share_access,
    6630                          uint32 create_options);
    6631 bool map_open_params_to_ntcreate(const struct smb_filename *smb_fname,
    6632                                  int deny_mode, int open_func,
    6633                                  uint32 *paccess_mask,
    6634                                  uint32 *pshare_mode,
    6635                                  uint32 *pcreate_disposition,
    6636                                  uint32 *pcreate_options);
    6637 NTSTATUS open_file_fchmod(connection_struct *conn,
    6638                           struct smb_filename *smb_fname,
    6639                           files_struct **result);
    6640 NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
    6641                           struct smb_filename *smb_dname);
    6642 void msg_file_was_renamed(struct messaging_context *msg,
    6643                           void *private_data,
    6644                           uint32_t msg_type,
    6645                           struct server_id server_id,
    6646                           DATA_BLOB *data);
    6647 NTSTATUS open_streams_for_delete(connection_struct *conn,
    6648                                  const char *fname);
    6649 NTSTATUS create_file_default(connection_struct *conn,
    6650                              struct smb_request *req,
    6651                              uint16_t root_dir_fid,
    6652                              struct smb_filename * smb_fname,
    6653                              uint32_t access_mask,
    6654                              uint32_t share_access,
    6655                              uint32_t create_disposition,
    6656                              uint32_t create_options,
    6657                              uint32_t file_attributes,
    6658                              uint32_t oplock_request,
    6659                              uint64_t allocation_size,
    6660                              struct security_descriptor *sd,
    6661                              struct ea_list *ea_list,
    6662 
    6663                              files_struct **result,
    6664                              int *pinfo);
    6665 NTSTATUS get_relative_fid_filename(connection_struct *conn,
    6666                                    struct smb_request *req,
    6667                                    uint16_t root_dir_fid,
    6668                                    const struct smb_filename *smb_fname,
    6669                                    struct smb_filename **smb_fname_out);
    6670 
    6671 /* The following definitions come from smbd/oplock.c  */
    6672 
    6673 int32 get_number_of_exclusive_open_oplocks(void);
    6674 void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp);
    6675 bool set_file_oplock(files_struct *fsp, int oplock_type);
    6676 void release_file_oplock(files_struct *fsp);
    6677 bool remove_oplock(files_struct *fsp);
    6678 bool downgrade_oplock(files_struct *fsp);
    6679 bool should_notify_deferred_opens(void);
    6680 void break_level2_to_none_async(files_struct *fsp);
    6681 void reply_to_oplock_break_requests(files_struct *fsp);
    6682 void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx,
    6683                                                       void *private_data,
    6684                                                       uint32_t msg_type,
    6685                                                       struct server_id src,
    6686                                                       DATA_BLOB *data);
     1951/* The following definitions come from lib/dummyroot.c */
     1952
     1953void become_root(void);
     1954void unbecome_root(void);
     1955
     1956/* The following definitions come from lib/dummysmbd.c */
     1957
     1958int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out);
     1959bool conn_snum_used(int snum);
     1960void cancel_pending_lock_requests_by_fid(files_struct *fsp,
     1961                        struct byte_range_lock *br_lck,
     1962                        enum file_close_type close_type);
     1963void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
     1964                                    const char *name);
     1965NTSTATUS can_delete_directory(struct connection_struct *conn,
     1966                                const char *dirname);
     1967bool change_to_root_user(void);
     1968struct event_context *smbd_event_context(void);
    66871969void contend_level2_oplocks_begin(files_struct *fsp,
    66881970                                  enum level2_contention_type type);
    66891971void contend_level2_oplocks_end(files_struct *fsp,
    66901972                                enum level2_contention_type type);
    6691 void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e);
    6692 void message_to_share_mode_entry(struct share_mode_entry *e, char *msg);
    6693 bool init_oplocks(struct messaging_context *msg_ctx);
    6694 
    6695 /* The following definitions come from smbd/oplock_irix.c  */
    6696 
    6697 struct kernel_oplocks *irix_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
    6698 
    6699 /* The following definitions come from smbd/oplock_linux.c  */
    6700 
    6701 void linux_set_lease_capability(void);
    6702 int linux_set_lease_sighandler(int fd);
    6703 int linux_setlease(int fd, int leasetype);
    6704 struct kernel_oplocks *linux_init_kernel_oplocks(TALLOC_CTX *mem_ctx) ;
    6705 
    6706 /* The following definitions come from smbd/oplock_onefs.c  */
    6707 
    6708 struct kernel_oplocks *onefs_init_kernel_oplocks(TALLOC_CTX *mem_ctx);
    6709 
    6710 /* The following definitions come from smbd/password.c  */
    6711 
    6712 user_struct *get_valid_user_struct(struct smbd_server_connection *sconn,
    6713                                    uint16 vuid);
    6714 bool is_partial_auth_vuid(struct smbd_server_connection *sconn, uint16 vuid);
    6715 user_struct *get_partial_auth_user_struct(struct smbd_server_connection *sconn,
    6716                                           uint16 vuid);
    6717 void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid);
    6718 void invalidate_all_vuids(struct smbd_server_connection *sconn);
    6719 int register_initial_vuid(struct smbd_server_connection *sconn);
    6720 int register_existing_vuid(struct smbd_server_connection *sconn,
    6721                         uint16 vuid,
    6722                         auth_serversupplied_info *server_info,
    6723                         DATA_BLOB response_blob,
    6724                         const char *smb_name);
    6725 void add_session_user(struct smbd_server_connection *sconn, const char *user);
    6726 void add_session_workgroup(struct smbd_server_connection *sconn,
    6727                            const char *workgroup);
    6728 const char *get_session_workgroup(struct smbd_server_connection *sconn);
    6729 bool user_in_netgroup(struct smbd_server_connection *sconn,
    6730                       const char *user, const char *ngname);
    6731 bool user_in_list(struct smbd_server_connection *sconn,
    6732                   const char *user,const char **list);
    6733 bool authorise_login(struct smbd_server_connection *sconn,
    6734                      int snum, fstring user, DATA_BLOB password,
    6735                      bool *guest);
    6736 
    6737 /* The following definitions come from smbd/pipes.c  */
    6738 
    6739 NTSTATUS open_np_file(struct smb_request *smb_req, const char *name,
    6740                       struct files_struct **pfsp);
    6741 void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req);
    6742 void reply_pipe_write(struct smb_request *req);
    6743 void reply_pipe_write_and_X(struct smb_request *req);
    6744 void reply_pipe_read_and_X(struct smb_request *req);
    6745 void reply_pipe_close(connection_struct *conn, struct smb_request *req);
    6746 
    6747 /* The following definitions come from smbd/posix_acls.c  */
    6748 
    6749 void create_file_sids(const SMB_STRUCT_STAT *psbuf, DOM_SID *powner_sid, DOM_SID *pgroup_sid);
    6750 bool nt4_compatible_acls(void);
    6751 uint32_t map_canon_ace_perms(int snum,
    6752                                 enum security_ace_type *pacl_type,
    6753                                 mode_t perms,
    6754                                 bool directory_ace);
    6755 NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, const SEC_DESC *psd);
    6756 bool current_user_in_group(gid_t gid);
    6757 SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
    6758 NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
    6759                            SEC_DESC **ppdesc);
    6760 NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
    6761                           uint32_t security_info, SEC_DESC **ppdesc);
    6762 int try_chown(connection_struct *conn, struct smb_filename *smb_fname,
    6763               uid_t uid, gid_t gid);
    6764 NTSTATUS append_parent_acl(files_struct *fsp,
    6765                                 const SEC_DESC *pcsd,
    6766                                 SEC_DESC **pp_new_sd);
    6767 NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd);
    6768 int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
    6769 int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
    6770 int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
    6771                        const char *name, mode_t mode);
    6772 int fchmod_acl(files_struct *fsp, mode_t mode);
    6773 bool set_unix_posix_default_acl(connection_struct *conn, const char *fname,
    6774                                 const SMB_STRUCT_STAT *psbuf,
    6775                                 uint16 num_def_acls, const char *pdata);
    6776 bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata);
    6777 SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname);
    6778 NTSTATUS make_default_filesystem_acl(TALLOC_CTX *ctx,
    6779                                         const char *name,
    6780                                         SMB_STRUCT_STAT *psbuf,
    6781                                         SEC_DESC **ppdesc);
    6782 
    6783 /* The following definitions come from smbd/process.c  */
    6784 
    6785 void smbd_setup_sig_term_handler(void);
    6786 void smbd_setup_sig_hup_handler(void);
    6787 bool srv_send_smb(int fd, char *buffer,
    6788                   bool no_signing, uint32_t seqnum,
    6789                   bool do_encrypt,
    6790                   struct smb_perfcount_data *pcd);
    6791 int srv_set_message(char *buf,
    6792                         int num_words,
    6793                         int num_bytes,
    6794                         bool zero);
    6795 void init_smb_request(struct smb_request *req,
    6796                         const uint8 *inbuf,
    6797                         size_t unread_bytes,
    6798                         bool encrypted);
    6799 void remove_deferred_open_smb_message(uint16 mid);
    6800 void schedule_deferred_open_smb_message(uint16 mid);
    6801 bool open_was_deferred(uint16 mid);
    6802 struct pending_message_list *get_open_deferred_message(uint16 mid);
    6803 bool push_deferred_smb_message(struct smb_request *req,
    6804                                struct timeval request_time,
    6805                                struct timeval timeout,
    6806                                char *private_data, size_t priv_len);
    6807 struct idle_event *event_add_idle(struct event_context *event_ctx,
    6808                                   TALLOC_CTX *mem_ctx,
    6809                                   struct timeval interval,
    6810                                   const char *name,
    6811                                   bool (*handler)(const struct timeval *now,
    6812                                                   void *private_data),
    6813                                   void *private_data);
    6814 NTSTATUS allow_new_trans(struct trans_state *list, int mid);
    6815 void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes);
    6816 const char *smb_fn_name(int type);
    6817 void add_to_common_flags2(uint32 v);
    6818 void remove_from_common_flags2(uint32 v);
    6819 void construct_reply_common_req(struct smb_request *req, char *outbuf);
    6820 size_t req_wct_ofs(struct smb_request *req);
    6821 void chain_reply(struct smb_request *req);
    6822 bool req_is_in_chain(struct smb_request *req);
    6823 void check_reload(time_t t);
    6824 void smbd_process(void);
    6825 
    6826 /* The following definitions come from smbd/quotas.c  */
    6827 
    6828 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6829 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6830 bool disk_quotas(const char *path,
    6831                 uint64_t *bsize,
    6832                 uint64_t *dfree,
    6833                 uint64_t *dsize);
    6834 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6835 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6836 bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6837 bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
    6838 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    6839 bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
    6840 
    6841 /* The following definitions come from smbd/reply.c  */
    6842 
    6843 NTSTATUS check_path_syntax(char *path);
    6844 NTSTATUS check_path_syntax_wcard(char *path, bool *p_contains_wcard);
    6845 NTSTATUS check_path_syntax_posix(char *path);
    6846 size_t srvstr_get_path_wcard(TALLOC_CTX *ctx,
    6847                         const char *inbuf,
    6848                         uint16 smb_flags2,
    6849                         char **pp_dest,
    6850                         const char *src,
    6851                         size_t src_len,
    6852                         int flags,
    6853                         NTSTATUS *err,
    6854                         bool *contains_wcard);
    6855 size_t srvstr_get_path(TALLOC_CTX *ctx,
    6856                         const char *inbuf,
    6857                         uint16 smb_flags2,
    6858                         char **pp_dest,
    6859                         const char *src,
    6860                         size_t src_len,
    6861                         int flags,
    6862                         NTSTATUS *err);
    6863 size_t srvstr_get_path_req_wcard(TALLOC_CTX *mem_ctx, struct smb_request *req,
    6864                                  char **pp_dest, const char *src, int flags,
    6865                                  NTSTATUS *err, bool *contains_wcard);
    6866 size_t srvstr_get_path_req(TALLOC_CTX *mem_ctx, struct smb_request *req,
    6867                            char **pp_dest, const char *src, int flags,
    6868                            NTSTATUS *err);
    6869 bool check_fsp_open(connection_struct *conn, struct smb_request *req,
    6870                     files_struct *fsp);
    6871 bool check_fsp(connection_struct *conn, struct smb_request *req,
    6872                files_struct *fsp);
    6873 bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req,
    6874                               files_struct *fsp);
    6875 bool fsp_belongs_conn(connection_struct *conn, struct smb_request *req,
    6876                       files_struct *fsp);
    6877 void reply_special(char *inbuf, size_t inbuf_len);
    6878 void reply_tcon(struct smb_request *req);
    6879 void reply_tcon_and_X(struct smb_request *req);
    6880 void reply_unknown_new(struct smb_request *req, uint8 type);
    6881 void reply_ioctl(struct smb_request *req);
    6882 void reply_checkpath(struct smb_request *req);
    6883 void reply_getatr(struct smb_request *req);
    6884 void reply_setatr(struct smb_request *req);
    6885 void reply_dskattr(struct smb_request *req);
    6886 void reply_search(struct smb_request *req);
    6887 void reply_fclose(struct smb_request *req);
    6888 void reply_open(struct smb_request *req);
    6889 void reply_open_and_X(struct smb_request *req);
    6890 void reply_ulogoffX(struct smb_request *req);
    6891 void reply_mknew(struct smb_request *req);
    6892 void reply_ctemp(struct smb_request *req);
    6893 NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
    6894                           uint32 dirtype, struct smb_filename *smb_fname,
    6895                           bool has_wild);
    6896 void reply_unlink(struct smb_request *req);
    6897 void reply_readbraw(struct smb_request *req);
    6898 void reply_lockread(struct smb_request *req);
    6899 void reply_read(struct smb_request *req);
    6900 void reply_read_and_X(struct smb_request *req);
    6901 void error_to_writebrawerr(struct smb_request *req);
    6902 void reply_writebraw(struct smb_request *req);
    6903 void reply_writeunlock(struct smb_request *req);
    6904 void reply_write(struct smb_request *req);
    6905 bool is_valid_writeX_buffer(const uint8_t *inbuf);
    6906 void reply_write_and_X(struct smb_request *req);
    6907 void reply_lseek(struct smb_request *req);
    6908 void reply_flush(struct smb_request *req);
    6909 void reply_exit(struct smb_request *req);
    6910 void reply_close(struct smb_request *req);
    6911 void reply_writeclose(struct smb_request *req);
    6912 void reply_lock(struct smb_request *req);
    6913 void reply_unlock(struct smb_request *req);
    6914 void reply_tdis(struct smb_request *req);
    6915 void reply_echo(struct smb_request *req);
    6916 void reply_printopen(struct smb_request *req);
    6917 void reply_printclose(struct smb_request *req);
    6918 void reply_printqueue(struct smb_request *req);
    6919 void reply_printwrite(struct smb_request *req);
    6920 void reply_mkdir(struct smb_request *req);
    6921 void reply_rmdir(struct smb_request *req);
    6922 NTSTATUS rename_internals_fsp(connection_struct *conn,
    6923                         files_struct *fsp,
    6924                         const struct smb_filename *smb_fname_dst_in,
    6925                         uint32 attrs,
    6926                         bool replace_if_exists);
    6927 NTSTATUS rename_internals(TALLOC_CTX *ctx,
    6928                         connection_struct *conn,
    6929                         struct smb_request *req,
    6930                         struct smb_filename *smb_fname_src,
    6931                         struct smb_filename *smb_fname_dst,
    6932                         uint32 attrs,
    6933                         bool replace_if_exists,
    6934                         bool src_has_wild,
    6935                         bool dest_has_wild,
    6936                         uint32_t access_mask);
    6937 void reply_mv(struct smb_request *req);
    6938 NTSTATUS copy_file(TALLOC_CTX *ctx,
    6939                         connection_struct *conn,
    6940                         struct smb_filename *smb_fname_src,
    6941                         struct smb_filename *smb_fname_dst,
    6942                         int ofun,
    6943                         int count,
    6944                         bool target_is_directory);
    6945 void reply_copy(struct smb_request *req);
    6946 uint32 get_lock_pid(const uint8_t *data, int data_offset,
    6947                     bool large_file_format);
    6948 uint64_t get_lock_count(const uint8_t *data, int data_offset,
    6949                         bool large_file_format);
    6950 uint64_t get_lock_offset(const uint8_t *data, int data_offset,
    6951                          bool large_file_format, bool *err);
    6952 void reply_lockingX(struct smb_request *req);
    6953 void reply_readbmpx(struct smb_request *req);
    6954 void reply_readbs(struct smb_request *req);
    6955 void reply_setattrE(struct smb_request *req);
    6956 void reply_writebmpx(struct smb_request *req);
    6957 void reply_writebs(struct smb_request *req);
    6958 void reply_getattrE(struct smb_request *req);
    6959 
    6960 /* The following definitions come from smbd/seal.c  */
    6961 
    6962 uint16_t srv_enc_ctx(void);
    6963 bool is_encrypted_packet(const uint8_t *inbuf);
    6964 void srv_free_enc_buffer(char *buf);
    6965 NTSTATUS srv_decrypt_buffer(char *buf);
    6966 NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out);
    6967 NTSTATUS srv_request_encryption_setup(connection_struct *conn,
    6968                                         unsigned char **ppdata,
    6969                                         size_t *p_data_size,
    6970                                         unsigned char **pparam,
    6971                                         size_t *p_param_size);
    6972 NTSTATUS srv_encryption_start(connection_struct *conn);
    6973 void server_encryption_shutdown(void);
    6974 
    6975 /* The following definitions come from smbd/sec_ctx.c  */
    6976 
    6977 bool unix_token_equal(const UNIX_USER_TOKEN *t1, const UNIX_USER_TOKEN *t2);
    6978 bool push_sec_ctx(void);
    6979 void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, NT_USER_TOKEN *token);
    6980 void set_root_sec_ctx(void);
    6981 bool pop_sec_ctx(void);
    6982 void init_sec_ctx(void);
    6983 
    6984 /* The following definitions come from smbd/server.c  */
    6985 
    6986 int smbd_server_fd(void);
    6987 int get_client_fd(void);
    6988 struct event_context *smbd_event_context(void);
    6989 struct messaging_context *smbd_messaging_context(void);
    6990 struct memcache *smbd_memcache(void);
    6991 void reload_printers(void);
    6992 bool reload_services(bool test);
    6993 void exit_server(const char *const explanation);
    6994 void exit_server_cleanly(const char *const explanation);
    6995 void exit_server_fault(void);
    6996 
    6997 /* The following definitions come from smbd/service.c  */
    6998 
    6999 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
    7000 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
    7001 void load_registry_shares(void);
    7002 int add_home_service(const char *service, const char *username, const char *homedir);
    7003 int find_service(fstring service);
    7004 connection_struct *make_connection_snum(struct smbd_server_connection *sconn,
    7005                                         int snum, user_struct *vuser,
    7006                                         DATA_BLOB password,
    7007                                         const char *pdev,
    7008                                         NTSTATUS *pstatus);
    7009 connection_struct *make_connection(struct smbd_server_connection *sconn,
    7010                                    const char *service_in, DATA_BLOB password,
    7011                                    const char *pdev, uint16 vuid,
    7012                                    NTSTATUS *status);
    7013 void close_cnum(connection_struct *conn, uint16 vuid);
    7014 
    7015 /* The following definitions come from smbd/session.c  */
    7016 
    7017 bool session_init(void);
    7018 bool session_claim(user_struct *vuser);
    7019 void session_yield(user_struct *vuser);
    7020 int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list);
    7021 
    7022 /* The following definitions come from smbd/sesssetup.c  */
    7023 
    7024 NTSTATUS parse_spnego_mechanisms(DATA_BLOB blob_in,
    7025                 DATA_BLOB *pblob_out,
    7026                 char **kerb_mechOID);
    7027 void reply_sesssetup_and_X(struct smb_request *req);
    7028 
    7029 /* The following definitions come from smbd/share_access.c  */
    7030 
    7031 bool token_contains_name_in_list(const char *username,
    7032                                  const char *domain,
    7033                                  const char *sharename,
    7034                                  const struct nt_user_token *token,
    7035                                  const char **list);
    7036 bool user_ok_token(const char *username, const char *domain,
    7037                    const struct nt_user_token *token, int snum);
    7038 bool is_share_read_only_for_token(const char *username,
    7039                                   const char *domain,
    7040                                   const struct nt_user_token *token,
    7041                                   connection_struct *conn);
    7042 
    7043 /* The following definitions come from smbd/srvstr.c  */
    7044 
    7045 size_t srvstr_push_fn(const char *function, unsigned int line,
    7046                       const char *base_ptr, uint16 smb_flags2, void *dest,
    7047                       const char *src, int dest_len, int flags);
    7048 ssize_t message_push_string(uint8 **outbuf, const char *str, int flags);
    7049 
    7050 /* The following definitions come from smbd/statcache.c  */
    7051 
    7052 void stat_cache_add( const char *full_orig_name,
    7053                 char *translated_path,
    7054                 bool case_sensitive);
    7055 bool stat_cache_lookup(connection_struct *conn,
    7056                         char **pp_name,
    7057                         char **pp_dirpath,
    7058                         char **pp_start,
    7059                         SMB_STRUCT_STAT *pst);
    7060 void send_stat_cache_delete_message(const char *name);
    7061 void stat_cache_delete(const char *name);
    7062 unsigned int fast_string_hash(TDB_DATA *key);
    7063 bool reset_stat_cache( void );
    7064 
    7065 /* The following definitions come from smbd/statvfs.c  */
    7066 
    7067 int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
    7068 
    7069 /* The following definitions come from smbd/trans2.c  */
    7070 
    7071 uint64_t smb_roundup(connection_struct *conn, uint64_t val);
    7072 uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
    7073 NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
    7074                       files_struct *fsp, const char *fname,
    7075                       const char *ea_name, struct ea_struct *pea);
    7076 NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn,
    7077                                 files_struct *fsp, const char *fname,
    7078                                 char ***pnames, size_t *pnum_names);
    7079 NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
    7080                 const struct smb_filename *smb_fname, struct ea_list *ea_list);
    7081 struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used);
    7082 void send_trans2_replies(connection_struct *conn,
    7083                         struct smb_request *req,
    7084                          const char *params,
    7085                          int paramsize,
    7086                          const char *pdata,
    7087                          int datasize,
    7088                          int max_data_bytes);
    7089 unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
    7090 NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
    7091                 connection_struct *conn,
    7092                 const struct smb_filename *smb_fname_old,
    7093                 const struct smb_filename *smb_fname_new);
    7094 NTSTATUS smb_set_file_time(connection_struct *conn,
    7095                            files_struct *fsp,
    7096                            const struct smb_filename *smb_fname,
    7097                            struct smb_file_time *ft,
    7098                            bool setting_write_time);
    7099 void reply_findclose(struct smb_request *req);
    7100 void reply_findnclose(struct smb_request *req);
    7101 void reply_trans2(struct smb_request *req);
    7102 void reply_transs2(struct smb_request *req);
    7103 
    7104 /* The following definitions come from smbd/uid.c  */
    7105 
    7106 bool change_to_guest(void);
    7107 void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid);
    7108 bool change_to_user(connection_struct *conn, uint16 vuid);
    7109 bool change_to_root_user(void);
    7110 bool become_authenticated_pipe_user(pipes_struct *p);
    7111 bool unbecome_authenticated_pipe_user(void);
    7112 void become_root(void);
    7113 void unbecome_root(void);
    7114 bool become_user(connection_struct *conn, uint16 vuid);
    7115 bool unbecome_user(void);
    7116 
    7117 /* The following definitions come from smbd/utmp.c  */
    7118 
    7119 void sys_utmp_claim(const char *username, const char *hostname,
    7120                         const char *ip_addr_str,
    7121                         const char *id_str, int id_num);
    7122 void sys_utmp_yield(const char *username, const char *hostname,
    7123                         const char *ip_addr_str,
    7124                         const char *id_str, int id_num);
    7125 void sys_utmp_yield(const char *username, const char *hostname,
    7126                         const char *ip_addr_str,
    7127                         const char *id_str, int id_num);
    7128 void sys_utmp_claim(const char *username, const char *hostname,
    7129                         const char *ip_addr_str,
    7130                         const char *id_str, int id_num);
    7131 
    7132 /* The following definitions come from smbd/vfs.c  */
    7133 
    7134 NTSTATUS smb_register_vfs(int version, const char *name,
    7135                           const struct vfs_fn_pointers *fns);
    7136 bool vfs_init_custom(connection_struct *conn, const char *vfs_object);
    7137 void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle,
    7138                                    files_struct *fsp, size_t ext_size,
    7139                                    void (*destroy_fn)(void *p_data));
    7140 void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    7141 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    7142 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
    7143 bool smbd_vfs_init(connection_struct *conn);
    7144 NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
    7145 ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
    7146 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
    7147                 size_t byte_count, SMB_OFF_T offset);
    7148 ssize_t vfs_write_data(struct smb_request *req,
    7149                         files_struct *fsp,
    7150                         const char *buffer,
    7151                         size_t N);
    7152 ssize_t vfs_pwrite_data(struct smb_request *req,
    7153                         files_struct *fsp,
    7154                         const char *buffer,
    7155                         size_t N,
    7156                         SMB_OFF_T offset);
    7157 int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
    7158 int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len);
    7159 int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len);
    7160 SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n);
    7161 const char *vfs_readdirname(connection_struct *conn, void *p,
    7162                             SMB_STRUCT_STAT *sbuf, char **talloced);
    7163 int vfs_ChDir(connection_struct *conn, const char *path);
    7164 char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn);
    7165 NTSTATUS check_reduced_name(connection_struct *conn, const char *fname);
    7166 int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
    7167                        SMB_STRUCT_STAT *psbuf);
    7168 int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
    7169                         SMB_STRUCT_STAT *psbuf);
    7170 NTSTATUS vfs_stat_fsp(files_struct *fsp);
    7171 
    7172 /* The following definitions come from torture/denytest.c  */
    7173 
    7174 bool torture_denytest1(int dummy);
    7175 bool torture_denytest2(int dummy);
    7176 
    7177 /* The following definitions come from torture/mangle_test.c  */
    7178 
    7179 bool torture_mangle(int dummy);
    7180 
    7181 /* The following definitions come from torture/nbio.c  */
    7182 
    7183 double nbio_total(void);
    7184 void nb_alarm(int ignore);
    7185 void nbio_shmem(int n);
    7186 void nb_setup(struct cli_state *cli);
    7187 void nb_unlink(const char *fname);
    7188 void nb_createx(const char *fname,
    7189                 unsigned create_options, unsigned create_disposition, int handle);
    7190 void nb_writex(int handle, int offset, int size, int ret_size);
    7191 void nb_readx(int handle, int offset, int size, int ret_size);
    7192 void nb_close(int handle);
    7193 void nb_rmdir(const char *fname);
    7194 void nb_rename(const char *oldname, const char *newname);
    7195 void nb_qpathinfo(const char *fname);
    7196 void nb_qfileinfo(int fnum);
    7197 void nb_qfsinfo(int level);
    7198 void nb_findfirst(const char *mask);
    7199 void nb_flush(int fnum);
    7200 void nb_deltree(const char *dname);
    7201 void nb_cleanup(void);
    7202 
    7203 /* The following definitions come from torture/scanner.c  */
    7204 
    7205 bool torture_trans2_scan(int dummy);
    7206 bool torture_nttrans_scan(int dummy);
    7207 
    7208 /* The following definitions come from torture/torture.c  */
    7209 
    7210 void start_timer(void);
    7211 double end_timer(void);
    7212 void *shm_setup(int size);
    7213 bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx,
    7214                       char **hostname, char **sharename);
    7215 void torture_open_connection_free_unclist(char **unc_list);
    7216 bool torture_open_connection(struct cli_state **c, int conn_index);
    7217 bool torture_cli_session_setup2(struct cli_state *cli, uint16 *new_vuid);
    7218 bool torture_close_connection(struct cli_state *c);
    7219 bool torture_ioctl_test(int dummy);
    7220 bool torture_chkpath_test(int dummy);
    7221 
    7222 /* The following definitions come from torture/utable.c  */
    7223 
    7224 bool torture_utable(int dummy);
    7225 bool torture_casetable(int dummy);
    7226 
    7227 /* The following definitions come from utils/passwd_util.c  */
    7228 
    7229 char *stdin_new_passwd( void);
    7230 char *get_pass( const char *prompt, bool stdin_get);
    7231 
    7232 /* The following definitions come from winbindd/idmap.c  */
    7233 
    7234 bool idmap_is_offline(void);
    7235 bool idmap_is_online(void);
    7236 NTSTATUS smb_register_idmap(int version, const char *name,
    7237                             struct idmap_methods *methods);
    7238 NTSTATUS smb_register_idmap_alloc(int version, const char *name,
    7239                                   struct idmap_alloc_methods *methods);
    7240 void idmap_close(void);
    7241 NTSTATUS idmap_init_cache(void);
    7242 NTSTATUS idmap_allocate_uid(struct unixid *id);
    7243 NTSTATUS idmap_allocate_gid(struct unixid *id);
    7244 NTSTATUS idmap_set_uid_hwm(struct unixid *id);
    7245 NTSTATUS idmap_set_gid_hwm(struct unixid *id);
    7246 NTSTATUS idmap_backends_unixid_to_sid(const char *domname,
    7247                                       struct id_map *id);
    7248 NTSTATUS idmap_backends_sid_to_unixid(const char *domname,
    7249                                       struct id_map *id);
    7250 NTSTATUS idmap_new_mapping(const struct dom_sid *psid, enum id_type type,
    7251                            struct unixid *pxid);
    7252 NTSTATUS idmap_set_mapping(const struct id_map *map);
    7253 NTSTATUS idmap_remove_mapping(const struct id_map *map);
    7254 
    7255 /* The following definitions come from winbindd/idmap_cache.c  */
    7256 
    7257 bool idmap_cache_find_sid2uid(const struct dom_sid *sid, uid_t *puid,
    7258                               bool *expired);
    7259 bool idmap_cache_find_uid2sid(uid_t uid, struct dom_sid *sid, bool *expired);
    7260 void idmap_cache_set_sid2uid(const struct dom_sid *sid, uid_t uid);
    7261 bool idmap_cache_find_sid2gid(const struct dom_sid *sid, gid_t *pgid,
    7262                               bool *expired);
    7263 bool idmap_cache_find_gid2sid(gid_t gid, struct dom_sid *sid, bool *expired);
    7264 void idmap_cache_set_sid2gid(const struct dom_sid *sid, gid_t gid);
    7265 
    7266 
    7267 /* The following definitions come from winbindd/idmap_nss.c  */
    7268 
    7269 NTSTATUS idmap_nss_init(void);
    7270 
    7271 /* The following definitions come from winbindd/idmap_passdb.c  */
    7272 
    7273 NTSTATUS idmap_passdb_init(void);
    7274 
    7275 /* The following definitions come from winbindd/idmap_tdb.c  */
    7276 
    7277 bool idmap_tdb_tdb_close(TDB_CONTEXT *tdbctx);
    7278 NTSTATUS idmap_alloc_tdb_init(void);
    7279 NTSTATUS idmap_tdb_init(void);
    7280 
    7281 /* The following definitions come from winbindd/idmap_util.c  */
    7282 
    7283 NTSTATUS idmap_uid_to_sid(const char *domname, DOM_SID *sid, uid_t uid);
    7284 NTSTATUS idmap_gid_to_sid(const char *domname, DOM_SID *sid, gid_t gid);
    7285 NTSTATUS idmap_sid_to_uid(const char *dom_name, DOM_SID *sid, uid_t *uid);
    7286 NTSTATUS idmap_sid_to_gid(const char *domname, DOM_SID *sid, gid_t *gid);
    7287 
    7288 /* The following definitions come from winbindd/nss_info.c  */
    7289 
    7290 
    7291 /* The following definitions come from winbindd/nss_info_template.c  */
    7292 
    7293 NTSTATUS nss_info_template_init( void );
    7294 
    7295 /* The following definitions come from lib/avahi.c */
    7296 
    7297 struct AvahiPoll *tevent_avahi_poll(TALLOC_CTX *mem_ctx,
    7298                                     struct tevent_context *ev);
    7299 
    7300 /* The following definitions come from smbd/avahi_register.c */
    7301 
    7302 void *avahi_start_register(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
    7303                            uint16_t port);
    7304 
    7305 /* Misc protos */
    7306 
    7307 struct fncall_context *fncall_context_init(TALLOC_CTX *mem_ctx,
    7308                                            int max_threads);
    7309 struct tevent_req *fncall_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
    7310                                struct fncall_context *ctx,
    7311                                void (*fn)(void *private_data),
    7312                                void *private_data);
    7313 int fncall_recv(struct tevent_req *req, int *perr);
    7314 
    7315 struct tevent_req *smbsock_connect_send(TALLOC_CTX *mem_ctx,
    7316                                         struct tevent_context *ev,
    7317                                         const struct sockaddr_storage *addr,
    7318                                         const char *called_name,
    7319                                         const char *calling_name);
    7320 NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
    7321                               uint16_t *port);
    7322 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr,
    7323                          const char *called_name, const char *calling_name,
    7324                          int *pfd, uint16_t *port);
    7325 
    7326 struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
    7327                                             struct tevent_context *ev,
    7328                                             const struct sockaddr_storage *addrs,
    7329                                             const char **called_names,
    7330                                             size_t num_addrs);
    7331 NTSTATUS smbsock_any_connect_recv(struct tevent_req *req, int *pfd,
    7332                                   size_t *chosen_index, uint16_t *port);
    7333 NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
    7334                              const char **called_names, size_t num_addrs,
    7335                              int *pfd, size_t *chosen_index, uint16_t *port);
    7336 
    7337 /* The following definitions come from rpc_server/srv_samr_nt.c */
    7338 NTSTATUS access_check_object( SEC_DESC *psd, NT_USER_TOKEN *token,
    7339                                 SE_PRIV *rights, uint32 rights_mask,
    7340                                 uint32 des_access, uint32 *acc_granted,
    7341                                 const char *debug);
    7342 void map_max_allowed_access(const NT_USER_TOKEN *nt_token,
    7343                             const struct unix_user_token *unix_token,
    7344                             uint32_t *pacc_requested);
    7345 
    7346 /* The following definitions come from ../libds/common/flag_mapping.c  */
    7347 
    7348 uint32_t ds_acb2uf(uint32_t acb);
    7349 uint32_t ds_uf2acb(uint32_t uf);
    7350 uint32_t ds_uf2atype(uint32_t uf);
    7351 uint32_t ds_gtype2atype(uint32_t gtype);
    7352 enum lsa_SidType ds_atype_map(uint32_t atype);
    73531973
    73541974#endif /*  _PROTO_H_  */
  • trunk/server/source3/include/rpc_dce.h

    r414 r745  
    2323#define _DCE_RPC_H
    2424
    25 #define RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN  0x20
    26 
    2725/* Maximum size of the signing data in a fragment. */
    2826#define RPC_MAX_SIGN_SIZE 0x38 /* 56 */
     
    3230#define RPC_MAX_PDU_FRAG_LEN 0x10b8                     /* this is what w2k sets */
    3331
    34 #define RPC_IFACE_LEN (UUID_SIZE + 4)
    35 
    36 /* RPC_HDR - dce rpc header */
    37 typedef struct rpc_hdr_info {
    38         uint8  major; /* 5 - RPC major version */
    39         uint8  minor; /* 0 - RPC minor version */
    40         uint8  pkt_type; /* dcerpc_pkt_type - RPC response packet */
    41         uint8  flags; /* DCE/RPC flags */
    42         uint8  pack_type[4]; /* 0x1000 0000 - little-endian packed data representation */
    43         uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */
    44         uint16 auth_len; /* 0 - authentication length  */
    45         uint32 call_id; /* call identifier.  matches 12th uint32 of incoming RPC data. */
    46 } RPC_HDR;
    47 
    4832#define RPC_HEADER_LEN 16
    4933
    50 /* RPC_HDR_REQ - ms request rpc header */
    51 typedef struct rpc_hdr_req_info {
    52         uint32 alloc_hint;   /* allocation hint - data size (bytes) minus header and tail. */
    53         uint16 context_id;   /* presentation context identifier */
    54         uint16  opnum;       /* opnum */
    55 } RPC_HDR_REQ;
    56 
    57 #define RPC_HDR_REQ_LEN 8
    58 
    59 /* RPC_HDR_RESP - ms response rpc header */
    60 typedef struct rpc_hdr_resp_info {
    61         uint32 alloc_hint;   /* allocation hint - data size (bytes) minus header and tail. */
    62         uint16 context_id;   /* 0 - presentation context identifier */
    63         uint8  cancel_count; /* 0 - cancel count */
    64         uint8  reserved;     /* 0 - reserved. */
    65 } RPC_HDR_RESP;
    66 
    67 #define RPC_HDR_RESP_LEN 8
    68 
    69 /* RPC_HDR_FAULT - fault rpc header */
    70 typedef struct rpc_hdr_fault_info {
    71         NTSTATUS status;
    72         uint32 reserved; /* 0x0000 0000 */
    73 } RPC_HDR_FAULT;
    74 
    75 #define RPC_HDR_FAULT_LEN 8
    76 
    77 /* this seems to be the same string name depending on the name of the pipe,
    78  * but is more likely to be linked to the interface name
    79  * "srvsvc", "\\PIPE\\ntsvcs"
    80  * "samr", "\\PIPE\\lsass"
    81  * "wkssvc", "\\PIPE\\wksvcs"
    82  * "NETLOGON", "\\PIPE\\NETLOGON"
    83  */
    84 /* RPC_ADDR_STR */
    85 typedef struct rpc_addr_info {
    86         uint16 len;   /* length of the string including null terminator */
    87         fstring str; /* the string above in single byte, null terminated form */
    88 } RPC_ADDR_STR;
    89 
    90 /* RPC_HDR_BBA - bind acknowledge, and alter context response. */
    91 typedef struct rpc_hdr_bba_info {
    92         uint16 max_tsize;       /* maximum transmission fragment size (0x1630) */
    93         uint16 max_rsize;       /* max receive fragment size (0x1630) */
    94         uint32 assoc_gid;       /* associated group id (0x0) */
    95 } RPC_HDR_BBA;
    96 
    97 #define RPC_HDR_BBA_LEN 8
    98 
    99 /* RPC_HDR_AUTH */
    100 typedef struct rpc_hdr_auth_info {
    101         uint8 auth_type; /* See XXX_AUTH_TYPE above. */
    102         uint8 auth_level; /* See RPC_PIPE_AUTH_XXX_LEVEL above. */
    103         uint8 auth_pad_len;
    104         uint8 auth_reserved;
    105         uint32 auth_context_id;
    106 } RPC_HDR_AUTH;
    107 
    108 #define RPC_HDR_AUTH_LEN 8
    109 
    110 typedef struct rpc_context {
    111         uint16 context_id;              /* presentation context identifier. */
    112         uint8 num_transfer_syntaxes;    /* the number of syntaxes */
    113         struct ndr_syntax_id abstract;  /* num and vers. of interface client is using */
    114         struct ndr_syntax_id *transfer; /* Array of transfer interfaces. */
    115 } RPC_CONTEXT;
    116 
    117 /* RPC_BIND_REQ - ms req bind */
    118 typedef struct rpc_bind_req_info {
    119         RPC_HDR_BBA bba;
    120         uint8 num_contexts;    /* the number of contexts */
    121         RPC_CONTEXT *rpc_context;
    122 } RPC_HDR_RB;
    123 
    124 /*
    125  * The following length is 8 bytes RPC_HDR_BBA_LEN +
    126  * 4 bytes size of context count +
    127  * (context_count * (4 bytes of context_id, size of transfer syntax count + RPC_IFACE_LEN bytes +
    128  *                    (transfer_syntax_count * RPC_IFACE_LEN bytes)))
    129  */
    130 
    131 #define RPC_HDR_RB_LEN(rpc_hdr_rb) (RPC_HDR_BBA_LEN + 4 + \
    132         ((rpc_hdr_rb)->num_contexts) * (4 + RPC_IFACE_LEN + (((rpc_hdr_rb)->rpc_context->num_transfer_syntaxes)*RPC_IFACE_LEN)))
    133 
    134 /* RPC_RESULTS - can only cope with one reason, right now... */
    135 typedef struct rpc_results_info {
    136         /* uint8[] # 4-byte alignment padding, against SMB header */
    137 
    138         uint8 num_results; /* the number of results (0x01) */
    139 
    140         /* uint8[] # 4-byte alignment padding, against SMB header */
    141 
    142         uint16 result; /* result (0x00 = accept) */
    143         uint16 reason; /* reason (0x00 = no reason specified) */
    144 } RPC_RESULTS;
    145 
    146 /* RPC_HDR_BA */
    147 typedef struct rpc_hdr_ba_info {
    148         RPC_HDR_BBA bba;
    149 
    150         RPC_ADDR_STR addr    ;  /* the secondary address string, as described earlier */
    151         RPC_RESULTS  res     ; /* results and reasons */
    152         struct ndr_syntax_id transfer; /* the transfer syntax from the request */
    153 } RPC_HDR_BA;
     34#define RPC_BIG_ENDIAN          1
     35#define RPC_LITTLE_ENDIAN       0
    15436
    15537#endif /* _DCE_RPC_H */
  • trunk/server/source3/include/rpc_misc.h

    r414 r745  
    2424#define _RPC_MISC_H
    2525
    26 #define SMB_RPC_INTERFACE_VERSION 1
    27 
    28 
    29 /**********************************************************************
    30  * well-known RIDs - Relative IDs
    31  **********************************************************************/
    32 
    33 /* RIDs - Well-known users ... */
    34 #define DOMAIN_USER_RID_ADMIN          (0x000001F4L)
    35 #define DOMAIN_USER_RID_GUEST          (0x000001F5L)
    36 #define DOMAIN_USER_RID_KRBTGT         (0x000001F6L)
    37 
    38 /* RIDs - well-known groups ... */
    39 #define DOMAIN_GROUP_RID_ADMINS        (0x00000200L)
    40 #define DOMAIN_GROUP_RID_USERS         (0x00000201L)
    41 #define DOMAIN_GROUP_RID_GUESTS        (0x00000202L)
    42 #define DOMAIN_GROUP_RID_COMPUTERS     (0x00000203L)
    43 
    44 #define DOMAIN_GROUP_RID_CONTROLLERS   (0x00000204L)
    45 #define DOMAIN_GROUP_RID_CERT_ADMINS   (0x00000205L)
    46 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L)
    47 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L)
    48 
    49 /* is the following the right number? I bet it is  --simo
    50 #define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L)
    51 */
    52 
    53 /* RIDs - well-known aliases ... */
    54 #define BUILTIN_ALIAS_RID_ADMINS        (0x00000220L)
    55 #define BUILTIN_ALIAS_RID_USERS         (0x00000221L)
    56 #define BUILTIN_ALIAS_RID_GUESTS        (0x00000222L)
    57 #define BUILTIN_ALIAS_RID_POWER_USERS   (0x00000223L)
    58 
    59 #define BUILTIN_ALIAS_RID_ACCOUNT_OPS   (0x00000224L)
    60 #define BUILTIN_ALIAS_RID_SYSTEM_OPS    (0x00000225L)
    61 #define BUILTIN_ALIAS_RID_PRINT_OPS     (0x00000226L)
    62 #define BUILTIN_ALIAS_RID_BACKUP_OPS    (0x00000227L)
    63 
    64 #define BUILTIN_ALIAS_RID_REPLICATOR    (0x00000228L)
    65 #define BUILTIN_ALIAS_RID_RAS_SERVERS   (0x00000229L)
    66 #define BUILTIN_ALIAS_RID_PRE_2K_ACCESS (0x0000022aL)
    67 
    68 
    69 
    7026/**********************************************************************
    7127 * RPC policy handle used pretty much everywhere
     
    7733                ((unsigned int)sys_getpid() )
    7834
    79 
    80 /**********************************************************************
    81  * UNICODE string variations
    82  **********************************************************************/
    83 
    84 
    85 typedef struct {                /* UNISTR - unicode string size and buffer */
    86         uint16 *buffer;         /* unicode characters. ***MUST*** be
    87                                    little-endian. ***MUST*** be null-terminated */
    88 } UNISTR;
    89 
    9035#endif /* _RPC_MISC_H */
  • trunk/server/source3/include/safe_string.h

    r414 r745  
    6464
    6565#ifdef DEVELOPER
    66 #define SAFE_STRING_FUNCTION_NAME FUNCTION_MACRO
     66#define SAFE_STRING_FUNCTION_NAME __FUNCTION__
    6767#define SAFE_STRING_LINE __LINE__
    6868#else
     
    147147                        inbuf, dest, src, dest_len, src_len, flags)
    148148
    149 #define clistr_pull_talloc(ctx, inbuf, pp_dest, src, src_len, flags) \
     149#define clistr_pull_talloc(ctx, base, flags2, pp_dest, src, src_len, flags) \
    150150        clistr_pull_talloc_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \
    151                         ctx, inbuf, pp_dest, src, src_len, flags)
     151                              ctx, base, flags2, pp_dest, src, src_len, flags)
    152152
    153153#define srvstr_push(base_ptr, smb_flags2, dest, src, dest_len, flags) \
  • trunk/server/source3/include/secrets.h

    r480 r745  
    6363
    6464/*
    65  * trusted domain entry/entries returned by secrets_get_trusted_domains
    66  * (used in _lsa_enum_trust_dom call)
    67  */
    68 struct trustdom_info {
    69         char *name;
    70         DOM_SID sid;
    71 };
    72 
    73 /*
    7465 * Format of an OpenAFS keyfile
    7566 */
     
    8980#define SECRETS_AFS_KEYFILE "SECRETS/AFS_KEYFILE"
    9081
    91 #define SECRETS_SCHANNEL_STATE "SECRETS/SCHANNEL"
     82/* The following definitions come from passdb/secrets.c  */
     83
     84bool secrets_init(void);
     85struct db_context *secrets_db_ctx(void);
     86void secrets_shutdown(void);
     87void *secrets_fetch(const char *key, size_t *size);
     88bool secrets_store(const char *key, const void *data, size_t size);
     89bool secrets_delete(const char *key);
     90bool secrets_store_domain_sid(const char *domain, const struct dom_sid  *sid);
     91bool secrets_fetch_domain_sid(const char *domain, struct dom_sid  *sid);
     92bool secrets_store_domain_guid(const char *domain, struct GUID *guid);
     93bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid);
     94void *secrets_get_trust_account_lock(TALLOC_CTX *mem_ctx, const char *domain);
     95enum netr_SchannelType get_default_sec_channel(void);
     96bool secrets_fetch_trust_account_password_legacy(const char *domain,
     97                                                 uint8 ret_pwd[16],
     98                                                 time_t *pass_last_set_time,
     99                                                 enum netr_SchannelType *channel);
     100bool secrets_fetch_trust_account_password(const char *domain, uint8 ret_pwd[16],
     101                                          time_t *pass_last_set_time,
     102                                          enum netr_SchannelType *channel);
     103bool secrets_fetch_trusted_domain_password(const char *domain, char** pwd,
     104                                           struct dom_sid  *sid, time_t *pass_last_set_time);
     105bool secrets_store_trusted_domain_password(const char* domain, const char* pwd,
     106                                           const struct dom_sid  *sid);
     107bool secrets_delete_machine_password(const char *domain);
     108bool secrets_delete_machine_password_ex(const char *domain);
     109bool secrets_delete_domain_sid(const char *domain);
     110bool secrets_store_machine_password(const char *pass, const char *domain, enum netr_SchannelType sec_channel);
     111char *secrets_fetch_prev_machine_password(const char *domain);
     112char *secrets_fetch_machine_password(const char *domain,
     113                                     time_t *pass_last_set_time,
     114                                     enum netr_SchannelType *channel);
     115bool trusted_domain_password_delete(const char *domain);
     116bool secrets_store_ldap_pw(const char* dn, char* pw);
     117bool fetch_ldap_pw(char **dn, char** pw);
     118struct trustdom_info;
     119NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
     120                                 struct trustdom_info ***domains);
     121bool secrets_store_afs_keyfile(const char *cell, const struct afs_keyfile *keyfile);
     122bool secrets_fetch_afs_key(const char *cell, struct afs_key *result);
     123void secrets_fetch_ipc_userpass(char **username, char **domain, char **password);
     124bool secrets_store_generic(const char *owner, const char *key, const char *secret);
     125char *secrets_fetch_generic(const char *owner, const char *key);
     126bool secrets_delete_generic(const char *owner, const char *key);
    92127
    93128#endif /* _SECRETS_H */
  • trunk/server/source3/include/smb.h

    r480 r745  
    2828
    2929/* logged when starting the various Samba daemons */
    30 #define COPYRIGHT_STARTUP_MESSAGE       "Copyright Andrew Tridgell and the Samba Team 1992-2010"
     30#define COPYRIGHT_STARTUP_MESSAGE       "Copyright Andrew Tridgell and the Samba Team 1992-2011"
    3131
    3232
     
    6868/* how long to wait for secondary SMB packets (milli-seconds) */
    6969#define SMB_SECONDARY_WAIT (60*1000)
    70 
    71 /* Debugging stuff */
    72 #include "debug.h"
    7370
    7471/* this defines the error codes that receive_smb can put in smb_read_error */
     
    8784#define DIR_STRUCT_SIZE 43
    8885
    89 /* these define the attribute byte as seen by DOS */
    90 #define aRONLY (1L<<0)          /* 0x01 */
    91 #define aHIDDEN (1L<<1)         /* 0x02 */
    92 #define aSYSTEM (1L<<2)         /* 0x04 */
    93 #define aVOLID (1L<<3)          /* 0x08 */
    94 #define aDIR (1L<<4)            /* 0x10 */
    95 #define aARCH (1L<<5)           /* 0x20 */
    96 
    9786/* deny modes */
    9887#define DENY_DOS 0
     
    138127#define OPENX_FILE_FAIL_IF_NOT_EXIST 0
    139128
    140 #include "../libcli/util/doserr.h"
    141 
    142129typedef union unid_t {
    143130        uid_t uid;
     
    145132} unid_t;
    146133
    147 /*
    148  * SMB UCS2 (16-bit unicode) internal type.
    149  * smb_ucs2_t is *always* in little endian format.
    150  */
    151 
    152 #ifdef WORDS_BIGENDIAN
    153 #define UCS2_SHIFT 8
    154 #else
    155 #define UCS2_SHIFT 0
    156 #endif
    157 
    158 /* turn a 7 bit character into a ucs2 character */
    159 #define UCS2_CHAR(c) ((c) << UCS2_SHIFT)
    160 
    161 /* return an ascii version of a ucs2 character */
    162 #define UCS2_TO_CHAR(c) (((c) >> UCS2_SHIFT) & 0xff)
    163 
    164 /* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */
    165 #define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\
    166                                 ((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest))
    167 
    168134/* pipe string names */
    169 #define PIPE_LANMAN   "\\PIPE\\LANMAN"
    170 
    171 #define MAX_HOURS_LEN 32
    172135
    173136#ifndef MAXSUBAUTHS
     
    177140#define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4)))
    178141
    179 #define LOOKUP_NAME_NONE                0x00000000
    180 #define LOOKUP_NAME_ISOLATED             0x00000001  /* Look up unqualified names */
    181 #define LOOKUP_NAME_REMOTE               0x00000002  /* Ask others */
    182 #define LOOKUP_NAME_GROUP                0x00000004  /* (unused) This is a NASTY hack for
    183                                                         valid users = @foo where foo also
    184                                                         exists in as user. */
    185 #define LOOKUP_NAME_NO_NSS               0x00000008  /* no NSS calls to avoid
    186                                                         winbind recursions */
    187 #define LOOKUP_NAME_BUILTIN             0x00000010 /* builtin names */
    188 #define LOOKUP_NAME_WKN                 0x00000020 /* well known names */
    189 #define LOOKUP_NAME_DOMAIN              0x00000040 /* only lookup own domain */
    190 #define LOOKUP_NAME_LOCAL               (LOOKUP_NAME_ISOLATED\
    191                                         |LOOKUP_NAME_BUILTIN\
    192                                         |LOOKUP_NAME_WKN\
    193                                         |LOOKUP_NAME_DOMAIN)
    194 #define LOOKUP_NAME_ALL                 (LOOKUP_NAME_ISOLATED\
    195                                         |LOOKUP_NAME_REMOTE\
    196                                         |LOOKUP_NAME_BUILTIN\
    197                                         |LOOKUP_NAME_WKN\
    198                                         |LOOKUP_NAME_DOMAIN)
    199 
    200 /**
    201  * @brief Security Identifier
    202  *
    203  * @sa http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/accctrl_38yn.asp
    204  **/
    205 typedef struct dom_sid DOM_SID;
    206 
    207 enum id_mapping {
    208         ID_UNKNOWN = 0,
    209         ID_MAPPED,
    210         ID_UNMAPPED,
    211         ID_EXPIRED
    212 };
    213 
    214 enum id_type {
    215         ID_TYPE_NOT_SPECIFIED = 0,
    216         ID_TYPE_UID,
    217         ID_TYPE_GID
    218 };
    219 
    220 struct unixid {
    221         uint32_t id;
    222         enum id_type type;
    223 };
    224 
    225 struct id_map {
    226         DOM_SID *sid;
    227         struct unixid xid;
    228         enum id_mapping status;
    229 };
    230 
    231 #include "librpc/gen_ndr/misc.h"
    232142#include "librpc/gen_ndr/security.h"
    233 #include "librpc/ndr/libndr.h"
    234 #include "librpc/gen_ndr/lsa.h"
    235 #include "librpc/gen_ndr/dfs.h"
    236 #include "librpc/gen_ndr/winreg.h"
    237 #include "librpc/gen_ndr/initshutdown.h"
    238 #include "librpc/gen_ndr/eventlog.h"
    239 #include "librpc/gen_ndr/srvsvc.h"
    240 #include "librpc/gen_ndr/wkssvc.h"
    241 #include "librpc/gen_ndr/echo.h"
    242 #include "librpc/gen_ndr/svcctl.h"
    243 #include "librpc/gen_ndr/netlogon.h"
    244 #include "librpc/gen_ndr/samr.h"
    245 #include "librpc/gen_ndr/dssetup.h"
    246 #include "librpc/gen_ndr/epmapper.h"
    247 #include "librpc/gen_ndr/libnet_join.h"
    248 #include "librpc/gen_ndr/krb5pac.h"
    249 #include "librpc/gen_ndr/ntsvcs.h"
    250 #include "librpc/gen_ndr/nbt.h"
    251 #include "librpc/gen_ndr/drsuapi.h"
    252 #include "librpc/gen_ndr/drsblobs.h"
    253 #include "librpc/gen_ndr/spoolss.h"
    254 #include "librpc/gen_ndr/dcerpc.h"
    255 #include "librpc/gen_ndr/ndr_dcerpc.h"
    256 #include "librpc/gen_ndr/ntlmssp.h"
    257 
    258 struct lsa_dom_info {
    259         bool valid;
    260         DOM_SID sid;
    261         const char *name;
    262         int num_idxs;
    263         int *idxs;
    264 };
    265 
    266 struct lsa_name_info {
    267         uint32 rid;
    268         enum lsa_SidType type;
    269         const char *name;
    270         int dom_idx;
    271 };
    272 
    273 /* Some well-known SIDs */
    274 extern const DOM_SID global_sid_World_Domain;
    275 extern const DOM_SID global_sid_World;
    276 extern const DOM_SID global_sid_Creator_Owner_Domain;
    277 extern const DOM_SID global_sid_NT_Authority;
    278 extern const DOM_SID global_sid_System;
    279 extern const DOM_SID global_sid_NULL;
    280 extern const DOM_SID global_sid_Authenticated_Users;
    281 extern const DOM_SID global_sid_Network;
    282 extern const DOM_SID global_sid_Creator_Owner;
    283 extern const DOM_SID global_sid_Creator_Group;
    284 extern const DOM_SID global_sid_Anonymous;
    285 extern const DOM_SID global_sid_Builtin;
    286 extern const DOM_SID global_sid_Builtin_Administrators;
    287 extern const DOM_SID global_sid_Builtin_Users;
    288 extern const DOM_SID global_sid_Builtin_Guests;
    289 extern const DOM_SID global_sid_Builtin_Power_Users;
    290 extern const DOM_SID global_sid_Builtin_Account_Operators;
    291 extern const DOM_SID global_sid_Builtin_Server_Operators;
    292 extern const DOM_SID global_sid_Builtin_Print_Operators;
    293 extern const DOM_SID global_sid_Builtin_Backup_Operators;
    294 extern const DOM_SID global_sid_Builtin_Replicator;
    295 extern const DOM_SID global_sid_Builtin_PreWin2kAccess;
    296 extern const DOM_SID global_sid_Unix_Users;
    297 extern const DOM_SID global_sid_Unix_Groups;
    298143
    299144/*
     
    310155#define PRIMARY_GROUP_SID_INDEX 1
    311156
    312 typedef struct nt_user_token {
    313         size_t num_sids;
    314         DOM_SID *user_sids;
    315         SE_PRIV privileges;
    316 } NT_USER_TOKEN;
    317 
    318 typedef struct unix_user_token {
    319         uid_t uid;
    320         gid_t gid;
    321         size_t ngroups;
    322         gid_t *groups;
    323 } UNIX_USER_TOKEN;
    324 
    325 /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */
    326 typedef struct time_info {
    327         uint32 time;
    328 } UTIME;
    329 
    330157typedef struct write_cache {
    331158        SMB_OFF_T file_size;
     
    336163} write_cache;
    337164
    338 #include "fake_file.h"
    339 
    340165struct fd_handle {
    341166        size_t ref_count;
     
    345170        uint32 private_options; /* NT Create options, but we only look at
    346171                                 * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
    347                                  * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB (Except
     172                                 * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB and
     173                                 * NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE
    348174                                 * for print files *only*, where
    349175                                 * DELETE_ON_CLOSE is not stored in the share
     
    357183struct uuid;
    358184struct named_mutex;
    359 struct pcap_cache;
    360185struct wb_context;
    361186struct rpc_cli_smbd_conn;
     
    411236};
    412237
     238struct 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
    413247typedef struct files_struct {
    414248        struct files_struct *next, *prev;
     
    417251        struct fd_handle *fh;
    418252        unsigned int num_smb_operations;
    419         uint16 rap_print_jobid;
    420253        struct file_id file_id;
    421254        uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */
     
    446279        bool can_read;
    447280        bool can_write;
    448         bool print_file;
    449281        bool modified;
    450282        bool is_directory;
     
    454286        bool delete_on_close;
    455287        bool posix_open;
     288        bool is_sparse;
    456289        struct smb_filename *fsp_name;
     290        uint32_t name_hash;             /* Jenkins hash of full pathname. */
    457291
    458292        struct vfs_fsp_data *vfs_extension;
     
    472306
    473307        struct dptr_struct *dptr;
     308
     309        /* if not NULL, means this is a print file */
     310        struct print_file_data *print_file;
     311
    474312} files_struct;
    475313
     
    477315#include "sysquotas.h"
    478316
     317struct client_address {
     318        char addr[INET6_ADDRSTRLEN];
     319        const char *name;
     320};
     321
    479322struct vuid_cache_entry {
    480         struct auth_serversupplied_info *server_info;
     323        struct auth_serversupplied_info *session_info;
    481324        uint16_t vuid;
    482325        bool read_only;
    483         bool admin_user;
    484326};
    485327
     
    497339        struct trans_state *next, *prev;
    498340        uint16 vuid;
    499         uint16 mid;
     341        uint64_t mid;
    500342
    501343        uint32 max_param_return;
     
    567409        bool ipc;
    568410        bool read_only; /* Attributes for the current user of the share. */
    569         bool admin_user; /* Attributes for the current user of the share. */
     411        uint32_t share_access;
    570412        /* Does this filesystem honor
    571413           sub second timestamps on files
     
    581423         * on the vuid using this tid, this might change per SMB request.
    582424         */
    583         struct auth_serversupplied_info *server_info;
     425        struct auth_serversupplied_info *session_info;
    584426
    585427        /*
     
    588430         */
    589431        gid_t force_group_gid;
    590 
    591         char client_address[INET6_ADDRSTRLEN]; /* String version of client IP address. */
    592432
    593433        uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */
     
    619459        struct trans_state *pending_trans;
    620460        struct notify_context *notify_ctx;
     461
     462        struct rpc_pipe_client *spoolss_pipe;
     463
    621464} connection_struct;
    622465
     
    624467        connection_struct *conn;
    625468        uint16 vuid;
    626         UNIX_USER_TOKEN ut;
    627         NT_USER_TOKEN *nt_user_token;
    628 };
    629 
     469        struct security_unix_token ut;
     470        struct security_token *nt_user_token;
     471};
     472
     473struct smbd_smb2_request;
    630474
    631475struct smb_request {
     
    633477        uint16 flags2;
    634478        uint16 smbpid;
    635         uint16 mid;
     479        uint64_t mid; /* For compatibility with SMB2. */
    636480        uint32_t seqnum;
    637481        uint16 vuid;
     
    657501        bool encrypted;
    658502        connection_struct *conn;
     503        struct smbd_server_connection *sconn;
    659504        struct smb_perfcount_data pcd;
    660505
     
    675520
    676521        bool done;
     522
     523        /*
     524         * Back pointer to smb2 request.
     525         */
     526        struct smbd_smb2_request *smb2req;
    677527};
    678528
     
    687537        fstring domain; /* domain that the client specified */
    688538} userdom_struct;
    689 
    690 /* Extra fields above "LPQ_PRINTING" are used to map extra NT status codes. */
    691 
    692 enum {LPQ_QUEUED=0,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING,LPQ_ERROR,LPQ_DELETING,
    693       LPQ_OFFLINE,LPQ_PAPEROUT,LPQ_PRINTED,LPQ_DELETED,LPQ_BLOCKED,LPQ_USER_INTERVENTION};
    694 
    695 typedef struct _print_queue_struct {
    696         int job;                /* normally the UNIX jobid -- see note in
    697                                    printing.c:traverse_fn_delete() */
    698         int size;
    699         int page_count;
    700         int status;
    701         int priority;
    702         time_t time;
    703         fstring fs_user;
    704         fstring fs_file;
    705 } print_queue_struct;
    706 
    707 enum {LPSTAT_OK, LPSTAT_STOPPED, LPSTAT_ERROR};
    708 
    709 typedef struct {
    710         fstring message;
    711         int qcount;
    712         int status;
    713 }  print_status_struct;
    714539
    715540/* used for server information: client, nameserv and ipc */
     
    747572#define SHARE_MODE_FLAG_POSIX_OPEN      0x1
    748573
     574#include "librpc/gen_ndr/server_id.h"
     575
    749576/* struct returned by get_share_modes */
    750577struct share_mode_entry {
    751578        struct server_id pid;
    752         uint16 op_mid;
     579        uint64_t op_mid;        /* For compatibility with SMB2 opens. */
    753580        uint16 op_type;
    754581        uint32 access_mask;             /* NTCreateX access bits (FILE_READ_DATA etc.) */
     
    763590        uint32 uid;             /* uid of file opener. */
    764591        uint16 flags;           /* See SHARE_MODE_XX above. */
     592        uint32_t name_hash;             /* Jenkins hash of full pathname. */
    765593};
    766594
     
    769597Offset  Data                    length.
    7705980       struct server_id pid    4
    771 4       uint16 op_mid           2
    772 6       uint16 op_type          2
    773 8       uint32 access_mask      4
    774 12      uint32 share_access     4
    775 16      uint32 private_options  4
    776 20      uint32 time sec         4
    777 24      uint32 time usec        4
    778 28      uint64 dev              8 bytes
    779 36      uint64 inode            8 bytes
    780 44      uint64 extid            8 bytes
    781 52      unsigned long file_id   4 bytes
    782 56      uint32 uid              4 bytes
    783 60      uint16 flags            2 bytes
    784 62
     5994       uint16 op_mid           8
     60012      uint16 op_type          2
     60114      uint32 access_mask      4
     60218      uint32 share_access     4
     60322      uint32 private_options  4
     60426      uint32 time sec         4
     60530      uint32 time usec        4
     60634      uint64 dev              8 bytes
     60742      uint64 inode            8 bytes
     60850      uint64 extid            8 bytes
     60958      unsigned long file_id   4 bytes
     61062      uint32 uid              4 bytes
     61166      uint16 flags            2 bytes
     61268      uint32 name_hash        4 bytes
     61372
    785614
    786615*/
    787 #ifdef CLUSTER_SUPPORT
    788 #define MSG_SMB_SHARE_MODE_ENTRY_SIZE 66
    789 #else
    790 #define MSG_SMB_SHARE_MODE_ENTRY_SIZE 62
    791 #endif
     616
     617#define OP_BREAK_MSG_PID_OFFSET 0
     618#define OP_BREAK_MSG_MID_OFFSET 4
     619#define OP_BREAK_MSG_OP_TYPE_OFFSET 12
     620#define OP_BREAK_MSG_ACCESS_MASK_OFFSET 14
     621#define OP_BREAK_MSG_SHARE_ACCESS_OFFSET 18
     622#define OP_BREAK_MSG_PRIV_OFFSET 22
     623#define OP_BREAK_MSG_TIME_SEC_OFFSET 26
     624#define OP_BREAK_MSG_TIME_USEC_OFFSET 30
     625#define OP_BREAK_MSG_DEV_OFFSET 34
     626#define OP_BREAK_MSG_INO_OFFSET 42
     627#define OP_BREAK_MSG_EXTID_OFFSET 50
     628#define OP_BREAK_MSG_FILE_ID_OFFSET 58
     629#define OP_BREAK_MSG_UID_OFFSET 62
     630#define OP_BREAK_MSG_FLAGS_OFFSET 66
     631#define OP_BREAK_MSG_NAME_HASH_OFFSET 68
     632
     633#define OP_BREAK_MSG_VNN_OFFSET 72
     634#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 76
     635
     636struct delete_token_list {
     637        struct delete_token_list *next, *prev;
     638        uint32_t name_hash;
     639        struct security_unix_token *delete_token;
     640};
    792641
    793642struct share_mode_lock {
     
    798647        int num_share_modes;
    799648        struct share_mode_entry *share_modes;
    800         UNIX_USER_TOKEN *delete_token;
    801         bool delete_on_close;
     649        struct delete_token_list *delete_tokens;
    802650        struct timespec old_write_time;
    803651        struct timespec changed_write_time;
     
    816664                struct {
    817665                        int num_share_mode_entries;
    818                         bool delete_on_close;
    819666                        struct timespec old_write_time;
    820667                        struct timespec changed_write_time;
    821                         uint32 delete_token_size; /* Only valid if either of
    822                                                      the two previous fields
    823                                                      are True. */
     668                        uint32 num_delete_token_entries;
    824669                } s;
    825670                struct share_mode_entry dummy; /* Needed for alignment. */
    826671        } u;
    827672        /* The following four entries are implicit
    828            struct share_mode_entry modes[num_share_mode_entries];
    829            char unix_token[delete_token_size] (divisible by 4).
    830            char share_name[];
    831            char file_name[];
     673
     674           (1) struct share_mode_entry modes[num_share_mode_entries];
     675
     676           (2) A num_delete_token_entries of structs {
     677                uint32_t len_delete_token;
     678                char unix_token[len_delete_token] (divisible by 4).
     679           };
     680
     681           (3) char share_name[];
     682           (4) char file_name[];
    832683        */
    833684};
    834 
    835 /* Used to store pipe open records for NetFileEnum() */
    836 
    837 struct pipe_open_rec {
    838         struct server_id pid;
    839         uid_t uid;
    840         int pnum;
    841         fstring name;
    842 };
    843 
    844685
    845686#define NT_HASH_LEN 16
    846687#define LM_HASH_LEN 16
    847 
    848 /* Password history contants. */
    849 #define PW_HISTORY_SALT_LEN 16
    850 #define SALTED_MD5_HASH_LEN 16
    851 #define PW_HISTORY_ENTRY_LEN (PW_HISTORY_SALT_LEN+SALTED_MD5_HASH_LEN)
    852 #define MAX_PW_HISTORY_LEN 24
    853 
    854 /*
    855  * Flags for local user manipulation.
    856  */
    857 
    858 #define LOCAL_ADD_USER 0x1
    859 #define LOCAL_DELETE_USER 0x2
    860 #define LOCAL_DISABLE_USER 0x4
    861 #define LOCAL_ENABLE_USER 0x8
    862 #define LOCAL_TRUST_ACCOUNT 0x10
    863 #define LOCAL_SET_NO_PASSWORD 0x20
    864 #define LOCAL_SET_PASSWORD 0x40
    865 #define LOCAL_SET_LDAP_ADMIN_PW 0x80
    866 #define LOCAL_INTERDOM_ACCOUNT 0x100
    867 #define LOCAL_AM_ROOT 0x200  /* Act as root */
    868688
    869689/* key and data in the connections database - used in smbstatus and smbd */
     
    884704        char machine[FSTRING_LEN];
    885705        time_t start;
    886         uint32 bcast_msg_flags;
     706
     707        /*
     708         * This field used to hold the msg_flags. For compatibility reasons,
     709         * keep the data structure in the tdb file the same.
     710         */
     711        uint32 unused_compatitibility_field;
    887712};
    888713
     
    932757#define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */
    933758#define FLAG_META       0x8000 /* A meta directive - not a real parameter */
     759#define FLAG_CMDLINE    0x10000 /* option has been overridden */
    934760
    935761struct bitmap {
     
    12061032#define PIPE_START_MESSAGE 0x8
    12071033
    1208 /* File Specific access rights */
    1209 #define FILE_READ_DATA        0x00000001
    1210 #define FILE_WRITE_DATA       0x00000002
    1211 #define FILE_APPEND_DATA      0x00000004
    1212 #define FILE_READ_EA          0x00000008 /* File and directory */
    1213 #define FILE_WRITE_EA         0x00000010 /* File and directory */
    1214 #define FILE_EXECUTE          0x00000020
    1215 #define FILE_DELETE_CHILD     0x00000040
    1216 #define FILE_READ_ATTRIBUTES  0x00000080
    1217 #define FILE_WRITE_ATTRIBUTES 0x00000100
    1218 
    1219 #define FILE_ALL_ACCESS       0x000001FF
    1220 
    1221 /* Directory specific access rights */
    1222 #define FILE_LIST_DIRECTORY   0x00000001
    1223 #define FILE_ADD_FILE         0x00000002
    1224 #define FILE_ADD_SUBDIRECTORY 0x00000004
    1225 #define FILE_TRAVERSE         0x00000020
    1226 #define FILE_DELETE_CHILD     0x00000040
    1227 
    12281034/* the desired access to use when opening a pipe */
    12291035#define DESIRED_ACCESS_PIPE 0x2019f
    12301036 
    1231 /* Generic access masks & rights. */
    1232 #define DELETE_ACCESS        0x00010000 /* (1L<<16) */
    1233 #define READ_CONTROL_ACCESS  0x00020000 /* (1L<<17) */
    1234 #define WRITE_DAC_ACCESS     0x00040000 /* (1L<<18) */
    1235 #define WRITE_OWNER_ACCESS   0x00080000 /* (1L<<19) */
    1236 #define SYNCHRONIZE_ACCESS   0x00100000 /* (1L<<20) */
    1237 
    1238 #define SYSTEM_SECURITY_ACCESS 0x01000000 /* (1L<<24) */
    1239 #define MAXIMUM_ALLOWED_ACCESS 0x02000000 /* (1L<<25) */
    1240 #define GENERIC_ALL_ACCESS     0x10000000 /* (1<<28) */
    1241 #define GENERIC_EXECUTE_ACCESS 0x20000000 /* (1<<29) */
    1242 #define GENERIC_WRITE_ACCESS   0x40000000 /* (1<<30) */
    1243 #define GENERIC_READ_ACCESS    ((unsigned)0x80000000) /* (((unsigned)1)<<31) */
    1244 
    1245 /* Mapping of generic access rights for files to specific rights. */
    1246 
    1247 /* This maps to 0x1F01FF */
    1248 #define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS|\
    1249                           SYNCHRONIZE_ACCESS|\
    1250                           FILE_ALL_ACCESS)
    1251 
    1252 /* This maps to 0x120089 */
    1253 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ_ACCESS|\
    1254                            FILE_READ_DATA|\
    1255                            FILE_READ_ATTRIBUTES|\
    1256                            FILE_READ_EA|\
    1257                            SYNCHRONIZE_ACCESS)
    1258 
    1259 /* This maps to 0x120116 */
    1260 #define FILE_GENERIC_WRITE (STD_RIGHT_READ_CONTROL_ACCESS|\
    1261                             FILE_WRITE_DATA|\
    1262                             FILE_WRITE_ATTRIBUTES|\
    1263                             FILE_WRITE_EA|\
    1264                             FILE_APPEND_DATA|\
    1265                             SYNCHRONIZE_ACCESS)
    1266 
    1267 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|\
    1268                               FILE_READ_ATTRIBUTES|\
    1269                               FILE_EXECUTE|\
    1270                               SYNCHRONIZE_ACCESS)
    1271 
    1272 /* Share specific rights. */
    1273 #define SHARE_ALL_ACCESS      FILE_GENERIC_ALL
    1274 #define SHARE_READ_ONLY       (FILE_GENERIC_READ|FILE_EXECUTE)
    1275 
    12761037/* Mapping of access rights to UNIX perms. */
    12771038#define UNIX_ACCESS_RWX         FILE_GENERIC_ALL
     
    13191080#define FILE_ATTRIBUTE_HIDDEN           0x002L
    13201081#define FILE_ATTRIBUTE_SYSTEM           0x004L
     1082#define FILE_ATTRIBUTE_VOLUME           0x008L
    13211083#define FILE_ATTRIBUTE_DIRECTORY        0x010L
    13221084#define FILE_ATTRIBUTE_ARCHIVE          0x020L
     
    13291091#define FILE_ATTRIBUTE_NONINDEXED       0x2000L
    13301092#define FILE_ATTRIBUTE_ENCRYPTED        0x4000L
    1331 #define SAMBA_ATTRIBUTES_MASK           0x7F
     1093#define SAMBA_ATTRIBUTES_MASK           (FILE_ATTRIBUTE_READONLY|\
     1094                                        FILE_ATTRIBUTE_HIDDEN|\
     1095                                        FILE_ATTRIBUTE_SYSTEM|\
     1096                                        FILE_ATTRIBUTE_DIRECTORY|\
     1097                                        FILE_ATTRIBUTE_ARCHIVE)
    13321098
    13331099/* Flags - combined with attributes. */
     
    13761142/*
    13771143 * Private create options used by the ntcreatex processing code. From Samba4.
    1378  * We reuse some ignored flags for private use.
    1379  */
    1380 #define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS     0x00010000
    1381 #define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB     0x00020000
     1144 * We reuse some ignored flags for private use. Passed in the private_flags
     1145 * argument.
     1146 */
     1147#define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS     0x0001
     1148#define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB     0x0002
    13821149
    13831150/* Private options for streams support */
    1384 #define NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE 0x00040000
     1151#define NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE 0x0004
     1152
     1153/* Private options for printer support */
     1154#define NTCREATEX_OPTIONS_PRIVATE_DELETE_ON_CLOSE 0x0008
    13851155
    13861156/* Responses when opening a file. */
     
    14731243#endif
    14741244
    1475 #ifndef SIGNAL_CAST
    1476 #define SIGNAL_CAST (RETSIGTYPE (*)(int))
    1477 #endif
    1478 
    14791245#ifndef SELECT_CAST
    14801246#define SELECT_CAST
     
    15851351};
    15861352
    1587 /* LDAP schema types */
    1588 enum schema_types {SCHEMA_COMPAT, SCHEMA_AD, SCHEMA_SAMBA};
    1589 
    15901353/* LDAP SSL options */
    15911354enum ldap_ssl_types {LDAP_SSL_OFF, LDAP_SSL_START_TLS};
     
    15931356/* LDAP PASSWD SYNC methods */
    15941357enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};
     1358
     1359/*
     1360 * This should be under the HAVE_KRB5 flag but since they're used
     1361 * in lp_kerberos_method(), they ned to be always available
     1362 * If you add any entries to KERBEROS_VERIFY defines, please modify USE.*KEYTAB macros
     1363 * so they remain accurate.
     1364 */
     1365
     1366#define KERBEROS_VERIFY_SECRETS 0
     1367#define KERBEROS_VERIFY_SYSTEM_KEYTAB 1
     1368#define KERBEROS_VERIFY_DEDICATED_KEYTAB 2
     1369#define KERBEROS_VERIFY_SECRETS_AND_KEYTAB 3
    15951370
    15961371/* Remote architectures we know about. */
    15971372enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT,
    15981373                        RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_VISTA,
    1599                         RA_SAMBA, RA_CIFSFS, RA_WINXP64};
     1374                        RA_SAMBA, RA_CIFSFS, RA_WINXP64, RA_OSX};
    16001375
    16011376/* case handling */
     
    17921567
    17931568/* A netbios node status array element. */
    1794 typedef struct node_status_ {
     1569struct node_status {
    17951570        nstring name;
    17961571        unsigned char type;
    17971572        unsigned char flags;
    1798 } NODE_STATUS_STRUCT;
     1573};
    17991574
    18001575/* The extra info from a NetBIOS node status query */
     
    18121587        int homes_snum;
    18131588
    1814         struct auth_serversupplied_info *server_info;
     1589        struct auth_serversupplied_info *session_info;
    18151590
    18161591        struct auth_ntlmssp_state *auth_ntlmssp_state;
     
    18251600
    18261601/*
    1827  * Size of new password account encoding string.  This is enough space to
    1828  * hold 11 ACB characters, plus the surrounding [] and a terminating null.
    1829  * Do not change unless you are adding new ACB bits!
    1830  */
    1831 
    1832 #define NEW_PW_FORMAT_SPACE_PADDED_LEN 14
    1833 
    1834 /*
    18351602   Do you want session setups at user level security with a invalid
    18361603   password to be rejected or allowed in as guest? WinNT rejects them
     
    18651632
    18661633#define DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH 14
    1867 
    1868 #include "popt_common.h"
    18691634
    18701635#define PORT_NONE       0
     
    18791644        unsigned port;
    18801645};
    1881 
    1882 /* Special name type used to cause a _kerberos DNS lookup. */
    1883 #define KDC_NAME_TYPE 0xDCDC
    18841646
    18851647struct ea_struct {
     
    19021664/* Prefix for xattrs storing streams. */
    19031665#define SAMBA_XATTR_MARKER "user.SAMBA_STREAMS"
    1904 
    1905 #define UUID_SIZE 16
    1906 
    1907 #define UUID_FLAT_SIZE 16
    1908 typedef struct uuid_flat {
    1909         uint8 info[UUID_FLAT_SIZE];
    1910 } UUID_FLAT;
    19111666
    19121667/* map readonly options */
     
    19261681                USERSHARE_PATH_NOT_ALLOWED,
    19271682                USERSHARE_PATH_NOT_DIRECTORY,
    1928                 USERSHARE_POSIX_ERR
     1683                USERSHARE_POSIX_ERR,
     1684                USERSHARE_MALFORMED_SHARENAME_DEF,
     1685                USERSHARE_BAD_SHARENAME
    19291686};
    19301687
     
    19751732};
    19761733
     1734/* Used to keep track of deferred opens. */
     1735struct deferred_open_record;
     1736
     1737/* Client-side offline caching policy types */
     1738#define CSC_POLICY_MANUAL 0
     1739#define CSC_POLICY_DOCUMENTS 1
     1740#define CSC_POLICY_PROGRAMS 2
     1741#define CSC_POLICY_DISABLE 3
     1742
     1743/* Used inside aio code. */
     1744struct aio_extra;
     1745
     1746/*
     1747 * Reasons for cache flush.
     1748 */
     1749
     1750enum flush_reason_enum {
     1751    SEEK_FLUSH,
     1752    READ_FLUSH,
     1753    WRITE_FLUSH,
     1754    READRAW_FLUSH,
     1755    OPLOCK_RELEASE_FLUSH,
     1756    CLOSE_FLUSH,
     1757    SYNC_FLUSH,
     1758    SIZECHANGE_FLUSH,
     1759    /* NUM_FLUSH_REASONS must remain the last value in the enumeration. */
     1760    NUM_FLUSH_REASONS};
     1761
    19771762#endif /* _SMB_H */
  • trunk/server/source3/include/smb_krb5.h

    r414 r745  
     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
    123#ifndef _HEADER_smb_krb5_h
    224#define _HEADER_smb_krb5_h
     
    1537#endif
    1638
     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
    1751#ifndef KRB5_ADDR_NETBIOS
    1852#define KRB5_ADDR_NETBIOS 0x14
     
    2458
    2559/* Heimdal uses a slightly different name */
    26 #if defined(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5)
     60#if defined(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5) && !defined(HAVE_ENCTYPE_ARCFOUR_HMAC)
    2761#define ENCTYPE_ARCFOUR_HMAC ENCTYPE_ARCFOUR_HMAC_MD5
    2862#endif
  • trunk/server/source3/include/smb_macros.h

    r414 r745  
    2929
    3030/* for readability... */
    31 #define IS_DOS_READONLY(test_mode) (((test_mode) & aRONLY) != 0)
    32 #define IS_DOS_DIR(test_mode)      (((test_mode) & aDIR) != 0)
    33 #define IS_DOS_ARCHIVE(test_mode)  (((test_mode) & aARCH) != 0)
    34 #define IS_DOS_SYSTEM(test_mode)   (((test_mode) & aSYSTEM) != 0)
    35 #define IS_DOS_HIDDEN(test_mode)   (((test_mode) & aHIDDEN) != 0)
     31#define IS_DOS_READONLY(test_mode) (((test_mode) & FILE_ATTRIBUTE_READONLY) != 0)
     32#define IS_DOS_DIR(test_mode)      (((test_mode) & FILE_ATTRIBUTE_DIRECTORY) != 0)
     33#define IS_DOS_ARCHIVE(test_mode)  (((test_mode) & FILE_ATTRIBUTE_ARCHIVE) != 0)
     34#define IS_DOS_SYSTEM(test_mode)   (((test_mode) & FILE_ATTRIBUTE_SYSTEM) != 0)
     35#define IS_DOS_HIDDEN(test_mode)   (((test_mode) & FILE_ATTRIBUTE_HIDDEN) != 0)
    3636
    3737#define SMB_WARN(condition, message) \
     
    6969
    7070/* access various service details */
    71 #define SERVICE(snum)      (lp_servicename(snum))
    72 #define PRINTERNAME(snum)  (lp_printername(snum))
    7371#define CAN_WRITE(conn)    (!conn->read_only)
    7472#define VALID_SNUM(snum)   (lp_snum_ok(snum))
     
    147145#define IS_CONN_ENCRYPTED(conn) ((conn) ? (conn)->encrypted_tid : false)
    148146
    149 /*******************************************************************
    150 find the difference in milliseconds between two struct timeval
    151 values
    152 ********************************************************************/
    153 
    154 #define TvalDiff(tvalold,tvalnew) \
    155   (((tvalnew)->tv_sec - (tvalold)->tv_sec)*1000 +  \
    156          ((int)(tvalnew)->tv_usec - (int)(tvalold)->tv_usec)/1000)
    157 
    158147/****************************************************************************
    159148true if two IPv4 addresses are equal
     
    206195
    207196#define IS_DC  (lp_server_role()==ROLE_DOMAIN_PDC || lp_server_role()==ROLE_DOMAIN_BDC)
     197
     198/*
     199 * If you add any entries to KERBEROS_VERIFY defines, please modify the below expressions
     200 * so they remain accurate.
     201 */
     202#define USE_KERBEROS_KEYTAB (KERBEROS_VERIFY_SECRETS != lp_kerberos_method())
     203#define USE_SYSTEM_KEYTAB \
     204    ((KERBEROS_VERIFY_SECRETS_AND_KEYTAB == lp_kerberos_method()) || \
     205     (KERBEROS_VERIFY_SYSTEM_KEYTAB == lp_kerberos_method()))
    208206
    209207/*****************************************************************************
     
    267265#if defined(PARANOID_MALLOC_CHECKER)
    268266
    269 #define PRS_ALLOC_MEM(ps, type, count) (type *)prs_alloc_mem_((ps),sizeof(type),(count))
    270 
    271267/* Get medieval on our ass about malloc.... */
    272268
     
    304300
    305301#else
    306 
    307 #define PRS_ALLOC_MEM(ps, type, count) (type *)prs_alloc_mem((ps),sizeof(type),(count))
    308302
    309303/* Regular malloc code. */
  • trunk/server/source3/include/smb_signing.h

    r414 r745  
    2828                                           bool allowed,
    2929                                           bool mandatory);
     30struct smb_signing_state *smb_signing_init_ex(TALLOC_CTX *mem_ctx,
     31                                              bool allowed,
     32                                              bool mandatory,
     33                                              void *(*alloc_fn)(TALLOC_CTX *, size_t),
     34                                              void (*free_fn)(TALLOC_CTX *, void *));
    3035uint32_t smb_signing_next_seqnum(struct smb_signing_state *si, bool oneway);
    3136void smb_signing_cancel_reply(struct smb_signing_state *si, bool oneway);
  • trunk/server/source3/include/smbldap.h

    r414 r745  
    2323
    2424struct smbldap_state;
     25
     26#include "smb_ldap.h"
    2527
    2628#ifdef HAVE_LDAP
     
    4244#define LDAP_OBJ_TRUST_PASSWORD         "sambaTrustPassword"
    4345#define LDAP_OBJ_TRUSTDOM_PASSWORD      "sambaTrustedDomainPassword"
     46#define LDAP_OBJ_TRUSTED_DOMAIN         "sambaTrustedDomain"
    4447
    4548#define LDAP_OBJ_ACCOUNT                "account"
     
    136139const char** get_attr_list( TALLOC_CTX *mem_ctx, ATTRIB_MAP_ENTRY table[] );
    137140void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
     141void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *newblob);
    138142void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
    139143                      LDAPMod ***mods,
    140144                      const char *attribute, const char *newval);
     145void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
     146                           LDAPMod ***mods,
     147                           const char *attribute, const DATA_BLOB *newblob);
    141148bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
    142149                                   const char *attribute, char *value,
     
    154161        LDAP *ldap_struct;
    155162        pid_t pid;
    156         time_t last_ping;
     163        time_t last_ping; /* monotonic */
    157164        /* retrive-once info */
    158165        const char *uri;
     
    167174        unsigned int num_failures;
    168175
    169         time_t last_use;
     176        time_t last_use; /* monotonic */
    170177        struct event_context *event_context;
    171178        struct timed_event *idle_event;
    172179
    173         struct timeval last_rebind;
     180        struct timeval last_rebind; /* monotonic */
    174181};
    175182
    176183/* struct used by both pdb_ldap.c and pdb_nds.c */
     184
     185struct ipasam_privates;
    177186
    178187struct ldapsam_privates {
     
    185194
    186195        const char *domain_name;
    187         DOM_SID domain_sid;
     196        struct dom_sid domain_sid;
    188197
    189198        /* configuration items */
     
    194203        /* Is this NDS ldap? */
    195204        int is_nds_ldap;
     205
     206        /* Is this IPA ldap? */
     207        int is_ipa_ldap;
     208        struct ipasam_privates *ipasam_privates;
    196209
    197210        /* ldap server location parameter */
     
    205218
    206219/* Functions shared between pdb_ldap.c and pdb_nds.c. */
     220struct pdb_methods;
    207221NTSTATUS pdb_init_ldapsam_compat( struct pdb_methods **pdb_method, const char *location);
    208222void private_data_free_fn(void **result);
     
    232246char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld,
    233247                              LDAPMessage *entry);
    234 
    235 
    236 #else
    237 #define LDAP void
    238 #define LDAPMod void
    239 #define LDAP_CONST const
    240 #define LDAPControl void
    241 struct berval;
    242 struct ldapsam_privates;
     248LDAP *priv2ld(struct ldapsam_privates *priv);
     249
     250/* The following definitions come from lib/smbldap.c  */
     251
     252int smb_ldap_start_tls(LDAP *ldap_struct, int version);
     253int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri);
     254int smbldap_search(struct smbldap_state *ldap_state,
     255                   const char *base, int scope, const char *filter,
     256                   const char *attrs[], int attrsonly,
     257                   LDAPMessage **res);
     258int smbldap_search_paged(struct smbldap_state *ldap_state,
     259                         const char *base, int scope, const char *filter,
     260                         const char **attrs, int attrsonly, int pagesize,
     261                         LDAPMessage **res, void **cookie);
     262int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
     263int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]);
     264int smbldap_delete(struct smbldap_state *ldap_state, const char *dn);
     265int smbldap_extended_operation(struct smbldap_state *ldap_state,
     266                               LDAP_CONST char *reqoid, struct berval *reqdata,
     267                               LDAPControl **serverctrls, LDAPControl **clientctrls,
     268                               char **retoidp, struct berval **retdatap);
     269int smbldap_search_suffix (struct smbldap_state *ldap_state,
     270                           const char *filter, const char **search_attr,
     271                           LDAPMessage ** result);
     272void smbldap_free_struct(struct smbldap_state **ldap_state) ;
     273NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx,
     274                      const char *location,
     275                      struct smbldap_state **smbldap_state);
     276bool smbldap_has_control(LDAP *ld, const char *control);
     277bool smbldap_has_extension(LDAP *ld, const char *extension);
     278bool smbldap_has_naming_context(LDAP *ld, const char *naming_context);
     279bool 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
     283NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
     284                                    LDAPMessage ** result, const char *domain_name,
     285                                    bool try_add);
     286
    243287#endif  /* HAVE_LDAP */
    244288
     
    247291#define LDAP_PAGE_SIZE 1024
    248292
     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
    249320#endif  /* _SMBLDAP_H */
  • trunk/server/source3/include/smbprofile.h

    r414 r745  
    2727#define PROF_SHMEM_KEY ((key_t)0x07021999)
    2828#define PROF_SHM_MAGIC 0x6349985
    29 #define PROF_SHM_VERSION 11
     29#define PROF_SHM_VERSION 12
    3030
    3131/* time values in the following structure are in microseconds */
     
    4444#define syscall_opendir_time __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, time)
    4545
     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
    4650        PR_VALUE_SYSCALL_READDIR,
    4751#define syscall_readdir_count __profile_stats_value(PR_VALUE_SYSCALL_READDIR, count)
     
    179183#define syscall_ftruncate_count __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, count)
    180184#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)
    181189
    182190        PR_VALUE_SYSCALL_FCNTL_LOCK,
     
    756764#define election_count __profile_stats_value(PR_VALUE_ELECTION, count)
    757765#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)
    758842
    759843        /* This mist remain the last value. */
     
    819903#define ADD_PROFILE_COUNT(x,y) profile_p->x += (y)
    820904
    821 #if defined(HAVE_CLOCK_GETTIME)
    822 
    823 extern clockid_t __profile_clock;
    824 
    825905static inline uint64_t profile_timestamp(void)
    826906{
    827907        struct timespec ts;
    828908
    829         /* FIXME: On a single-CPU system, or a system where we have bound
    830          * daemon threads to single CPUs (eg. using cpusets or processor
    831          * affinity), it might be preferable to use CLOCK_PROCESS_CPUTIME_ID.
    832          */
    833 
    834         clock_gettime(__profile_clock, &ts);
     909        /* we might prefer to use the _COARSE clock variant of CLOCK_MONOTONIC
     910           that one is faster but cached and "just" tick-wise precise */
     911        clock_gettime_mono(&ts);
    835912        return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); /* usec */
    836913}
    837 
    838 #else
    839 
    840 static inline uint64_t profile_timestamp(void)
    841 {
    842         struct timeval tv;
    843         GetTimeOfDay(&tv);
    844         return (tv.tv_sec * 1000000) + tv.tv_usec;
    845 }
    846 
    847 #endif
    848914
    849915/* end of helper macros */
     
    890956                    profile_timestamp() - __profstamp_##x); \
    891957        }
    892 
    893 
    894958#else /* WITH_PROFILE */
    895959
     
    901965#define START_PROFILE_BYTES(x,n)
    902966#define END_PROFILE(x)
    903 
    904967#endif /* WITH_PROFILE */
    905968
     969/* The following definitions come from profile/profile.c  */
     970
     971void set_profile_level(int level, struct server_id src);
     972bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
     973
    906974#endif
  • trunk/server/source3/include/tldap.h

    r414 r745  
    109109                 struct tldap_message ***refs);
    110110bool tldap_entry_dn(struct tldap_message *msg, char **dn);
    111 bool tldap_entry_attributes(struct tldap_message *msg, int *num_attributes,
    112                             struct tldap_attribute **attributes);
     111bool tldap_entry_attributes(struct tldap_message *msg,
     112                            struct tldap_attribute **attributes,
     113                            int *num_attributes);
    113114
    114115struct tevent_req *tldap_add_send(TALLOC_CTX *mem_ctx,
     
    124125int tldap_add_recv(struct tevent_req *req);
    125126int tldap_add(struct tldap_context *ld, const char *dn,
    126               int num_attributes, struct tldap_mod *attributes,
     127              struct tldap_mod *attributes, int num_attributes,
    127128              struct tldap_control *sctrls, int num_sctrls,
    128129              struct tldap_control *cctrls, int num_cctrls);
     
    132133                                     struct tldap_context *ld,
    133134                                     const char *dn,
    134                                      int num_mods, struct tldap_mod *mods,
     135                                     struct tldap_mod *mods, int num_mods,
    135136                                     struct tldap_control *sctrls,
    136137                                     int num_sctrls,
     
    139140int tldap_modify_recv(struct tevent_req *req);
    140141int tldap_modify(struct tldap_context *ld, const char *dn,
    141                  int num_mods, struct tldap_mod *mods,
     142                 struct tldap_mod *mods, int num_mods,
    142143                 struct tldap_control *sctrls, int num_sctrls,
    143144                 struct tldap_control *cctrls, int num_cctrls);
  • trunk/server/source3/include/tldap_util.h

    r414 r745  
    2424
    2525bool tldap_entry_values(struct tldap_message *msg, const char *attribute,
    26                         int *num_values, DATA_BLOB **values);
     26                        DATA_BLOB **values, int *num_values);
    2727bool tldap_get_single_valueblob(struct tldap_message *msg,
    2828                                const char *attribute, DATA_BLOB *blob);
     
    3434bool tldap_pull_guid(struct tldap_message *msg, const char *attribute,
    3535                     struct GUID *guid);
    36 bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
     36bool tldap_add_mod_blobs(TALLOC_CTX *mem_ctx,
     37                         struct tldap_mod **pmods, int *pnum_mods,
    3738                         int mod_op, const char *attrib,
    38                          int num_values, DATA_BLOB *values);
    39 bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, struct tldap_mod **pmods,
     39                         DATA_BLOB *newvals, int num_newvals);
     40bool tldap_add_mod_str(TALLOC_CTX *mem_ctx,
     41                       struct tldap_mod **pmods, int *pnum_mods,
    4042                       int mod_op, const char *attrib, const char *str);
    4143bool tldap_make_mod_blob(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
    42                          int *pnum_mods, struct tldap_mod **pmods,
     44                         struct tldap_mod **pmods, int *pnum_mods,
    4345                         const char *attrib, DATA_BLOB newval);
    4446bool tldap_make_mod_fmt(struct tldap_message *existing, TALLOC_CTX *mem_ctx,
    45                         int *pnum_mods, struct tldap_mod **pmods,
     47                        struct tldap_mod **pmods, int *pnum_mods,
    4648                        const char *attrib, const char *fmt, ...);
    4749
  • trunk/server/source3/include/trans2.h

    r414 r745  
    295295#define SMB_FILE_NAME_INFORMATION                       1009
    296296#define SMB_FILE_RENAME_INFORMATION                     1010
     297#define SMB2_FILE_RENAME_INFORMATION_INTERNAL           0xFF0A  /* Internal mapped version. */
    297298#define SMB_FILE_LINK_INFORMATION                       1011
    298299#define SMB_FILE_NAMES_INFORMATION                      1012
     
    334335#define SMB_FS_OBJECTID_INFORMATION                     1008
    335336
     337/* SMB_FS_DEVICE_INFORMATION device types. */
     338#define FILE_DEVICE_CD_ROM              0x2
     339#define FILE_DEVICE_DISK                0x7
     340
     341/* SMB_FS_DEVICE_INFORMATION characteristics. */
     342#define FILE_REMOVABLE_MEDIA            0x001
     343#define FILE_READ_ONLY_DEVICE           0x002
     344#define FILE_FLOPPY_DISKETTE            0x004
     345#define FILE_WRITE_ONCE_MEDIA           0x008
     346#define FILE_REMOTE_DEVICE              0x010
     347#define FILE_DEVICE_IS_MOUNTED          0x020
     348#define FILE_VIRTUAL_VOLUME             0x040
     349#define FILE_DEVICE_SECURE_OPEN         0x100
     350
    336351/* flags on trans2 findfirst/findnext that control search */
    337352#define FLAG_TRANS2_FIND_CLOSE          0x1
     
    651666
    652667        8 bytes unsigned[] -    list of GIDs (may be empty)
    653         DOM_SID[] -             list of SIDs (may be empty)
     668        struct dom_sid[] -              list of SIDs (may be empty)
    654669*/
    655670
  • trunk/server/source3/include/util_tdb.h

    r414 r745  
    2121#define __TDBUTIL_H__
    2222
    23 #include "tdb.h"
     23#include <tdb.h>
    2424
    25 #include "talloc.h" /* for tdb_wrap_open() */
     25#include <talloc.h> /* for tdb_wrap_open() */
    2626#include "../libcli/util/ntstatus.h" /* for map_nt_error_from_tdb() */
    2727#include "../../lib/util/util_tdb.h"
    28 
    29 struct tdb_wrap {
    30         struct tdb_context *tdb;
    31         const char *name;
    32         struct tdb_wrap *next, *prev;
    33 };
    3428
    3529int tdb_chainlock_with_timeout( struct tdb_context *tdb, TDB_DATA key,
     
    5448                                 int tdb_flags, int open_flags, mode_t mode);
    5549
    56 struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx,
    57                                const char *name, int hash_size, int tdb_flags,
    58                                int open_flags, mode_t mode);
    59 
    6050NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err);
    6151
  • trunk/server/source3/include/vfs.h

    r414 r745  
    126126/* Leave at 27 - not yet released. Add translate_name VFS call to convert
    127127                 UNIX names to Windows supported names -- asrinivasan. */
    128 #define SMB_VFS_INTERFACE_VERSION 27
    129 
    130 
    131 /* to bug old modules which are trying to compile with the old functions */
    132 #define vfs_init __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore(void) { __ERROR_please_port_this_module_to_SMB_VFS_INTERFACE_VERSION_8_donot_use_vfs_init_anymore };
    133 #define lp_parm_string __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string { \
    134   __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string };
    135 #define lp_vfs_options __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead { \
    136   __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead };
     128/* Changed to version 28 - Add private_flags uint32_t to CREATE call. */
     129/* Leave at 28 - not yet released. Change realpath to assume NULL and return a
     130                 malloc'ed path. JRA. */
     131/* Leave at 28 - not yet released. Move posix_fallocate into the VFS
     132                where it belongs. JRA. */
     133/* Leave at 28 - not yet released. Rename posix_fallocate to fallocate
     134                to split out the two possible uses. JRA. */
     135/* Leave at 28 - not yet released. Add fdopendir. JRA. */
     136/* Leave at 28 - not yet released. Rename open function to open_fn. - gd */
     137#define SMB_VFS_INTERFACE_VERSION 28
    137138
    138139/*
     
    164165};
    165166
     167enum vfs_fallocate_mode {
     168        VFS_FALLOCATE_EXTEND_SIZE = 0,
     169        VFS_FALLOCATE_KEEP_SIZE = 1
     170};
     171
    166172/*
    167173    Available VFS operations. These values must be in sync with vfs_ops struct
     
    170176    should be added to vfs_op_type so that order of them kept same as in vfs_ops.
    171177*/
     178struct shadow_copy_data;
    172179
    173180struct vfs_fn_pointers {
     
    180187        int (*get_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
    181188        int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
    182         int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels);
     189        int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels);
    183190        int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
    184191        uint32_t (*fs_capabilities)(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res);
     
    187194
    188195        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);
    189197        SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle,
    190198                                      SMB_STRUCT_DIR *dirp,
     
    200208        /* File operations */
    201209
    202         int (*open)(struct vfs_handle_struct *handle,
    203                     struct smb_filename *smb_fname, files_struct *fsp,
    204                     int flags, mode_t mode);
     210        int (*open_fn)(struct vfs_handle_struct *handle,
     211                       struct smb_filename *smb_fname, files_struct *fsp,
     212                       int flags, mode_t mode);
    205213        NTSTATUS (*create_file)(struct vfs_handle_struct *handle,
    206214                                struct smb_request *req,
     
    214222                                uint32_t oplock_request,
    215223                                uint64_t allocation_size,
     224                                uint32_t private_flags,
    216225                                struct security_descriptor *sd,
    217226                                struct ea_list *ea_list,
     
    247256                      struct smb_file_time *ft);
    248257        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);
    249263        bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
    250264        int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp,
     
    256270        int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath);
    257271        int (*mknod)(struct vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev);
    258         char *(*realpath)(struct vfs_handle_struct *handle, const char *path, char *resolved_path);
     272        char *(*realpath)(struct vfs_handle_struct *handle, const char *path);
    259273        NTSTATUS (*notify_watch)(struct vfs_handle_struct *handle,
    260274                                 struct sys_notify_context *ctx,
     
    382396
    383397        /* offline operations */
    384         bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
    385         int (*set_offline)(struct vfs_handle_struct *handle, const char *path);
     398        bool (*is_offline)(struct vfs_handle_struct *handle,
     399                           const struct smb_filename *fname,
     400                           SMB_STRUCT_STAT *sbuf);
     401        int (*set_offline)(struct vfs_handle_struct *handle,
     402                           const struct smb_filename *fname);
    386403};
    387404
     
    452469#define SMB_VFS_HANDLE_GET_DATA(handle, datap, type, ret) { \
    453470        if (!(handle)||((datap=(type *)(handle)->data)==NULL)) { \
    454                 DEBUG(0,("%s() failed to get vfs_handle->data!\n",FUNCTION_MACRO)); \
     471                DEBUG(0,("%s() failed to get vfs_handle->data!\n",__FUNCTION__)); \
    455472                ret; \
    456473        } \
     
    459476#define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \
    460477        if (!(handle)) { \
    461                 DEBUG(0,("%s() failed to set handle->data!\n",FUNCTION_MACRO)); \
     478                DEBUG(0,("%s() failed to set handle->data!\n",__FUNCTION__)); \
    462479                ret; \
    463480        } else { \
     
    500517int smb_vfs_call_get_shadow_copy_data(struct vfs_handle_struct *handle,
    501518                                      struct files_struct *fsp,
    502                                       SHADOW_COPY_DATA *shadow_copy_data,
     519                                      struct shadow_copy_data *shadow_copy_data,
    503520                                      bool labels);
    504521int smb_vfs_call_statvfs(struct vfs_handle_struct *handle, const char *path,
     
    509526                                     const char *fname, const char *mask,
    510527                                     uint32 attributes);
     528SMB_STRUCT_DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
     529                                        struct files_struct *fsp,
     530                                        const char *mask,
     531                                        uint32 attributes);
    511532SMB_STRUCT_DIRENT *smb_vfs_call_readdir(struct vfs_handle_struct *handle,
    512533                                        SMB_STRUCT_DIR *dirp,
     
    539560                                  uint32_t oplock_request,
    540561                                  uint64_t allocation_size,
     562                                  uint32_t private_flags,
    541563                                  struct security_descriptor *sd,
    542564                                  struct ea_list *ea_list,
     
    598620int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle,
    599621                           struct files_struct *fsp, SMB_OFF_T offset);
     622int 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);
    600627bool smb_vfs_call_lock(struct vfs_handle_struct *handle,
    601628                       struct files_struct *fsp, int op, SMB_OFF_T offset,
     
    617644int smb_vfs_call_mknod(struct vfs_handle_struct *handle, const char *path,
    618645                       mode_t mode, SMB_DEV_T dev);
    619 char *smb_vfs_call_realpath(struct vfs_handle_struct *handle,
    620                             const char *path, char *resolved_path);
     646char *smb_vfs_call_realpath(struct vfs_handle_struct *handle, const char *path);
    621647NTSTATUS smb_vfs_call_notify_watch(struct vfs_handle_struct *handle,
    622648                                   struct sys_notify_context *ctx,
     
    787813                            struct files_struct *fsp);
    788814bool smb_vfs_call_is_offline(struct vfs_handle_struct *handle,
    789                              const char *path, SMB_STRUCT_STAT *sbuf);
     815                             const struct smb_filename *fname,
     816                             SMB_STRUCT_STAT *sbuf);
    790817int smb_vfs_call_set_offline(struct vfs_handle_struct *handle,
    791                              const char *path);
     818                             const struct smb_filename *fname);
    792819
    793820#endif /* _VFS_H */
  • trunk/server/source3/include/vfs_macros.h

    r414 r745  
    7575        smb_vfs_call_opendir((handle)->next, (fname), (mask), (attr))
    7676
     77#define SMB_VFS_FDOPENDIR(fsp, mask, attr) \
     78        smb_vfs_call_fdopendir((fsp)->conn->vfs_handles, (fsp), (mask), (attr))
     79#define SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr) \
     80        smb_vfs_call_fdopendir((handle)->next, (fsp), (mask), (attr))
     81
    7782#define SMB_VFS_READDIR(conn, dirp, sbuf) \
    7883        smb_vfs_call_readdir((conn)->vfs_handles, (dirp), (sbuf))
     
    121126        smb_vfs_call_open((handle)->next, (fname), (fsp), (flags), (mode))
    122127
    123 #define SMB_VFS_CREATE_FILE(conn, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, allocation_size, sd, ea_list, result, pinfo) \
    124         smb_vfs_call_create_file((conn)->vfs_handles, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), (create_options), (file_attributes), (oplock_request), (allocation_size), (sd), (ea_list), (result), (pinfo))
    125 #define SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, allocation_size, sd, ea_list, result, pinfo) \
    126         smb_vfs_call_create_file((handle)->next, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), (create_options), (file_attributes), (oplock_request), (allocation_size), (sd), (ea_list), (result), (pinfo))
     128#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))
     132#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) \
     134        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))
    127136
    128137#define SMB_VFS_CLOSE(fsp) \
     
    246255        smb_vfs_call_ftruncate((handle)->next, (fsp), (offset))
    247256
     257#define SMB_VFS_FALLOCATE(fsp, mode, offset, len) \
     258        smb_vfs_call_fallocate((fsp)->conn->vfs_handles, (fsp), (mode), (offset), (len))
     259#define SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len) \
     260        smb_vfs_call_fallocate((handle)->next, (fsp), (mode), (offset), (len))
     261
    248262#define SMB_VFS_LOCK(fsp, op, offset, count, type) \
    249263        smb_vfs_call_lock((fsp)->conn->vfs_handles, (fsp), (op), (offset), (count), (type))
     
    286300        smb_vfs_call_mknod((handle)->next, (path), (mode), (dev))
    287301
    288 #define SMB_VFS_REALPATH(conn, path, resolved_path) \
    289         smb_vfs_call_realpath((conn)->vfs_handles, (path), (resolved_path))
    290 #define SMB_VFS_NEXT_REALPATH(handle, path, resolved_path) \
    291         smb_vfs_call_realpath((handle)->next, (path), (resolved_path))
     302#define SMB_VFS_REALPATH(conn, path) \
     303        smb_vfs_call_realpath((conn)->vfs_handles, (path))
     304#define SMB_VFS_NEXT_REALPATH(handle, path) \
     305        smb_vfs_call_realpath((handle)->next, (path))
    292306
    293307#define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) \
     
    589603        smb_vfs_call_aio_force((handle)->next,(fsp))
    590604
    591 #define SMB_VFS_IS_OFFLINE(conn,path,sbuf) \
    592         smb_vfs_call_is_offline((conn)->vfs_handles,(path),(sbuf))
    593 #define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) \
    594         smb_vfs_call_is_offline((handle)->next,(path),(sbuf))
    595 
    596 #define SMB_VFS_SET_OFFLINE(conn,path) \
    597         smb_vfs_call_set_offline((conn)->vfs_handles,(path))
    598 #define SMB_VFS_NEXT_SET_OFFLINE(handle,path) \
    599         smb_vfs_call_set_offline((handle)->next, (path))
     605#define SMB_VFS_IS_OFFLINE(conn,fname,sbuf) \
     606        smb_vfs_call_is_offline((conn)->vfs_handles,(fname),(sbuf))
     607#define SMB_VFS_NEXT_IS_OFFLINE(handle,fname,sbuf) \
     608        smb_vfs_call_is_offline((handle)->next,(fname),(sbuf))
     609
     610#define SMB_VFS_SET_OFFLINE(conn,fname) \
     611        smb_vfs_call_set_offline((conn)->vfs_handles,(fname))
     612#define SMB_VFS_NEXT_SET_OFFLINE(handle,fname) \
     613        smb_vfs_call_set_offline((handle)->next, (fname))
    600614
    601615#endif /* _VFS_MACROS_H */
Note: See TracChangeset for help on using the changeset viewer.