diff options
Diffstat (limited to 'source3/include')
100 files changed, 38160 insertions, 0 deletions
diff --git a/source3/include/MacExtensions.h b/source3/include/MacExtensions.h new file mode 100644 index 0000000000..6e911feea2 --- /dev/null +++ b/source3/include/MacExtensions.h @@ -0,0 +1,245 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) John H Terpstra 1996-1998 + Copyright (C) Luke Kenneth Casson Leighton 1996-1998 + Copyright (C) Paul Ashton 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _MAC_EXTENSIONS_H +#define _MAC_EXTENSIONS_H + +/* Folder that holds the stream info */ +#define STREAM_FOLDER ".streams" +#define STREAM_FOLDER_SLASH ".streams/" + +/* Common Streams Names*/ +#define DefaultStreamTestLen 6 +#define DefaultStreamTest ":$DATA" +#define AFPDATA_STREAM "::$DATA" +#define AFPINFO_STREAM ":AFP_AfpInfo:$DATA" +#define AFPRESOURCE_STREAM ":AFP_Resource:$DATA" +#define AFPCOMMENTS_STREAM ":Comments:$DATA" +#define AFPDESKTOP_STREAM ":AFP_DeskTop:$DATA" +#define AFPIDINDEX_STREAM ":AFP_IdIndex:$DATA" + +/* +** NT's AFP_AfpInfo stream structure +*/ +#define APF_INFO_SIZE 0x3c +#define AFP_Signature 0x41465000 +#define AFP_Version 0x00000100 +#define AFP_BackupTime 0x00000080 +#define AFP_FinderSize 32 +/* +** Orginal AFP_AfpInfo stream used by NT +** We needed a way to store the create date so SAMBA +** AFP_AfpInfo adds for bytes to this structrure +** and call's it _SambaAfpInfo +*/ +typedef struct _AfpInfo +{ + uint32 afpi_Signature; /* Must be *(PDWORD)"AFP" */ + uint32 afpi_Version; /* Must be 0x00010000 */ + uint32 afpi_Reserved1; + uint32 afpi_BackupTime; /* Backup time for the file/dir */ + unsigned char afpi_FinderInfo[AFP_FinderSize]; /* Finder Info (32 bytes) */ + unsigned char afpi_ProDosInfo[6]; /* ProDos Info (6 bytes) # */ + unsigned char afpi_Reserved2[6]; +} AfpInfo; + +typedef struct _SambaAfpInfo +{ + AfpInfo afp; + unsigned long createtime; +} SambaAfpInfo; + +/* +** On SAMBA this structrue is followed by 4 bytes that store the create +** date of the file or folder asociated with it. +*/ + +/* +** These extentions are only supported with the NT LM 0.12 Dialect. These extentions +** will be process on a share by share bases. +*/ + +/* +** Trans2_Query_FS_Information Call is used by the MacCIFS extentions for three reasons. +** First to see if the remote server share supports the basic Macintosh CIFS extentions. +** Second to return some basic need information about the share to the Macintosh. +** Third to see if this share support any other Macintosh extentions. +** +** We will be using infromation levels that are betwwen 0x300 and 0x399 for all Macintosh +** extentions calls. The first of these will be the SMB_MAC_QUERY_FS_INFO level which +** will allow the server to return the MacQueryFSInfo structure. All fields are Little +** Endian unless other wise specified. +*/ +#define SMB_MAC_QUERY_FS_INFO 0x301 + + + +/* +** The server will return folder access control in the Trans2_Find_First2 +** and Trans2_Find_Next2 message described later in this document. +*/ +#define SUPPORT_MAC_ACCESS_CNTRL 0x0010 +/* +** The server supports setting/getting comments using the mechanism in this +** document instead of using the NTFS format described in the Introduction. +*/ +#define SUPPORT_MAC_GETSETCOMMENTS 0x0020 +/* +** The Server supports setting and getting Macintosh desktop database information +** using the mechanism in this document. +*/ +#define SUPPORT_MAC_DESKTOPDB_CALLS 0x0040 +/* +** The server will return a unique id for files and directories in the +** Trans2_Find_First2 and Trans2_Find_Next2 message described later in this document. +*/ +#define SUPPORT_MAC_UNIQUE_IDS 0x0080 +/* +** The server will return this flag telling the client that the server does +** not support streams or the Macintosh extensions. The rest of this message +** will be ignored by the client. +*/ +#define NO_STREAMS_OR_MAC_SUPPORT 0x0100 + +/* +** We will be adding a new info level to the Trans2_Find_First2 and Trans2_Find_Next2. +** This info level will be SMB_MAC_FIND_BOTH_HFS_INFO and will support the server +** return additional information need by the Macintosh. All fields are Little +** Endian unless other wise specified. +*/ + +#define SMB_MAC_FIND_BOTH_HFS_INFO 0x302 + +enum { + ownerRead = 0x0400, + ownerWrite = 0x0200, + ownerSearch = 0x0100, + groupRead = 0x0040, + groupWrite = 0x0020, + groupSearch = 0x0010, + otherRead = 0x0004, + otherWrite = 0x0002, + otherSearch = 0x0001, + Owner = 0x0800 +}; + + +/* +** We will be adding a new info level to the Trans2_Set_Path_Information. +** This info level will be SMB_MAC_SET_FINDER_INFO and will support the client +** setting information on the server need by the Macintosh. All fields are Little +** Endian unless other wise specified. +*/ + +#define SMB_MAC_SET_FINDER_INFO 0x303 + +enum { + SetCreateDate = 0x01, /* If this is set then set the create date of the file/folder */ + SetModDate = 0x02, /* If this is set then set the modify date of the file/folder */ + SetFLAttrib = 0x04, /* If this is set then set the Macintosh lock bit of the file/folder */ + FndrInfo1 = 0x08, /* If this is set then set the first 16 bytes of finder info */ + FndrInfo2 = 0x10, /* If this is set then set the second 16 bytes of finder info */ + SetHidden = 0x20 /* We are either setting or unsetting the hidden bit */ +}; + + +/* +** We will be adding some new info level to the Trans2_Set_Path_Information and Trans2_Query_Path_Information. +** These info levels will allow the client to add, get, and remove desktop inforamtion from the +** server. How the server stores this information is up to them. +*/ + +/* +** We need to be able to store an application name and its creator in a database. We send a +** Trans2_Set_Path_Information call with the full path of the application in the path field. +** We will send an info level that represents adding an application name and creator to the database. +** We will pass the File Creator in the data message. +** +** The server should just respond with no error or an error. +*/ +#define SMB_MAC_DT_ADD_APPL 0x304 + +/* +** We need to be able to remove an application name and its creator from a database. We send a +** Trans2_Set_Path_Information call with the full path of the application in the path field. +** We will send an info level that represents removing an application name and creator from the database. +** We will pass the File Creator in the data message. +** +** The server should just respond with no error or an error. +*/ +#define SMB_MAC_DT_REMOVE_APPL 0x305 + + +/* +** We need to be able to get an application name and its creator from a database. We send a +** Trans2_Query_Path_Information call in which the name field is just ignore. +** We will send an info level that represents getting an application name with a structure that +** contains the File Creator and index. Were index has the following meaning. +** Index = 0; Get the application path from the database with the most current date. +** Index > 0; Use the index to find the application path from the database. +** e.g. index of 5 means get the fifth entry of this application name in the database. +** if not entry return an error. +** +** The server returns with a structure that contains the full path to the appication and +** its creator's date. +*/ +#define SMB_MAC_DT_GET_APPL 0x306 + + +/* +** We need to be able to get an icon from a database. We send a Trans2_Query_Path_Information call in +** which the path name is ignore. We will send an info level that represents getting an icon with a structure +** that contains the Requested size of the icon, the Icon type, File Creator, and File Type. +** +** The server returns with a structure that contains the actual size of the icon +** (must be less than requested length) and the icon bit map. +*/ +#define SMB_MAC_DT_GET_ICON 0x307 + + +/* +** We need to be able to get an icon from a database. We send a Trans2_Query_Path_Information call in +** which the path name is ignore. We will send an info level that represents getting an icon with a structure +** that contains the index and File Creator. The index allows the client to make repeated calls to the server +** gathering all icon stored by this file creator. +** +** +** The server returns with a structure that contains the actual size of the icon +** (must be less than requested length) and the icon bit map, File Type, and Icon Type. +*/ +#define SMB_MAC_DT_GET_ICON_INFO 0x308 + + + +/* +** We need to be able to add an icon to a database. We send a Trans2_Set_Path_Information call in +** which the path name is ignore. We will send an info level that represents setting an icon with a structure +** that contains the icon data, icon size, icon type, the file type, and file creator. +** +** +** The server returns only that the call was successful or not. +*/ +#define SMB_MAC_DT_ADD_ICON 0x309 + +#endif /* _MAC_EXTENSIONS_H */ + +/* _MAC_EXTENSIONS_H */ + diff --git a/source3/include/ads.h b/source3/include/ads.h new file mode 100644 index 0000000000..97faf0b6eb --- /dev/null +++ b/source3/include/ads.h @@ -0,0 +1,425 @@ +#ifndef _INCLUDE_ADS_H_ +#define _INCLUDE_ADS_H_ +/* + header for ads (active directory) library routines + + basically this is a wrapper around ldap +*/ + +enum wb_posix_mapping { + WB_POSIX_MAP_UNKNOWN = -1, + WB_POSIX_MAP_TEMPLATE = 0, + WB_POSIX_MAP_SFU = 1, + WB_POSIX_MAP_SFU20 = 2, + WB_POSIX_MAP_RFC2307 = 3, + WB_POSIX_MAP_UNIXINFO = 4 +}; + +/* there are 5 possible types of errors the ads subsystem can produce */ +enum ads_error_type {ENUM_ADS_ERROR_KRB5, ENUM_ADS_ERROR_GSS, + ENUM_ADS_ERROR_LDAP, ENUM_ADS_ERROR_SYSTEM, ENUM_ADS_ERROR_NT}; + +typedef struct { + enum ads_error_type error_type; + union err_state{ + int rc; + NTSTATUS nt_status; + } err; + /* For error_type = ENUM_ADS_ERROR_GSS minor_status describe GSS API error */ + /* Where rc represents major_status of GSS API error */ + int minor_status; +} ADS_STATUS; + +struct ads_struct; + +struct ads_saslwrap_ops { + const char *name; + ADS_STATUS (*wrap)(struct ads_struct *, uint8 *buf, uint32 len); + ADS_STATUS (*unwrap)(struct ads_struct *); + void (*disconnect)(struct ads_struct *); +}; + +enum ads_saslwrap_type { + ADS_SASLWRAP_TYPE_PLAIN = 1, + ADS_SASLWRAP_TYPE_SIGN = 2, + ADS_SASLWRAP_TYPE_SEAL = 4 +}; + +typedef struct ads_struct { + int is_mine; /* do I own this structure's memory? */ + + /* info needed to find the server */ + struct { + char *realm; + char *workgroup; + char *ldap_server; + int foreign; /* set to 1 if connecting to a foreign + * realm */ + bool gc; /* Is this a global catalog server? */ + } server; + + /* info needed to authenticate */ + struct { + char *realm; + char *password; + char *user_name; + char *kdc_server; + unsigned flags; + int time_offset; + time_t tgt_expire; + time_t tgs_expire; + time_t renewable; + } auth; + + /* info derived from the servers config */ + struct { + uint32 flags; /* cldap flags identifying the services. */ + char *realm; + char *bind_path; + char *ldap_server_name; + char *server_site_name; + char *client_site_name; + time_t current_time; + int tried_closest_dc; + char *schema_path; + char *config_path; + } config; + + /* info about the current LDAP connection */ +#ifdef HAVE_LDAP + struct { + LDAP *ld; + struct sockaddr_storage ss; /* the ip of the active connection, if any */ + time_t last_attempt; /* last attempt to reconnect */ + int port; + + enum ads_saslwrap_type wrap_type; + +#ifdef HAVE_LDAP_SASL_WRAPPING + Sockbuf_IO_Desc *sbiod; /* lowlevel state for LDAP wrapping */ +#endif /* HAVE_LDAP_SASL_WRAPPING */ + TALLOC_CTX *mem_ctx; + const struct ads_saslwrap_ops *wrap_ops; + void *wrap_private_data; + struct { + uint32 ofs; + uint32 needed; + uint32 left; +#define ADS_SASL_WRAPPING_IN_MAX_WRAPPED 0x0FFFFFFF + uint32 max_wrapped; + uint32 min_wrapped; + uint32 size; + uint8 *buf; + } in; + struct { + uint32 ofs; + uint32 left; +#define ADS_SASL_WRAPPING_OUT_MAX_WRAPPED 0x00A00000 + uint32 max_unwrapped; + uint32 sig_size; + uint32 size; + uint8 *buf; + } out; + } ldap; +#endif /* HAVE_LDAP */ +} ADS_STRUCT; + +/* used to remember the names of the posix attributes in AD */ +/* see the rfc2307 & sfu nss backends */ + +struct posix_schema { + char *posix_homedir_attr; + char *posix_shell_attr; + char *posix_uidnumber_attr; + char *posix_gidnumber_attr; + char *posix_gecos_attr; +}; + + + +#ifdef HAVE_ADS +typedef LDAPMod **ADS_MODLIST; +#else +typedef void **ADS_MODLIST; +#endif + +/* macros to simplify error returning */ +#define ADS_ERROR(rc) ADS_ERROR_LDAP(rc) +#define ADS_ERROR_LDAP(rc) ads_build_error(ENUM_ADS_ERROR_LDAP, rc, 0) +#define ADS_ERROR_SYSTEM(rc) ads_build_error(ENUM_ADS_ERROR_SYSTEM, rc?rc:EINVAL, 0) +#define ADS_ERROR_KRB5(rc) ads_build_error(ENUM_ADS_ERROR_KRB5, rc, 0) +#define ADS_ERROR_GSS(rc, minor) ads_build_error(ENUM_ADS_ERROR_GSS, rc, minor) +#define ADS_ERROR_NT(rc) ads_build_nt_error(ENUM_ADS_ERROR_NT,rc) + +#define ADS_ERR_OK(status) ((status.error_type == ENUM_ADS_ERROR_NT) ? NT_STATUS_IS_OK(status.err.nt_status):(status.err.rc == 0)) +#define ADS_SUCCESS ADS_ERROR(0) + +#define ADS_ERROR_HAVE_NO_MEMORY(x) do { \ + if (!(x)) {\ + return ADS_ERROR(LDAP_NO_MEMORY);\ + }\ +} while (0) + + +/* time between reconnect attempts */ +#define ADS_RECONNECT_TIME 5 + +/* ldap control oids */ +#define ADS_PAGE_CTL_OID "1.2.840.113556.1.4.319" +#define ADS_NO_REFERRALS_OID "1.2.840.113556.1.4.1339" +#define ADS_SERVER_SORT_OID "1.2.840.113556.1.4.473" +#define ADS_PERMIT_MODIFY_OID "1.2.840.113556.1.4.1413" +#define ADS_ASQ_OID "1.2.840.113556.1.4.1504" +#define ADS_EXTENDED_DN_OID "1.2.840.113556.1.4.529" +#define ADS_SD_FLAGS_OID "1.2.840.113556.1.4.801" + +/* ldap attribute oids (Services for Unix 3.0, 3.5) */ +#define ADS_ATTR_SFU_UIDNUMBER_OID "1.2.840.113556.1.6.18.1.310" +#define ADS_ATTR_SFU_GIDNUMBER_OID "1.2.840.113556.1.6.18.1.311" +#define ADS_ATTR_SFU_HOMEDIR_OID "1.2.840.113556.1.6.18.1.344" +#define ADS_ATTR_SFU_SHELL_OID "1.2.840.113556.1.6.18.1.312" +#define ADS_ATTR_SFU_GECOS_OID "1.2.840.113556.1.6.18.1.337" + +/* ldap attribute oids (Services for Unix 2.0) */ +#define ADS_ATTR_SFU20_UIDNUMBER_OID "1.2.840.113556.1.4.7000.187.70" +#define ADS_ATTR_SFU20_GIDNUMBER_OID "1.2.840.113556.1.4.7000.187.71" +#define ADS_ATTR_SFU20_HOMEDIR_OID "1.2.840.113556.1.4.7000.187.106" +#define ADS_ATTR_SFU20_SHELL_OID "1.2.840.113556.1.4.7000.187.72" +#define ADS_ATTR_SFU20_GECOS_OID "1.2.840.113556.1.4.7000.187.97" + +/* ldap attribute oids (RFC2307) */ +#define ADS_ATTR_RFC2307_UIDNUMBER_OID "1.3.6.1.1.1.1.0" +#define ADS_ATTR_RFC2307_GIDNUMBER_OID "1.3.6.1.1.1.1.1" +#define ADS_ATTR_RFC2307_HOMEDIR_OID "1.3.6.1.1.1.1.3" +#define ADS_ATTR_RFC2307_SHELL_OID "1.3.6.1.1.1.1.4" +#define ADS_ATTR_RFC2307_GECOS_OID "1.3.6.1.1.1.1.2" + +/* ldap bitwise searches */ +#define ADS_LDAP_MATCHING_RULE_BIT_AND "1.2.840.113556.1.4.803" +#define ADS_LDAP_MATCHING_RULE_BIT_OR "1.2.840.113556.1.4.804" + +/* UserFlags for userAccountControl */ +#define UF_SCRIPT 0x00000001 +#define UF_ACCOUNTDISABLE 0x00000002 +#define UF_UNUSED_1 0x00000004 +#define UF_HOMEDIR_REQUIRED 0x00000008 + +#define UF_LOCKOUT 0x00000010 +#define UF_PASSWD_NOTREQD 0x00000020 +#define UF_PASSWD_CANT_CHANGE 0x00000040 +#define UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED 0x00000080 + +#define UF_TEMP_DUPLICATE_ACCOUNT 0x00000100 +#define UF_NORMAL_ACCOUNT 0x00000200 +#define UF_UNUSED_2 0x00000400 +#define UF_INTERDOMAIN_TRUST_ACCOUNT 0x00000800 + +#define UF_WORKSTATION_TRUST_ACCOUNT 0x00001000 +#define UF_SERVER_TRUST_ACCOUNT 0x00002000 +#define UF_UNUSED_3 0x00004000 +#define UF_UNUSED_4 0x00008000 + +#define UF_DONT_EXPIRE_PASSWD 0x00010000 +#define UF_MNS_LOGON_ACCOUNT 0x00020000 +#define UF_SMARTCARD_REQUIRED 0x00040000 +#define UF_TRUSTED_FOR_DELEGATION 0x00080000 + +#define UF_NOT_DELEGATED 0x00100000 +#define UF_USE_DES_KEY_ONLY 0x00200000 +#define UF_DONT_REQUIRE_PREAUTH 0x00400000 +#define UF_PASSWORD_EXPIRED 0x00800000 + +#define UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION 0x01000000 +#define UF_NO_AUTH_DATA_REQUIRED 0x02000000 +#define UF_UNUSED_8 0x04000000 +#define UF_UNUSED_9 0x08000000 + +#define UF_UNUSED_10 0x10000000 +#define UF_UNUSED_11 0x20000000 +#define UF_UNUSED_12 0x40000000 +#define UF_UNUSED_13 0x80000000 + +#define UF_MACHINE_ACCOUNT_MASK (\ + UF_INTERDOMAIN_TRUST_ACCOUNT |\ + UF_WORKSTATION_TRUST_ACCOUNT |\ + UF_SERVER_TRUST_ACCOUNT \ + ) + +#define UF_ACCOUNT_TYPE_MASK (\ + UF_TEMP_DUPLICATE_ACCOUNT |\ + UF_NORMAL_ACCOUNT |\ + UF_INTERDOMAIN_TRUST_ACCOUNT |\ + UF_WORKSTATION_TRUST_ACCOUNT |\ + UF_SERVER_TRUST_ACCOUNT \ + ) + +#define UF_SETTABLE_BITS (\ + UF_SCRIPT |\ + UF_ACCOUNTDISABLE |\ + UF_HOMEDIR_REQUIRED |\ + UF_LOCKOUT |\ + UF_PASSWD_NOTREQD |\ + UF_PASSWD_CANT_CHANGE |\ + UF_ACCOUNT_TYPE_MASK | \ + UF_DONT_EXPIRE_PASSWD | \ + UF_MNS_LOGON_ACCOUNT |\ + UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED |\ + UF_SMARTCARD_REQUIRED |\ + UF_TRUSTED_FOR_DELEGATION |\ + UF_NOT_DELEGATED |\ + UF_USE_DES_KEY_ONLY |\ + UF_DONT_REQUIRE_PREAUTH \ + ) + +/* sAMAccountType */ +#define ATYPE_NORMAL_ACCOUNT 0x30000000 /* 805306368 */ +#define ATYPE_WORKSTATION_TRUST 0x30000001 /* 805306369 */ +#define ATYPE_INTERDOMAIN_TRUST 0x30000002 /* 805306370 */ +#define ATYPE_SECURITY_GLOBAL_GROUP 0x10000000 /* 268435456 */ +#define ATYPE_DISTRIBUTION_GLOBAL_GROUP 0x10000001 /* 268435457 */ +#define ATYPE_DISTRIBUTION_UNIVERSAL_GROUP ATYPE_DISTRIBUTION_GLOBAL_GROUP +#define ATYPE_SECURITY_LOCAL_GROUP 0x20000000 /* 536870912 */ +#define ATYPE_DISTRIBUTION_LOCAL_GROUP 0x20000001 /* 536870913 */ + +#define ATYPE_ACCOUNT ATYPE_NORMAL_ACCOUNT /* 0x30000000 805306368 */ +#define ATYPE_GLOBAL_GROUP ATYPE_SECURITY_GLOBAL_GROUP /* 0x10000000 268435456 */ +#define ATYPE_LOCAL_GROUP ATYPE_SECURITY_LOCAL_GROUP /* 0x20000000 536870912 */ + +/* groupType */ +#define GROUP_TYPE_BUILTIN_LOCAL_GROUP 0x00000001 +#define GROUP_TYPE_ACCOUNT_GROUP 0x00000002 +#define GROUP_TYPE_RESOURCE_GROUP 0x00000004 +#define GROUP_TYPE_UNIVERSAL_GROUP 0x00000008 +#define GROUP_TYPE_APP_BASIC_GROUP 0x00000010 +#define GROUP_TYPE_APP_QUERY_GROUP 0x00000020 +#define GROUP_TYPE_SECURITY_ENABLED 0x80000000 + +#define GTYPE_SECURITY_BUILTIN_LOCAL_GROUP ( /* 0x80000005 -2147483643 */ \ + GROUP_TYPE_BUILTIN_LOCAL_GROUP| \ + GROUP_TYPE_RESOURCE_GROUP| \ + GROUP_TYPE_SECURITY_ENABLED \ + ) +#define GTYPE_SECURITY_DOMAIN_LOCAL_GROUP ( /* 0x80000004 -2147483644 */ \ + GROUP_TYPE_RESOURCE_GROUP| \ + GROUP_TYPE_SECURITY_ENABLED \ + ) +#define GTYPE_SECURITY_GLOBAL_GROUP ( /* 0x80000002 -2147483646 */ \ + GROUP_TYPE_ACCOUNT_GROUP| \ + GROUP_TYPE_SECURITY_ENABLED \ + ) +#define GTYPE_SECURITY_UNIVERSAL_GROUP ( /* 0x80000008 -2147483656 */ \ + GROUP_TYPE_UNIVERSAL_GROUP| \ + GROUP_TYPE_SECURITY_ENABLED \ + ) + +#define GTYPE_DISTRIBUTION_GLOBAL_GROUP 0x00000002 /* 2 */ +#define GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP 0x00000004 /* 4 */ +#define GTYPE_DISTRIBUTION_UNIVERSAL_GROUP 0x00000008 /* 8 */ + +#define ADS_PINGS 0x0000FFFF /* Ping response */ +#define ADS_DNS_CONTROLLER 0x20000000 /* DomainControllerName is a DNS name*/ +#define ADS_DNS_DOMAIN 0x40000000 /* DomainName is a DNS name */ +#define ADS_DNS_FOREST 0x80000000 /* DnsForestName is a DNS name */ + +/* ads auth control flags */ +#define ADS_AUTH_DISABLE_KERBEROS 0x0001 +#define ADS_AUTH_NO_BIND 0x0002 +#define ADS_AUTH_ANON_BIND 0x0004 +#define ADS_AUTH_SIMPLE_BIND 0x0008 +#define ADS_AUTH_ALLOW_NTLMSSP 0x0010 +#define ADS_AUTH_SASL_SIGN 0x0020 +#define ADS_AUTH_SASL_SEAL 0x0040 +#define ADS_AUTH_SASL_FORCE 0x0080 +#define ADS_AUTH_USER_CREDS 0x0100 + +/* Kerberos environment variable names */ +#define KRB5_ENV_CCNAME "KRB5CCNAME" + +/* Heimdal uses a slightly different name */ +#if defined(HAVE_ENCTYPE_ARCFOUR_HMAC_MD5) +#define ENCTYPE_ARCFOUR_HMAC ENCTYPE_ARCFOUR_HMAC_MD5 +#endif + +/* The older versions of heimdal that don't have this + define don't seem to use it anyway. I'm told they + always use a subkey */ +#ifndef HAVE_AP_OPTS_USE_SUBKEY +#define AP_OPTS_USE_SUBKEY 0 +#endif + +#define WELL_KNOWN_GUID_COMPUTERS "AA312825768811D1ADED00C04FD8D5CD" +#define WELL_KNOWN_GUID_USERS "A9D1CA15768811D1ADED00C04FD8D5CD" + +#ifndef KRB5_ADDR_NETBIOS +#define KRB5_ADDR_NETBIOS 0x14 +#endif + +#ifndef KRB5KRB_ERR_RESPONSE_TOO_BIG +#define KRB5KRB_ERR_RESPONSE_TOO_BIG (-1765328332L) +#endif + +#ifdef HAVE_KRB5 +typedef struct { + NTSTATUS ntstatus; + uint32 unknown1; + uint32 unknown2; /* 0x00000001 */ +} KRB5_EDATA_NTSTATUS; + +typedef struct { +#if defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) /* MIT */ + krb5_address **addrs; +#elif defined(HAVE_KRB5_ADDRESSES) /* Heimdal */ + krb5_addresses *addrs; +#else +#error UNKNOWN_KRB5_ADDRESS_TYPE +#endif /* defined(HAVE_MAGIC_IN_KRB5_ADDRESS) && defined(HAVE_ADDRTYPE_IN_KRB5_ADDRESS) */ +} smb_krb5_addresses; + +#ifdef HAVE_KRB5_KEYBLOCK_KEYVALUE /* Heimdal */ +#define KRB5_KEY_TYPE(k) ((k)->keytype) +#define KRB5_KEY_LENGTH(k) ((k)->keyvalue.length) +#define KRB5_KEY_DATA(k) ((k)->keyvalue.data) +#define KRB5_KEY_DATA_CAST void +#else /* MIT */ +#define KRB5_KEY_TYPE(k) ((k)->enctype) +#define KRB5_KEY_LENGTH(k) ((k)->length) +#define KRB5_KEY_DATA(k) ((k)->contents) +#define KRB5_KEY_DATA_CAST krb5_octet +#endif /* HAVE_KRB5_KEYBLOCK_KEYVALUE */ + +#ifdef HAVE_KRB5_KEYTAB_ENTRY_KEY /* MIT */ +#define KRB5_KT_KEY(k) (&(k)->key) +#elif HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK /* Heimdal */ +#define KRB5_KT_KEY(k) (&(k)->keyblock) +#else +#error krb5_keytab_entry has no key or keyblock member +#endif /* HAVE_KRB5_KEYTAB_ENTRY_KEY */ + +#endif /* HAVE_KRB5 */ + +enum ads_extended_dn_flags { + ADS_EXTENDED_DN_HEX_STRING = 0, + ADS_EXTENDED_DN_STRING = 1 /* not supported on win2k */ +}; + +/* this is probably not very well suited to pass other controls generically but + * is good enough for the extended dn control where it is only used for atm */ + +typedef struct { + const char *control; + int val; + int critical; +} ads_control; + +#define ADS_EXTENDED_RIGHT_APPLY_GROUP_POLICY "edacfd8f-ffb3-11d1-b41d-00a0c968f939" + +#define ADS_IGNORE_PRINCIPAL "not_defined_in_RFC4178@please_ignore" + +/* Settings for the domainFunctionality attribute in the rootDSE */ + +#define DS_DOMAIN_FUNCTION_2000 0 +#define DS_DOMAIN_FUCNTION_2003_MIXED 1 +#define DS_DOMAIN_FUNCTION_2003 2 +#define DS_DOMAIN_FUNCTION_2008 3 + +#endif /* _INCLUDE_ADS_H_ */ diff --git a/source3/include/ads_dns.h b/source3/include/ads_dns.h new file mode 100644 index 0000000000..24805f85a3 --- /dev/null +++ b/source3/include/ads_dns.h @@ -0,0 +1,61 @@ +/* + * Unix SMB/CIFS implementation. + * Internal DNS query structures + * Copyright (C) Gerald Carter 2006. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _ADS_DNS_H +#define _ADS_DNS_H + +/* DNS query section in replies */ + +struct dns_query { + const char *hostname; + uint16 type; + uint16 in_class; +}; + +/* DNS RR record in reply */ + +struct dns_rr { + const char *hostname; + uint16 type; + uint16 in_class; + uint32 ttl; + uint16 rdatalen; + uint8 *rdata; +}; + +/* SRV records */ + +struct dns_rr_srv { + const char *hostname; + uint16 priority; + uint16 weight; + uint16 port; + size_t num_ips; + struct sockaddr_storage *ss_s; /* support multi-homed hosts */ +}; + +/* NS records */ + +struct dns_rr_ns { + const char *hostname; + struct sockaddr_storage ss; +}; + + +#endif /* _ADS_DNS_H */ diff --git a/source3/include/ads_protos.h b/source3/include/ads_protos.h new file mode 100644 index 0000000000..a372010b79 --- /dev/null +++ b/source3/include/ads_protos.h @@ -0,0 +1,122 @@ +/* + * Prototypes for ads + */ + +void ads_msgfree(ADS_STRUCT *ads, LDAPMessage *msg); +char *ads_get_dn(ADS_STRUCT *ads, LDAPMessage *msg); +char *ads_get_dn_canonical(ADS_STRUCT *ads, LDAPMessage *msg); + +char *ads_pull_string(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, LDAPMessage *msg, + const char *field); +char **ads_pull_strings(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, + LDAPMessage *msg, const char *field, + size_t *num_values); +char **ads_pull_strings_range(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + LDAPMessage *msg, const char *field, + char **current_strings, + const char **next_attribute, + size_t *num_strings, + bool *more_strings); +bool ads_pull_uint32(ADS_STRUCT *ads, LDAPMessage *msg, const char *field, + uint32 *v); +bool ads_pull_guid(ADS_STRUCT *ads, LDAPMessage *msg, struct GUID *guid); +bool ads_pull_sid(ADS_STRUCT *ads, LDAPMessage *msg, const char *field, + DOM_SID *sid); +int ads_pull_sids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, + LDAPMessage *msg, const char *field, DOM_SID **sids); +bool ads_pull_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, + LDAPMessage *msg, const char *field, SEC_DESC **sd); +char *ads_pull_username(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, + LDAPMessage *msg); +int ads_pull_sids_from_extendeddn(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + LDAPMessage *msg, + const char *field, + enum ads_extended_dn_flags flags, + DOM_SID **sids); + +ADS_STATUS ads_find_machine_acct(ADS_STRUCT *ads, LDAPMessage **res, + const char *machine); +ADS_STATUS ads_find_printer_on_server(ADS_STRUCT *ads, LDAPMessage **res, + const char *printer, + const char *servername); +ADS_STATUS ads_find_printers(ADS_STRUCT *ads, LDAPMessage **res); +ADS_STATUS ads_find_user_acct(ADS_STRUCT *ads, LDAPMessage **res, + const char *user); + +ADS_STATUS ads_do_search(ADS_STRUCT *ads, const char *bind_path, int scope, + const char *expr, + const char **attrs, LDAPMessage **res); +ADS_STATUS ads_search(ADS_STRUCT *ads, LDAPMessage **res, + const char *expr, const char **attrs); +ADS_STATUS ads_search_dn(ADS_STRUCT *ads, LDAPMessage **res, + const char *dn, const char **attrs); +ADS_STATUS ads_do_search_all_args(ADS_STRUCT *ads, const char *bind_path, + int scope, const char *expr, + const char **attrs, void *args, + LDAPMessage **res); +ADS_STATUS ads_do_search_all(ADS_STRUCT *ads, const char *bind_path, + int scope, const char *expr, + const char **attrs, LDAPMessage **res); +ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path, + int scope, + const char *expr, + const char **attrs, LDAPMessage **res); +ADS_STATUS ads_do_search_retry_args(ADS_STRUCT *ads, const char *bind_path, + int scope, const char *expr, + const char **attrs, void *args, + LDAPMessage **res); +ADS_STATUS ads_search_retry(ADS_STRUCT *ads, LDAPMessage **res, + const char *expr, const char **attrs); +ADS_STATUS ads_search_retry_dn(ADS_STRUCT *ads, LDAPMessage **res, + const char *dn, + const char **attrs); +ADS_STATUS ads_search_retry_extended_dn(ADS_STRUCT *ads, LDAPMessage **res, + const char *dn, + const char **attrs, + enum ads_extended_dn_flags flags); +ADS_STATUS ads_search_retry_extended_dn_ranged(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, + const char *dn, + const char **attrs, + enum ads_extended_dn_flags flags, + char ***strings, + size_t *num_strings); +ADS_STATUS ads_search_retry_sid(ADS_STRUCT *ads, LDAPMessage **res, + const DOM_SID *sid, + const char **attrs); + + +LDAPMessage *ads_first_entry(ADS_STRUCT *ads, LDAPMessage *res); +LDAPMessage *ads_next_entry(ADS_STRUCT *ads, LDAPMessage *res); +LDAPMessage *ads_first_message(ADS_STRUCT *ads, LDAPMessage *res); +LDAPMessage *ads_next_message(ADS_STRUCT *ads, LDAPMessage *res); +void ads_process_results(ADS_STRUCT *ads, LDAPMessage *res, + bool (*fn)(ADS_STRUCT *,char *, void **, void *), + void *data_area); +void ads_dump(ADS_STRUCT *ads, LDAPMessage *res); + +ADS_STATUS ads_parse_gpo(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + LDAPMessage *res, + const char *gpo_dn, + struct GROUP_POLICY_OBJECT *gpo); +ADS_STATUS ads_search_retry_dn_sd_flags(ADS_STRUCT *ads, LDAPMessage **res, + uint32 sd_flags, + const char *dn, + const char **attrs); +ADS_STATUS ads_do_search_all_sd_flags(ADS_STRUCT *ads, const char *bind_path, + int scope, const char *expr, + const char **attrs, uint32 sd_flags, + LDAPMessage **res); +ADS_STATUS ads_get_tokensids(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *dn, + DOM_SID *user_sid, + DOM_SID *primary_group_sid, + DOM_SID **sids, + size_t *num_sids); +ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + char ***ous, + size_t *num_ous); diff --git a/source3/include/adt_tree.h b/source3/include/adt_tree.h new file mode 100644 index 0000000000..3acda8edb8 --- /dev/null +++ b/source3/include/adt_tree.h @@ -0,0 +1,61 @@ +/* + * Unix SMB/CIFS implementation. + * Generic Abstract Data Types + * Copyright (C) Gerald Carter 2002-2005. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ADT_TREE_H +#define ADT_TREE_H + +/* data structure used to build the tree */ + +typedef struct _tree_node { + struct _tree_node *parent; + struct _tree_node **children; + int num_children; + char *key; + void *data_p; +} TREE_NODE; + +typedef struct _tree_root { + TREE_NODE *root; + + /* not used currently (is it needed?) */ + int (*compare)(void* x, void *y); +} SORTED_TREE; + +/* + * API + */ + +/* create a new tree, talloc_free() to throw it away */ + +SORTED_TREE* pathtree_init( void *data_p, int (cmp_fn)(void*, void*) ); + +/* add a new path component */ + +WERROR pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ); + +/* search path */ + +void* pathtree_find( SORTED_TREE *tree, char *key ); + +/* debug (print) functions */ + +void pathtree_print_keys( SORTED_TREE *tree, int debug ); + + +#endif diff --git a/source3/include/asn_1.h b/source3/include/asn_1.h new file mode 100644 index 0000000000..dd345cd601 --- /dev/null +++ b/source3/include/asn_1.h @@ -0,0 +1,71 @@ +/* + Unix SMB/CIFS implementation. + simple ASN1 code + Copyright (C) Andrew Tridgell 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _ASN_1_H +#define _ASN_1_H + +struct nesting { + off_t start; + size_t taglen; /* for parsing */ + struct nesting *next; +}; + +typedef struct asn1_data { + uint8 *data; + size_t length; + off_t ofs; + struct nesting *nesting; + bool has_error; +} ASN1_DATA; + + +#define ASN1_APPLICATION(x) ((x)+0x60) +#define ASN1_APPLICATION_SIMPLE(x) ((x)+0x40) +#define ASN1_SEQUENCE(x) ((x)+0x30) +#define ASN1_CONTEXT(x) ((x)+0xa0) +#define ASN1_CONTEXT_SIMPLE(x) ((x)+0x80) +#define ASN1_GENERAL_STRING 0x1b +#define ASN1_OCTET_STRING 0x4 +#define ASN1_OID 0x6 +#define ASN1_BOOLEAN 0x1 +#define ASN1_INTEGER 0x2 +#define ASN1_BITFIELD 0x3 +#define ASN1_ENUMERATED 0xa +#define ASN1_SET 0x31 + +#define ASN1_MAX_OIDS 20 + +/* some well known object IDs */ +#define OID_SPNEGO "1 3 6 1 5 5 2" +#define OID_NTLMSSP "1 3 6 1 4 1 311 2 2 10" +#define OID_KERBEROS5_OLD "1 2 840 48018 1 2 2" +#define OID_KERBEROS5 "1 2 840 113554 1 2 2" + +#define SPNEGO_NEG_RESULT_ACCEPT 0 +#define SPNEGO_NEG_RESULT_INCOMPLETE 1 +#define SPNEGO_NEG_RESULT_REJECT 2 + +/* not really ASN.1, but RFC 1964 */ +#define TOK_ID_KRB_AP_REQ (uchar*)"\x01\x00" +#define TOK_ID_KRB_AP_REP (uchar*)"\x02\x00" +#define TOK_ID_KRB_ERROR (uchar*)"\x03\x00" +#define TOK_ID_GSS_GETMIC (uchar*)"\x01\x01" +#define TOK_ID_GSS_WRAP (uchar*)"\x02\x01" + +#endif /* _ASN_1_H */ diff --git a/source3/include/async_req.h b/source3/include/async_req.h new file mode 100644 index 0000000000..2d01b53814 --- /dev/null +++ b/source3/include/async_req.h @@ -0,0 +1,137 @@ +/* + Unix SMB/CIFS implementation. + Infrastructure for async requests + Copyright (C) Volker Lendecke 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __ASYNC_REQ_H__ +#define __ASYNC_REQ_H__ + +#include "includes.h" + +/** + * An async request moves between the following 4 states: + */ + +enum async_req_state { + /** + * we are creating the request + */ + ASYNC_REQ_INIT, + /** + * we are waiting the request to complete + */ + ASYNC_REQ_IN_PROGRESS, + /** + * the request is finished + */ + ASYNC_REQ_DONE, + /** + * an error has occured + */ + ASYNC_REQ_ERROR +}; + +/** + * @brief An async request + * + * This represents an async request being processed by callbacks via an event + * context. A user can issue for example a write request to a socket, giving + * an implementation function the fd, the buffer and the number of bytes to + * transfer. The function issuing the request will immediately return without + * blocking most likely without having sent anything. The API user then fills + * in req->async.fn and req->async.priv, functions that are called when the + * request is finished. + * + * It is up to the user of the async request to talloc_free it after it has + * finished. This can happen while the completion function is called. + */ + +struct async_req { + /** + * @brief The external state - will be queried by the caller + * + * While the async request is being processed, state will remain in + * ASYNC_REQ_IN_PROGRESS. A request is finished if + * req->state>=ASYNC_REQ_DONE. + */ + enum async_req_state state; + + /** + * @brief Private pointer for the actual implementation + * + * The implementation doing the work for the async request needs a + * current state like for example a fd event. The user of an async + * request should not touch this. + */ + void *private_data; + + /** + * @brief Print yourself, for debugging purposes + * + * Async requests are opaque data structures. The implementation of an + * async request can define a custom function to print more debug + * info. + */ + char *(*print)(TALLOC_CTX *mem_ctx, struct async_req *); + + /** + * @brief status code when finished + * + * This status can be queried in the async completion function. It + * will be set to NT_STATUS_OK when everything went fine. + **/ + NTSTATUS status; + + /** + * @brief The event context we are using + * + * The event context that this async request works on. + */ + struct event_context *event_ctx; + + /** + * @brief What to do on completion + * + * This is used for the user of an async request, fn is called when + * the request completes, either successfully or with an error. + */ + struct { + /** + * @brief Completion function + * Completion function, to be filled by the API user + */ + void (*fn)(struct async_req *); + /** + * @brief Private data for the completion function + */ + void *priv; + } async; +}; + +struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev); + +char *async_req_print(TALLOC_CTX *mem_ctx, struct async_req *req); + +void async_req_done(struct async_req *req); + +void async_req_error(struct async_req *req, NTSTATUS status); + +bool async_post_status(struct async_req *req, NTSTATUS status); + +bool async_req_nomem(const void *p, struct async_req *req); + +#endif diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h new file mode 100644 index 0000000000..4e2061813f --- /dev/null +++ b/source3/include/async_smb.h @@ -0,0 +1,145 @@ +/* + Unix SMB/CIFS implementation. + Infrastructure for async SMB client requests + Copyright (C) Volker Lendecke 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __ASYNC_SMB_H__ +#define __ASYNC_SMB_H__ + +#include "includes.h" + +/** + * struct cli_request is the state holder for an async client request we sent + * to the server. It can consist of more than one struct async_req that we + * have to server if the application did a cli_chain_cork() and + * cli_chain_uncork() + */ + +struct cli_request { + /** + * "prev" and "next" form the doubly linked list in + * cli_state->outstanding_requests + */ + struct cli_request *prev, *next; + + /** + * num_async: How many chained requests do we serve? + */ + int num_async; + + /** + * async: This is the list of chained requests that were queued up by + * cli_request_chain before we sent out this request + */ + struct async_req **async; + + /** + * The client connection for this request + */ + struct cli_state *cli; + + /** + * The enc_state to decrypt the reply + */ + struct smb_trans_enc_state *enc_state; + + /** + * The mid we used for this request. Mainly used to demultiplex on + * receiving replies. + */ + uint16_t mid; + + /** + * The bytes we have to ship to the server + */ + char *outbuf; + + /** + * How much from "outbuf" did we already send + */ + size_t sent; + + /** + * The reply comes in here. Its intended size is implicit by + * smb_len(), its current size can be read via talloc_get_size() + */ + char *inbuf; + + /** + * Specific requests might add stuff here. Maybe convert this to a + * private_pointer at some point. + */ + union { + struct { + off_t ofs; + size_t size; + ssize_t received; + uint8_t *rcvbuf; + } read; + struct { + DATA_BLOB data; + uint16_t num_echos; + } echo; + } data; + + /** + * For requests that don't follow the strict request/reply pattern + * such as the transaction request family and echo requests it is + * necessary to break the standard procedure in + * handle_incoming_pdu(). For a simple example look at + * cli_echo_recv_helper(). + */ + struct { + void (*fn)(struct async_req *req); + void *priv; + } recv_helper; +}; + +/* + * Ship a new smb request to the server + */ + +struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, + uint8_t smb_command, + uint8_t additional_flags, + uint8_t wct, const uint16_t *vwv, + uint16_t num_bytes, const uint8_t *bytes); + +bool cli_chain_cork(struct cli_state *cli, struct event_context *ev, + size_t size_hint); +void cli_chain_uncork(struct cli_state *cli); +bool cli_in_chain(struct cli_state *cli); + +NTSTATUS cli_pull_reply(struct async_req *req, + uint8_t *pwct, uint16_t **pvwv, + uint16_t *pnum_bytes, uint8_t **pbytes); + +/* + * Fetch an error out of a NBT packet + */ + +NTSTATUS cli_pull_error(char *buf); + +/* + * Compatibility helper for the sync APIs: Fake NTSTATUS in cli->inbuf + */ + +void cli_set_error(struct cli_state *cli, NTSTATUS status); + +#endif diff --git a/source3/include/async_sock.h b/source3/include/async_sock.h new file mode 100644 index 0000000000..3c90453601 --- /dev/null +++ b/source3/include/async_sock.h @@ -0,0 +1,45 @@ +/* + Unix SMB/CIFS implementation. + async socket operations + Copyright (C) Volker Lendecke 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __ASYNC_SOCK_H__ +#define __ASYNC_SOCK_H__ + +#include "includes.h" + +ssize_t async_syscall_result_ssize_t(struct async_req **req, int *perrno); +size_t async_syscall_result_size_t (struct async_req **req, int *perrno); +ssize_t async_syscall_result_int (struct async_req **req, int *perrno); + +struct async_req *async_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + int fd, const void *buffer, size_t length, + int flags); +struct async_req *async_sendall(TALLOC_CTX *mem_ctx, struct event_context *ev, + int fd, const void *buffer, size_t length, + int flags); +struct async_req *async_recv(TALLOC_CTX *mem_ctx, struct event_context *ev, + int fd, void *buffer, size_t length, + int flags); +struct async_req *async_recvall(TALLOC_CTX *mem_ctx, struct event_context *ev, + int fd, void *buffer, size_t length, + int flags); +struct async_req *async_connect(TALLOC_CTX *mem_ctx, struct event_context *ev, + int fd, const struct sockaddr *address, + socklen_t address_len); + +#endif diff --git a/source3/include/auth.h b/source3/include/auth.h new file mode 100644 index 0000000000..adcd6e943f --- /dev/null +++ b/source3/include/auth.h @@ -0,0 +1,148 @@ +#ifndef _SMBAUTH_H_ +#define _SMBAUTH_H_ +/* + Unix SMB/CIFS implementation. + Standardised Authentication types + Copyright (C) Andrew Bartlett 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +typedef struct auth_usersupplied_info { + DATA_BLOB lm_resp; + DATA_BLOB nt_resp; + DATA_BLOB lm_interactive_pwd; + DATA_BLOB nt_interactive_pwd; + DATA_BLOB plaintext_password; + + bool encrypted; + + bool was_mapped; /* Did the username map actually match? */ + char *client_domain; /* domain name string */ + char *domain; /* domain name after mapping */ + char *internal_username; /* username after mapping */ + char *smb_name; /* username before mapping */ + char *wksta_name; /* workstation name (netbios calling + * name) unicode string */ + + uint32 logon_parameters; + +} auth_usersupplied_info; + +typedef struct auth_serversupplied_info { + bool guest; + + DOM_SID *sids; /* These SIDs are preliminary between + check_ntlm_password and the token creation. */ + size_t num_sids; + + struct unix_user_token utok; + + /* NT group information taken from the info3 structure */ + + NT_USER_TOKEN *ptok; + + DATA_BLOB user_session_key; + DATA_BLOB lm_session_key; + + char *login_server; /* which server authorized the login? */ + + struct samu *sam_account; + + void *pam_handle; + + /* + * This is a token from /etc/passwd and /etc/group + */ + bool nss_token; + + char *unix_name; + + /* + * For performance reasons we keep an alpha_strcpy-sanitized version + * of the username around as long as the global variable current_user + * still exists. If we did not do keep this, we'd have to call + * alpha_strcpy whenever we do a become_user(), potentially on every + * smb request. See set_current_user_info. + */ + char *sanitized_username; +} auth_serversupplied_info; + +struct auth_context { + DATA_BLOB challenge; + + /* Who set this up in the first place? */ + const char *challenge_set_by; + + bool challenge_may_be_modified; + + struct auth_methods *challenge_set_method; + /* What order are the various methods in? Try to stop it changing under us */ + struct auth_methods *auth_method_list; + + TALLOC_CTX *mem_ctx; + const uint8 *(*get_ntlm_challenge)(struct auth_context *auth_context); + NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context, + const struct auth_usersupplied_info *user_info, + struct auth_serversupplied_info **server_info); + NTSTATUS (*nt_status_squash)(NTSTATUS nt_status); + void (*free)(struct auth_context **auth_context); +}; + +typedef struct auth_methods +{ + struct auth_methods *prev, *next; + const char *name; /* What name got this module */ + + NTSTATUS (*auth)(const struct auth_context *auth_context, + void *my_private_data, + TALLOC_CTX *mem_ctx, + const struct auth_usersupplied_info *user_info, + auth_serversupplied_info **server_info); + + /* If you are using this interface, then you are probably + * getting something wrong. This interface is only for + * security=server, and makes a number of compromises to allow + * that. It is not compatible with being a PDC. */ + DATA_BLOB (*get_chal)(const struct auth_context *auth_context, + void **my_private_data, + TALLOC_CTX *mem_ctx); + + /* Used to keep tabs on things like the cli for SMB server authentication */ + void *private_data; + +} auth_methods; + +typedef NTSTATUS (*auth_init_function)(struct auth_context *, const char *, struct auth_methods **); + +struct auth_init_function_entry { + const char *name; + /* Function to create a member of the authmethods list */ + + auth_init_function init; + + struct auth_init_function_entry *prev, *next; +}; + +typedef struct auth_ntlmssp_state { + TALLOC_CTX *mem_ctx; + struct auth_context *auth_context; + struct auth_serversupplied_info *server_info; + struct ntlmssp_state *ntlmssp_state; +} AUTH_NTLMSSP_STATE; + +/* Changed from 1 -> 2 to add the logon_parameters field. */ +#define AUTH_INTERFACE_VERSION 2 + +#endif /* _SMBAUTH_H_ */ diff --git a/source3/include/authdata.h b/source3/include/authdata.h new file mode 100644 index 0000000000..70f6d2da9a --- /dev/null +++ b/source3/include/authdata.h @@ -0,0 +1,39 @@ +/* + Unix SMB/CIFS implementation. + Kerberos authorization data + Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _AUTHDATA_H +#define _AUTHDATA_H + +#include "rpc_misc.h" + +#define PAC_TYPE_LOGON_INFO 1 +#define PAC_TYPE_SERVER_CHECKSUM 6 +#define PAC_TYPE_PRIVSVR_CHECKSUM 7 +#define PAC_TYPE_LOGON_NAME 10 + +#ifndef KRB5_AUTHDATA_WIN2K_PAC +#define KRB5_AUTHDATA_WIN2K_PAC 128 +#endif + +#ifndef KRB5_AUTHDATA_IF_RELEVANT +#define KRB5_AUTHDATA_IF_RELEVANT 1 +#endif + +#endif diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h new file mode 100644 index 0000000000..9ced9cea3a --- /dev/null +++ b/source3/include/byteorder.h @@ -0,0 +1,176 @@ +/* + Unix SMB/CIFS implementation. + SMB Byte handling + Copyright (C) Andrew Tridgell 1992-1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _BYTEORDER_H +#define _BYTEORDER_H + +/* + This file implements macros for machine independent short and + int manipulation + +Here is a description of this file that I emailed to the samba list once: + +> I am confused about the way that byteorder.h works in Samba. I have +> looked at it, and I would have thought that you might make a distinction +> between LE and BE machines, but you only seem to distinguish between 386 +> and all other architectures. +> +> Can you give me a clue? + +sure. + +The distinction between 386 and other architectures is only there as +an optimisation. You can take it out completely and it will make no +difference. The routines (macros) in byteorder.h are totally byteorder +independent. The 386 optimsation just takes advantage of the fact that +the x86 processors don't care about alignment, so we don't have to +align ints on int boundaries etc. If there are other processors out +there that aren't alignment sensitive then you could also define +CAREFUL_ALIGNMENT=0 on those processors as well. + +Ok, now to the macros themselves. I'll take a simple example, say we +want to extract a 2 byte integer from a SMB packet and put it into a +type called uint16 that is in the local machines byte order, and you +want to do it with only the assumption that uint16 is _at_least_ 16 +bits long (this last condition is very important for architectures +that don't have any int types that are 2 bytes long) + +You do this: + +#define CVAL(buf,pos) (((unsigned char *)(buf))[pos]) +#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos)) +#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) + +then to extract a uint16 value at offset 25 in a buffer you do this: + +char *buffer = foo_bar(); +uint16 xx = SVAL(buffer,25); + +We are using the byteoder independence of the ANSI C bitshifts to do +the work. A good optimising compiler should turn this into efficient +code, especially if it happens to have the right byteorder :-) + +I know these macros can be made a bit tidier by removing some of the +casts, but you need to look at byteorder.h as a whole to see the +reasoning behind them. byteorder.h defines the following macros: + +SVAL(buf,pos) - extract a 2 byte SMB value +IVAL(buf,pos) - extract a 4 byte SMB value +SVALS(buf,pos) signed version of SVAL() +IVALS(buf,pos) signed version of IVAL() + +SSVAL(buf,pos,val) - put a 2 byte SMB value into a buffer +SIVAL(buf,pos,val) - put a 4 byte SMB value into a buffer +SSVALS(buf,pos,val) - signed version of SSVAL() +SIVALS(buf,pos,val) - signed version of SIVAL() + +RSVAL(buf,pos) - like SVAL() but for NMB byte ordering +RSVALS(buf,pos) - like SVALS() but for NMB byte ordering +RIVAL(buf,pos) - like IVAL() but for NMB byte ordering +RIVALS(buf,pos) - like IVALS() but for NMB byte ordering +RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering +RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering +RSIVALS(buf,pos,val) - like SIVALS() but for NMB ordering + +it also defines lots of intermediate macros, just ignore those :-) + +*/ + +#undef CAREFUL_ALIGNMENT + +/* we know that the 386 can handle misalignment and has the "right" + byteorder */ +#ifdef __i386__ +#define CAREFUL_ALIGNMENT 0 +#endif + +#ifndef CAREFUL_ALIGNMENT +#define CAREFUL_ALIGNMENT 1 +#endif + +#define CVAL(buf,pos) ((unsigned)(((const unsigned char *)(buf))[pos])) +#define CVAL_NC(buf,pos) (((unsigned char *)(buf))[pos]) /* Non-const version of CVAL */ +#define PVAL(buf,pos) (CVAL(buf,pos)) +#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val)) + + +#if CAREFUL_ALIGNMENT + +#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) +#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) +#define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(unsigned char)((val)&0xFF),CVAL_NC(buf,pos+1)=(unsigned char)((val)>>8)) +#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16)) +#define SVALS(buf,pos) ((int16)SVAL(buf,pos)) +#define IVALS(buf,pos) ((int32)IVAL(buf,pos)) +#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16)(val))) +#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val))) +#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val))) +#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val))) + +#else /* CAREFUL_ALIGNMENT */ + +/* this handles things for architectures like the 386 that can handle + alignment errors */ +/* + WARNING: This section is dependent on the length of int16 and int32 + being correct +*/ + +/* get single value from an SMB buffer */ +#define SVAL(buf,pos) (*(const uint16 *)((const char *)(buf) + (pos))) +#define SVAL_NC(buf,pos) (*(uint16 *)((char *)(buf) + (pos))) /* Non const version of above. */ +#define IVAL(buf,pos) (*(const uint32 *)((const char *)(buf) + (pos))) +#define IVAL_NC(buf,pos) (*(uint32 *)((char *)(buf) + (pos))) /* Non const version of above. */ +#define SVALS(buf,pos) (*(const int16 *)((const char *)(buf) + (pos))) +#define SVALS_NC(buf,pos) (*(int16 *)((char *)(buf) + (pos))) /* Non const version of above. */ +#define IVALS(buf,pos) (*(const int32 *)((const char *)(buf) + (pos))) +#define IVALS_NC(buf,pos) (*(int32 *)((char *)(buf) + (pos))) /* Non const version of above. */ + +/* store single value in an SMB buffer */ +#define SSVAL(buf,pos,val) SVAL_NC(buf,pos)=((uint16)(val)) +#define SIVAL(buf,pos,val) IVAL_NC(buf,pos)=((uint32)(val)) +#define SSVALS(buf,pos,val) SVALS_NC(buf,pos)=((int16)(val)) +#define SIVALS(buf,pos,val) IVALS_NC(buf,pos)=((int32)(val)) + +#endif /* CAREFUL_ALIGNMENT */ + +/* now the reverse routines - these are used in nmb packets (mostly) */ +#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) +#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) + +#define RSVAL(buf,pos) SREV(SVAL(buf,pos)) +#define RSVALS(buf,pos) SREV(SVALS(buf,pos)) +#define RIVAL(buf,pos) IREV(IVAL(buf,pos)) +#define RIVALS(buf,pos) IREV(IVALS(buf,pos)) +#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val)) +#define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val)) +#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val)) +#define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val)) + +/* Alignment macros. */ +#define ALIGN4(p,base) ((p) + ((4 - (PTR_DIFF((p), (base)) & 3)) & 3)) +#define ALIGN2(p,base) ((p) + ((2 - (PTR_DIFF((p), (base)) & 1)) & 1)) + +/* 64 bit macros */ +#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32)) +#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs)) +#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,((uint64_t)(v))>>32)) +#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v)) + +#endif /* _BYTEORDER_H */ diff --git a/source3/include/charset.h b/source3/include/charset.h new file mode 100644 index 0000000000..4d04b5a1a6 --- /dev/null +++ b/source3/include/charset.h @@ -0,0 +1,126 @@ +/* + Unix SMB/CIFS implementation. + charset defines + Copyright (C) Andrew Tridgell 2001 + Copyright (C) Jelmer Vernooij 2002 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* this defines the charset types used in samba */ +typedef enum {CH_UTF16LE=0, CH_UTF16=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4, CH_UTF16BE=5} charset_t; + +#define NUM_CHARSETS 6 + +/* + * for each charset we have a function that pushes from that charset to a ucs2 + * buffer, and a function that pulls from ucs2 buffer to that charset. + * */ + +struct charset_functions { + const char *name; + size_t (*pull)(void *, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*push)(void *, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + struct charset_functions *prev, *next; +}; + +/* + * This is auxiliary struct used by source/script/gen-8-bit-gap.sh script + * during generation of an encoding table for charset module + * */ + +struct charset_gap_table { + uint16 start; + uint16 end; + int32 idx; +}; + +/* + * Define stub for charset module which implements 8-bit encoding with gaps. + * Encoding tables for such module should be produced from glibc's CHARMAPs + * using script source/script/gen-8bit-gap.sh + * CHARSETNAME is CAPITALIZED charset name + * + * */ +#define SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP(CHARSETNAME) \ +static size_t CHARSETNAME ## _push(void *cd, const char **inbuf, size_t *inbytesleft, \ + char **outbuf, size_t *outbytesleft) \ +{ \ + while (*inbytesleft >= 2 && *outbytesleft >= 1) { \ + int i; \ + int done = 0; \ + \ + uint16 ch = SVAL(*inbuf,0); \ + \ + for (i=0; from_idx[i].start != 0xffff; i++) { \ + if ((from_idx[i].start <= ch) && (from_idx[i].end >= ch)) { \ + ((unsigned char*)(*outbuf))[0] = from_ucs2[from_idx[i].idx+ch]; \ + (*inbytesleft) -= 2; \ + (*outbytesleft) -= 1; \ + (*inbuf) += 2; \ + (*outbuf) += 1; \ + done = 1; \ + break; \ + } \ + } \ + if (!done) { \ + errno = EINVAL; \ + return -1; \ + } \ + \ + } \ + \ + if (*inbytesleft == 1) { \ + errno = EINVAL; \ + return -1; \ + } \ + \ + if (*inbytesleft > 1) { \ + errno = E2BIG; \ + return -1; \ + } \ + \ + return 0; \ +} \ + \ +static size_t CHARSETNAME ## _pull(void *cd, const char **inbuf, size_t *inbytesleft, \ + char **outbuf, size_t *outbytesleft) \ +{ \ + while (*inbytesleft >= 1 && *outbytesleft >= 2) { \ + *(uint16*)(*outbuf) = to_ucs2[((unsigned char*)(*inbuf))[0]]; \ + (*inbytesleft) -= 1; \ + (*outbytesleft) -= 2; \ + (*inbuf) += 1; \ + (*outbuf) += 2; \ + } \ + \ + if (*inbytesleft > 0) { \ + errno = E2BIG; \ + return -1; \ + } \ + \ + return 0; \ +} \ + \ +struct charset_functions CHARSETNAME ## _functions = \ + {#CHARSETNAME, CHARSETNAME ## _pull, CHARSETNAME ## _push}; \ + \ +NTSTATUS charset_ ## CHARSETNAME ## _init(void); \ +NTSTATUS charset_ ## CHARSETNAME ## _init(void) \ +{ \ + return smb_register_charset(& CHARSETNAME ## _functions); \ +} \ + diff --git a/source3/include/client.h b/source3/include/client.h new file mode 100644 index 0000000000..70b0421c6d --- /dev/null +++ b/source3/include/client.h @@ -0,0 +1,252 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Luke Kenneth Casson Leighton 1996-1998 + Copyright (C) Jeremy Allison 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _CLIENT_H +#define _CLIENT_H + +/* the client asks for a smaller buffer to save ram and also to get more + overlap on the wire. This size gives us a nice read/write size, which + will be a multiple of the page size on almost any system */ +#define CLI_BUFFER_SIZE (0xFFFF) +#define CLI_SAMBA_MAX_LARGE_READX_SIZE (127*1024) /* Works for Samba servers */ +#define CLI_SAMBA_MAX_LARGE_WRITEX_SIZE (127*1024) /* Works for Samba servers */ +#define CLI_WINDOWS_MAX_LARGE_READX_SIZE ((64*1024)-2) /* Windows servers are broken.... */ +#define CLI_WINDOWS_MAX_LARGE_WRITEX_SIZE ((64*1024)-2) /* Windows servers are broken.... */ +#define CLI_SAMBA_MAX_POSIX_LARGE_READX_SIZE (0xFFFF00) /* 24-bit len. */ +#define CLI_SAMBA_MAX_POSIX_LARGE_WRITEX_SIZE (0xFFFF00) /* 24-bit len. */ + +/* + * These definitions depend on smb.h + */ + +struct print_job_info { + uint16 id; + uint16 priority; + size_t size; + fstring user; + fstring name; + time_t t; +}; + +struct cli_pipe_auth_data { + enum pipe_auth_type auth_type; /* switch for the union below. Defined in ntdomain.h */ + enum pipe_auth_level auth_level; /* defined in ntdomain.h */ + + char *domain; + char *user_name; + + union { + struct schannel_auth_struct *schannel_auth; + NTLMSSP_STATE *ntlmssp_state; + struct kerberos_auth_struct *kerberos_auth; + } a_u; +}; + +struct rpc_pipe_client { + struct rpc_pipe_client *prev, *next; + + enum dcerpc_transport_t transport_type; + + union { + struct { + struct cli_state *cli; + const char *pipe_name; + uint16 fnum; + } np; + struct { + int fd; + } sock; + } trans ; + + struct ndr_syntax_id abstract_syntax; + struct ndr_syntax_id transfer_syntax; + + char *desthost; + char *srv_name_slash; + + uint16 max_xmit_frag; + uint16 max_recv_frag; + + struct cli_pipe_auth_data *auth; + + /* The following is only non-null on a netlogon pipe. */ + struct dcinfo *dc; +}; + +/* Transport encryption state. */ +enum smb_trans_enc_type { + SMB_TRANS_ENC_NTLM +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + , SMB_TRANS_ENC_GSS +#endif +}; + +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) +struct smb_tran_enc_state_gss { + gss_ctx_id_t gss_ctx; + gss_cred_id_t creds; +}; +#endif + +struct smb_trans_enc_state { + enum smb_trans_enc_type smb_enc_type; + uint16 enc_ctx_num; + bool enc_on; + union { + NTLMSSP_STATE *ntlmssp_state; +#if defined(HAVE_GSSAPI) && defined(HAVE_KRB5) + struct smb_tran_enc_state_gss *gss_state; +#endif + } s; +}; + +struct cli_state { + int port; + int fd; + /* Last read or write error. */ + enum smb_read_errors smb_rw_error; + uint16 cnum; + uint16 pid; + uint16 mid; + uint16 vuid; + int protocol; + int sec_mode; + int rap_error; + int privileges; + + fstring desthost; + + /* The credentials used to open the cli_state connection. */ + fstring domain; + fstring user_name; + struct pwd_info pwd; + + /* + * The following strings are the + * ones returned by the server if + * the protocol > NT1. + */ + fstring server_type; + fstring server_os; + fstring server_domain; + + fstring share; + fstring dev; + struct nmb_name called; + struct nmb_name calling; + fstring full_dest_host_name; + struct sockaddr_storage dest_ss; + + DATA_BLOB secblob; /* cryptkey or negTokenInit */ + uint32 sesskey; + int serverzone; + uint32 servertime; + int readbraw_supported; + int writebraw_supported; + int timeout; /* in milliseconds. */ + size_t max_xmit; + size_t max_mux; + char *outbuf; + char *inbuf; + unsigned int bufsize; + int initialised; + int win95; + bool is_samba; + uint32 capabilities; + uint32 posix_capabilities; + bool dfsroot; + +#if 0 + TALLOC_CTX *longterm_mem_ctx; + TALLOC_CTX *call_mem_ctx; +#endif + + smb_sign_info sign_info; + + struct smb_trans_enc_state *trans_enc_state; /* Setup if we're encrypting SMB's. */ + + /* the session key for this CLI, outside + any per-pipe authenticaion */ + DATA_BLOB user_session_key; + + /* The list of pipes currently open on this connection. */ + struct rpc_pipe_client *pipe_list; + + bool use_kerberos; + bool fallback_after_kerberos; + bool use_spnego; + bool got_kerberos_mechanism; /* Server supports krb5 in SPNEGO. */ + + bool use_oplocks; /* should we use oplocks? */ + bool use_level_II_oplocks; /* should we use level II oplocks? */ + + /* a oplock break request handler */ + bool (*oplock_handler)(struct cli_state *cli, int fnum, unsigned char level); + + bool force_dos_errors; + bool case_sensitive; /* False by default. */ + + /** + * fd_event is around while we have async requests outstanding or are + * building a chained request. + * + * (fd_event!=NULL) && + * ((outstanding_request!=NULL)||(chain_accumulator!=NULL)) + * + * should always be true, as well as the reverse: If both cli_request + * pointers are NULL, no fd_event is around. + */ + struct fd_event *fd_event; + char *evt_inbuf; + + /** + * A linked list of requests that are waiting for a reply + */ + struct cli_request *outstanding_requests; + + /** + * The place to build up the list of chained requests. In CIFS, a + * single cli_request corresponds to a MID and can serve more than one + * chained async_req. + */ + struct cli_request *chain_accumulator; +}; + +typedef struct file_info { + struct cli_state *cli; + SMB_BIG_UINT size; + uint16 mode; + uid_t uid; + gid_t gid; + /* these times are normally kept in GMT */ + struct timespec mtime_ts; + struct timespec atime_ts; + struct timespec ctime_ts; + char *name; + char short_name[13*3]; /* the *3 is to cope with multi-byte */ +} file_info; + +#define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001 +#define CLI_FULL_CONNECTION_USE_KERBEROS 0x0002 +#define CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK 0x0004 +#define CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS 0x0008 + +#endif /* _CLIENT_H */ diff --git a/source3/include/clitar.h b/source3/include/clitar.h new file mode 100644 index 0000000000..69267fbb08 --- /dev/null +++ b/source3/include/clitar.h @@ -0,0 +1,40 @@ +/* + * Unix SMB/CIFS implementation. + * clitar file format + * Copyright (C) Andrew Tridgell 2000 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _CLITAR_H +#define _CLITAR_H + +#define TBLOCK 512 +#define NAMSIZ 100 +union hblock { + char dummy[TBLOCK]; + struct header { + char name[NAMSIZ]; + char mode[8]; + char uid[8]; + char gid[8]; + char size[12]; + char mtime[12]; + char chksum[8]; + char linkflag; + char linkname[NAMSIZ]; + } dbuf; +}; + +#endif /* _CLITAR_H */ diff --git a/source3/include/core.h b/source3/include/core.h new file mode 100644 index 0000000000..1f9ddb8b3c --- /dev/null +++ b/source3/include/core.h @@ -0,0 +1,3 @@ +/* dummy file to deal with pidl autogenerated ndr files */ + +#include "nterr.h" diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h new file mode 100644 index 0000000000..39f50c2cfc --- /dev/null +++ b/source3/include/ctdbd_conn.h @@ -0,0 +1,77 @@ +/* + Unix SMB/CIFS implementation. + Samba3 ctdb connection handling + Copyright (C) Volker Lendecke 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _CTDBD_CONN_H +#define _CTDBD_CONN_H + +struct ctdbd_connection; + +NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx, + struct ctdbd_connection **pconn); +NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx, + struct ctdbd_connection **pconn); + +uint32 ctdbd_vnn(const struct ctdbd_connection *conn); + +NTSTATUS ctdbd_register_msg_ctx(struct ctdbd_connection *conn, + struct messaging_context *msg_ctx); + +NTSTATUS ctdbd_messaging_send(struct ctdbd_connection *conn, + uint32 dst_vnn, uint64 dst_srvid, + struct messaging_rec *msg); + +bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32 vnn, + pid_t pid); + +char *ctdbd_dbpath(struct ctdbd_connection *conn, + TALLOC_CTX *mem_ctx, uint32_t db_id); + +NTSTATUS ctdbd_db_attach(struct ctdbd_connection *conn, const char *name, + uint32_t *db_id, int tdb_flags); + +NTSTATUS ctdbd_migrate(struct ctdbd_connection *conn, uint32 db_id, + TDB_DATA key); + +NTSTATUS ctdbd_fetch(struct ctdbd_connection *conn, uint32 db_id, + TDB_DATA key, TALLOC_CTX *mem_ctx, TDB_DATA *data); + +NTSTATUS ctdbd_traverse(uint32 db_id, + void (*fn)(TDB_DATA key, TDB_DATA data, + void *private_data), + void *private_data); + +NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn, + const struct sockaddr_in *server, + const struct sockaddr_in *client, + void (*release_ip_handler)(const char *ip_addr, + void *private_data), + void *private_data); + +NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn); + +NTSTATUS ctdbd_persistent_store(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data); +NTSTATUS ctdbd_start_persistent_update(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data); +NTSTATUS ctdbd_cancel_persistent_update(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data); + +NTSTATUS ctdbd_control_local(struct ctdbd_connection *conn, uint32 opcode, + uint64_t srvid, uint32_t flags, TDB_DATA data, + TALLOC_CTX *mem_ctx, TDB_DATA *outdata, + int *cstatus); + +#endif /* _CTDBD_CONN_H */ diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h new file mode 100644 index 0000000000..46833fabdc --- /dev/null +++ b/source3/include/dbwrap.h @@ -0,0 +1,91 @@ +/* + Unix SMB/CIFS implementation. + Database interface wrapper around tdb + Copyright (C) Volker Lendecke 2005-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __DBWRAP_H__ +#define __DBWRAP_H__ + +struct db_record { + TDB_DATA key, value; + NTSTATUS (*store)(struct db_record *rec, TDB_DATA data, int flag); + NTSTATUS (*delete_rec)(struct db_record *rec); + void *private_data; +}; + +struct db_context { + struct db_record *(*fetch_locked)(struct db_context *db, + TALLOC_CTX *mem_ctx, + TDB_DATA key); + int (*fetch)(struct db_context *db, TALLOC_CTX *mem_ctx, + TDB_DATA key, TDB_DATA *data); + int (*traverse)(struct db_context *db, + int (*f)(struct db_record *rec, + void *private_data), + void *private_data); + int (*traverse_read)(struct db_context *db, + int (*f)(struct db_record *rec, + void *private_data), + void *private_data); + int (*get_seqnum)(struct db_context *db); + int (*transaction_start)(struct db_context *db); + int (*transaction_commit)(struct db_context *db); + int (*transaction_cancel)(struct db_context *db); + void *private_data; + bool persistent; +}; + +struct db_context *db_open(TALLOC_CTX *mem_ctx, + const char *name, + int hash_size, int tdb_flags, + int open_flags, mode_t mode); + +struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx); + +struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, + const char *name, + int hash_size, int tdb_flags, + int open_flags, mode_t mode); + +struct db_context *db_open_tdb2(TALLOC_CTX *mem_ctx, + const char *name, + int hash_size, int tdb_flags, + int open_flags, mode_t mode); + +struct messaging_context; + +#ifdef CLUSTER_SUPPORT +struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, + const char *name, + int hash_size, int tdb_flags, + int open_flags, mode_t mode); +#endif + +struct db_context *db_open_file(TALLOC_CTX *mem_ctx, + struct messaging_context *msg_ctx, + const char *name, + int hash_size, int tdb_flags, + int open_flags, mode_t mode); + + +NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key); +NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key, + TDB_DATA data, int flags); +TDB_DATA dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx, + const char *key); + +#endif /* __DBWRAP_H__ */ diff --git a/source3/include/dcerpc.h b/source3/include/dcerpc.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/source3/include/dcerpc.h diff --git a/source3/include/debug.h b/source3/include/debug.h new file mode 100644 index 0000000000..d1716320b3 --- /dev/null +++ b/source3/include/debug.h @@ -0,0 +1,240 @@ +/* + Unix SMB/CIFS implementation. + SMB debug stuff + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) John H Terpstra 1996-1998 + Copyright (C) Luke Kenneth Casson Leighton 1996-1998 + Copyright (C) Paul Ashton 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _DEBUG_H +#define _DEBUG_H + +/* -------------------------------------------------------------------------- ** + * Debugging code. See also debug.c + */ + +/* mkproto.awk has trouble with ifdef'd function definitions (it ignores + * the #ifdef directive and will read both definitions, thus creating two + * diffferent prototype declarations), so we must do these by hand. + */ +/* I know the __attribute__ stuff is ugly, but it does ensure we get the + arguments to DEBUG() right. We have got them wrong too often in the + past. + The PRINTFLIKE comment does the equivalent for SGI MIPSPro. + */ +/* PRINTFLIKE1 */ +int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2); +/* PRINTFLIKE1 */ +bool dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2); +bool dbghdr( int level, int cls, const char *file, const char *func, int line ); + +#if defined(sgi) && (_COMPILER_VERSION >= 730) +#pragma mips_frequency_hint NEVER Debug1 +#pragma mips_frequency_hint NEVER dbgtext +#pragma mips_frequency_hint NEVER dbghdr +#endif + +extern XFILE *dbf; + +/* If we have these macros, we can add additional info to the header. */ + +#ifdef HAVE_FUNCTION_MACRO +#define FUNCTION_MACRO (__FUNCTION__) +#else +#define FUNCTION_MACRO ("") +#endif + +/* + * Redefine DEBUGLEVEL because so we don't have to change every source file + * that *unnecessarily* references it. Source files neeed not extern reference + * DEBUGLEVEL, as it's extern in includes.h (which all source files include). + * Eventually, all these references should be removed, and all references to + * DEBUGLEVEL should be references to DEBUGLEVEL_CLASS[DBGC_ALL]. This could + * still be through a macro still called DEBUGLEVEL. This cannot be done now + * because some references would expand incorrectly. + */ +#define DEBUGLEVEL *debug_level +extern int DEBUGLEVEL; + +/* + * Define all new debug classes here. A class is represented by an entry in + * the DEBUGLEVEL_CLASS array. Index zero of this arrray is equivalent to the + * old DEBUGLEVEL. Any source file that does NOT add the following lines: + * + * #undef DBGC_CLASS + * #define DBGC_CLASS DBGC_<your class name here> + * + * at the start of the file (after #include "includes.h") will default to + * using index zero, so it will behaive just like it always has. + */ +#define DBGC_ALL 0 /* index equivalent to DEBUGLEVEL */ + +#define DBGC_TDB 1 +#define DBGC_PRINTDRIVERS 2 +#define DBGC_LANMAN 3 +#define DBGC_SMB 4 +#define DBGC_RPC_PARSE 5 +#define DBGC_RPC_SRV 6 +#define DBGC_RPC_CLI 7 +#define DBGC_PASSDB 8 +#define DBGC_SAM 9 +#define DBGC_AUTH 10 +#define DBGC_WINBIND 11 +#define DBGC_VFS 12 +#define DBGC_IDMAP 13 +#define DBGC_QUOTA 14 +#define DBGC_ACLS 15 +#define DBGC_LOCKING 16 +#define DBGC_MSDFS 17 +#define DBGC_DMAPI 18 +#define DBGC_REGISTRY 19 + +/* So you can define DBGC_CLASS before including debug.h */ +#ifndef DBGC_CLASS +#define DBGC_CLASS 0 /* override as shown above */ +#endif + +extern int *DEBUGLEVEL_CLASS; +extern bool *DEBUGLEVEL_CLASS_ISSET; + +/* Debugging macros + * + * DEBUGLVL() + * If the 'file specific' debug class level >= level OR the system-wide + * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then + * generate a header using the default macros for file, line, and + * function name. Returns True if the debug level was <= DEBUGLEVEL. + * + * Example: if( DEBUGLVL( 2 ) ) dbgtext( "Some text.\n" ); + * + * DEBUGLVLC() + * If the 'macro specified' debug class level >= level OR the system-wide + * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then + * generate a header using the default macros for file, line, and + * function name. Returns True if the debug level was <= DEBUGLEVEL. + * + * Example: if( DEBUGLVLC( DBGC_TDB, 2 ) ) dbgtext( "Some text.\n" ); + * + * DEBUG() + * If the 'file specific' debug class level >= level OR the system-wide + * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then + * generate a header using the default macros for file, line, and + * function name. Each call to DEBUG() generates a new header *unless* the + * previous debug output was unterminated (i.e. no '\n'). + * See debug.c:dbghdr() for more info. + * + * Example: DEBUG( 2, ("Some text and a value %d.\n", value) ); + * + * DEBUGC() + * If the 'macro specified' debug class level >= level OR the system-wide + * DEBUGLEVEL (synomym for DEBUGLEVEL_CLASS[ DBGC_ALL ]) >= level then + * generate a header using the default macros for file, line, and + * function name. Each call to DEBUG() generates a new header *unless* the + * previous debug output was unterminated (i.e. no '\n'). + * See debug.c:dbghdr() for more info. + * + * Example: DEBUGC( DBGC_TDB, 2, ("Some text and a value %d.\n", value) ); + * + * DEBUGADD(), DEBUGADDC() + * Same as DEBUG() and DEBUGC() except the text is appended to the previous + * DEBUG(), DEBUGC(), DEBUGADD(), DEBUGADDC() with out another interviening + * header. + * + * Example: DEBUGADD( 2, ("Some text and a value %d.\n", value) ); + * DEBUGADDC( DBGC_TDB, 2, ("Some text and a value %d.\n", value) ); + * + * Note: If the debug class has not be redeined (see above) then the optimizer + * will remove the extra conditional test. + */ + +/* + * From talloc.c: + */ + +/* these macros gain us a few percent of speed on gcc */ +#if (__GNUC__ >= 3) +/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 + as its first argument */ +#ifndef likely +#define likely(x) __builtin_expect(!!(x), 1) +#endif +#ifndef unlikely +#define unlikely(x) __builtin_expect(!!(x), 0) +#endif +#else +#ifndef likely +#define likely(x) (x) +#endif +#ifndef unlikely +#define unlikely(x) (x) +#endif +#endif + +#define CHECK_DEBUGLVL( level ) \ + ( ((level) <= MAX_DEBUG_LEVEL) && \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) ) + +#define DEBUGLVL( level ) \ + ( CHECK_DEBUGLVL(level) \ + && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) + + +#define DEBUGLVLC( dbgc_class, level ) \ + ( ((level) <= MAX_DEBUG_LEVEL) && \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) ) + + +#define DEBUG( level, body ) \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ + && (dbgtext body) ) + +#define DEBUGC( dbgc_class, level, body ) \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \ + && (dbgtext body) ) + +#define DEBUGADD( level, body ) \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \ + (!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && (dbgtext body) ) + +#define DEBUGADDC( dbgc_class, level, body ) \ + (void)( ((level) <= MAX_DEBUG_LEVEL) && \ + unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \ + (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \ + DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \ + && (dbgtext body) ) + +/* Print a separator to the debug log. */ +#define DEBUGSEP(level)\ + DEBUG((level),("===============================================================\n")) + +#endif diff --git a/source3/include/debugparse.h b/source3/include/debugparse.h new file mode 100644 index 0000000000..a66a82a8d8 --- /dev/null +++ b/source3/include/debugparse.h @@ -0,0 +1,126 @@ +#ifndef DEBUGPARSE_H +#define DEBUGPARSE_H +/* ========================================================================== ** + * debugparse.c + * + * Copyright (C) 1998 by Christopher R. Hertel + * + * Email: crh@ubiqx.mn.org + * + * -------------------------------------------------------------------------- ** + * This module is a very simple parser for Samba debug log files. + * -------------------------------------------------------------------------- ** + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + * + * -------------------------------------------------------------------------- ** + * The important function in this module is dbg_char2token(). The rest is + * basically fluff. (Potentially useful fluff, but still fluff.) + * ========================================================================== ** + */ + +#include "includes.h" + +/* This module compiles quite nicely outside of the Samba environment. + * You'll need the following headers: +#include <ctype.h> +#include <stdio.h> +#include <string.h> + */ + +/* -------------------------------------------------------------------------- ** + * These are the tokens returned by dbg_char2token(). + */ + +typedef enum + { + dbg_null = 0, + dbg_ignore, + dbg_header, + dbg_timestamp, + dbg_level, + dbg_sourcefile, + dbg_function, + dbg_lineno, + dbg_message, + dbg_eof + } dbg_Token; + +/* -------------------------------------------------------------------------- ** + * Function prototypes... + */ + + const char *dbg_token2string( dbg_Token tok ); + /* ------------------------------------------------------------------------ ** + * Given a token, return a string describing the token. + * + * Input: tok - One of the set of dbg_Tokens defined in debugparse.h. + * + * Output: A string identifying the token. This is useful for debugging, + * etc. + * + * Note: If the token is not known, this function will return the + * string "<unknown>". + * + * ------------------------------------------------------------------------ ** + */ + + dbg_Token dbg_char2token( dbg_Token *state, int c ); + /* ------------------------------------------------------------------------ ** + * Parse input one character at a time. + * + * Input: state - A pointer to a token variable. This is used to + * maintain the parser state between calls. For + * each input stream, you should set up a separate + * state variable and initialize it to dbg_null. + * Pass a pointer to it into this function with each + * character in the input stream. See dbg_test() + * for an example. + * c - The "current" character in the input stream. + * + * Output: A token. + * The token value will change when delimiters are found, + * which indicate a transition between syntactical objects. + * Possible return values are: + * + * dbg_null - The input character was an end-of-line. + * This resets the parser to its initial state + * in preparation for parsing the next line. + * dbg_eof - Same as dbg_null, except that the character + * was an end-of-file. + * dbg_ignore - Returned for whitespace and delimiters. + * These lexical tokens are only of interest + * to the parser. + * dbg_header - Indicates the start of a header line. The + * input character was '[' and was the first on + * the line. + * dbg_timestamp - Indicates that the input character was part + * of a header timestamp. + * dbg_level - Indicates that the input character was part + * of the debug-level value in the header. + * dbg_sourcefile - Indicates that the input character was part + * of the sourcefile name in the header. + * dbg_function - Indicates that the input character was part + * of the function name in the header. + * dbg_lineno - Indicates that the input character was part + * of the DEBUG call line number in the header. + * dbg_message - Indicates that the input character was part + * of the DEBUG message text. + * + * ------------------------------------------------------------------------ ** + */ + + +/* -------------------------------------------------------------------------- */ +#endif /* DEBUGPARSE_H */ diff --git a/source3/include/dlinklist.h b/source3/include/dlinklist.h new file mode 100644 index 0000000000..1a4ebb6fa0 --- /dev/null +++ b/source3/include/dlinklist.h @@ -0,0 +1,113 @@ +/* + Unix SMB/CIFS implementation. + some simple double linked list macros + Copyright (C) Andrew Tridgell 1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* To use these macros you must have a structure containing a next and + prev pointer */ + +#ifndef _DLINKLIST_H +#define _DLINKLIST_H + + +/* hook into the front of the list */ +#define DLIST_ADD(list, p) \ +do { \ + if (!(list)) { \ + (list) = (p); \ + (p)->next = (p)->prev = NULL; \ + } else { \ + (list)->prev = (p); \ + (p)->next = (list); \ + (p)->prev = NULL; \ + (list) = (p); \ + }\ +} while (0) + +/* remove an element from a list - element doesn't have to be in list. */ +#define DLIST_REMOVE(list, p) \ +do { \ + if ((p) == (list)) { \ + (list) = (p)->next; \ + if (list) (list)->prev = NULL; \ + } else { \ + if ((p)->prev) (p)->prev->next = (p)->next; \ + if ((p)->next) (p)->next->prev = (p)->prev; \ + } \ + if ((p) != (list)) (p)->next = (p)->prev = NULL; \ +} while (0) + +/* promote an element to the top of the list */ +#define DLIST_PROMOTE(list, p) \ +do { \ + DLIST_REMOVE(list, p); \ + DLIST_ADD(list, p); \ +} while (0) + +/* hook into the end of the list - needs the entry type */ +#define DLIST_ADD_END(list, p, type) \ +do { \ + if (!(list)) { \ + (list) = (p); \ + (p)->next = (p)->prev = NULL; \ + } else { \ + type tmp; \ + for (tmp = (list); tmp->next; tmp = tmp->next) ; \ + tmp->next = (p); \ + (p)->next = NULL; \ + (p)->prev = tmp; \ + } \ +} while (0) + +/* insert 'p' after the given element 'el' in a list. If el is NULL then + this is the same as a DLIST_ADD() */ +#define DLIST_ADD_AFTER(list, p, el) \ +do { \ + if (!(list) || !(el)) { \ + DLIST_ADD(list, p); \ + } else { \ + p->prev = el; \ + p->next = el->next; \ + el->next = p; \ + if (p->next) p->next->prev = p; \ + }\ +} while (0) + +/* demote an element to the end of the list, needs a tmp pointer */ +#define DLIST_DEMOTE(list, p, tmp) \ +do { \ + DLIST_REMOVE(list, p); \ + DLIST_ADD_END(list, p, tmp); \ +} while (0) + +/* concatenate two lists - putting all elements of the 2nd list at the + end of the first list */ +#define DLIST_CONCATENATE(list1, list2, type) \ +do { \ + if (!(list1)) { \ + (list1) = (list2); \ + } else { \ + type tmp; \ + for (tmp = (list1); tmp->next; tmp = tmp->next) ; \ + tmp->next = (list2); \ + if (list2) { \ + (list2)->prev = tmp; \ + } \ + } \ +} while (0) + +#endif /* _DLINKLIST_H */ diff --git a/source3/include/doserr.h b/source3/include/doserr.h new file mode 100644 index 0000000000..5d3b866d01 --- /dev/null +++ b/source3/include/doserr.h @@ -0,0 +1,303 @@ +/* + Unix SMB/CIFS implementation. + DOS error code constants + Copyright (C) Andrew Tridgell 1992-2000 + Copyright (C) John H Terpstra 1996-2000 + Copyright (C) Luke Kenneth Casson Leighton 1996-2000 + Copyright (C) Paul Ashton 1998-2000 + Copyright (C) Gerald (Jerry) Carter 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _DOSERR_H +#define _DOSERR_H + +/* Error classes */ + +#define ERRDOS 0x01 /* Error is from the core DOS operating system set. */ +#define ERRSRV 0x02 /* Error is generated by the server network file manager.*/ +#define ERRHRD 0x03 /* Error is an hardware error. */ +#define ERRCMD 0xFF /* Command was not in the "SMB" format. */ + +/* SMB X/Open error codes for the ERRDOS error class */ +#define ERRsuccess 0 /* No error */ +#define ERRbadfunc 1 /* Invalid function (or system call) */ +#define ERRbadfile 2 /* File not found (pathname error) */ +#define ERRbadpath 3 /* Directory not found */ +#define ERRnofids 4 /* Too many open files */ +#define ERRnoaccess 5 /* Access denied */ +#define ERRbadfid 6 /* Invalid fid */ +#define ERRbadmcb 7 /* Memory control blocks destroyed. */ +#define ERRnomem 8 /* Out of memory */ +#define ERRbadmem 9 /* Invalid memory block address */ +#define ERRbadenv 10 /* Invalid environment */ +#define ERRbadformat 11 /* Bad Format */ +#define ERRbadaccess 12 /* Invalid open mode */ +#define ERRbaddata 13 /* Invalid data (only from ioctl call) */ +#define ERRres 14 /* reserved */ +#define ERRbaddrive 15 /* Invalid drive */ +#define ERRremcd 16 /* Attempt to delete current directory */ +#define ERRdiffdevice 17 /* rename/move across different filesystems */ +#define ERRnofiles 18 /* no more files found in file search */ +#define ERRgeneral 31 /* General failure */ +#define ERRbadshare 32 /* Share mode on file conflict with open mode */ +#define ERRlock 33 /* Lock request conflicts with existing lock */ +#define ERRunsup 50 /* Request unsupported, returned by Win 95, RJS 20Jun98 */ +#define ERRnetnamedel 64 /* Network name deleted or not available */ +#define ERRnosuchshare 67 /* You specified an invalid share name */ +#define ERRfilexists 80 /* File in operation already exists */ +#define ERRinvalidparam 87 +#define ERRcannotopen 110 /* Cannot open the file specified */ +#define ERRbufferoverflow 111 +#define ERRinsufficientbuffer 122 +#define ERRinvalidname 123 /* Invalid name */ +#define ERRunknownlevel 124 +#define ERRnotlocked 158 /* This region is not locked by this locking context. */ +#define ERRinvalidpath 161 +#define ERRcancelviolation 173 +#define ERRnoatomiclocks 174 +#define ERRrename 183 +#define ERRbadpipe 230 /* Named pipe invalid */ +#define ERRpipebusy 231 /* All instances of pipe are busy */ +#define ERRpipeclosing 232 /* named pipe close in progress */ +#define ERRnotconnected 233 /* No process on other end of named pipe */ +#define ERRmoredata 234 /* More data to be returned */ +#define ERReainconsistent 255 /* from EMC */ +#define ERRnomoreitems 259 +#define ERRbaddirectory 267 /* Invalid directory name in a path. */ +#define ERReasnotsupported 282 /* Extended attributes */ +#define ERRlogonfailure 1326 /* Unknown username or bad password */ +#define ERRbuftoosmall 2123 +#define ERRunknownipc 2142 +#define ERRnosuchprintjob 2151 +#define ERRinvgroup 2455 + +/* here's a special one from observing NT */ +#define ERRnoipc 66 /* don't support ipc */ + +/* These errors seem to be only returned by the NT printer driver system */ +#define ERRdriveralreadyinstalled 1795 /* ERROR_PRINTER_DRIVER_ALREADY_INSTALLED */ +#define ERRunknownprinterport 1796 /* ERROR_UNKNOWN_PORT */ +#define ERRunknownprinterdriver 1797 /* ERROR_UNKNOWN_PRINTER_DRIVER */ +#define ERRunknownprintprocessor 1798 /* ERROR_UNKNOWN_PRINTPROCESSOR */ +#define ERRinvalidseparatorfile 1799 /* ERROR_INVALID_SEPARATOR_FILE */ +#define ERRinvalidjobpriority 1800 /* ERROR_INVALID_PRIORITY */ +#define ERRinvalidprintername 1801 /* ERROR_INVALID_PRINTER_NAME */ +#define ERRprinteralreadyexists 1802 /* ERROR_PRINTER_ALREADY_EXISTS */ +#define ERRinvalidprintercommand 1803 /* ERROR_INVALID_PRINTER_COMMAND */ +#define ERRinvaliddatatype 1804 /* ERROR_INVALID_DATATYPE */ +#define ERRinvalidenvironment 1805 /* ERROR_INVALID_ENVIRONMENT */ + +#define ERRunknownprintmonitor 3000 /* ERROR_UNKNOWN_PRINT_MONITOR */ +#define ERRprinterdriverinuse 3001 /* ERROR_PRINTER_DRIVER_IN_USE */ +#define ERRspoolfilenotfound 3002 /* ERROR_SPOOL_FILE_NOT_FOUND */ +#define ERRnostartdoc 3003 /* ERROR_SPL_NO_STARTDOC */ +#define ERRnoaddjob 3004 /* ERROR_SPL_NO_ADDJOB */ +#define ERRprintprocessoralreadyinstalled 3005 /* ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED */ +#define ERRprintmonitoralreadyinstalled 3006 /* ERROR_PRINT_MONITOR_ALREADY_INSTALLED */ +#define ERRinvalidprintmonitor 3007 /* ERROR_INVALID_PRINT_MONITOR */ +#define ERRprintmonitorinuse 3008 /* ERROR_PRINT_MONITOR_IN_USE */ +#define ERRprinterhasjobsqueued 3009 /* ERROR_PRINTER_HAS_JOBS_QUEUED */ + +/* Error codes for the ERRSRV class */ + +#define ERRerror 1 /* Non specific error code */ +#define ERRbadpw 2 /* Bad password */ +#define ERRbadtype 3 /* reserved */ +#define ERRaccess 4 /* No permissions to do the requested operation */ +#define ERRinvnid 5 /* tid invalid */ +#define ERRinvnetname 6 /* Invalid servername */ +#define ERRinvdevice 7 /* Invalid device */ +#define ERRqfull 49 /* Print queue full */ +#define ERRqtoobig 50 /* Queued item too big */ +#define ERRinvpfid 52 /* Invalid print file in smb_fid */ +#define ERRsmbcmd 64 /* Unrecognised command */ +#define ERRsrverror 65 /* smb server internal error */ +#define ERRfilespecs 67 /* fid and pathname invalid combination */ +#define ERRbadlink 68 /* reserved */ +#define ERRbadpermits 69 /* Access specified for a file is not valid */ +#define ERRbadpid 70 /* reserved */ +#define ERRsetattrmode 71 /* attribute mode invalid */ +#define ERRpaused 81 /* Message server paused */ +#define ERRmsgoff 82 /* Not receiving messages */ +#define ERRnoroom 83 /* No room for message */ +#define ERRrmuns 87 /* too many remote usernames */ +#define ERRtimeout 88 /* operation timed out */ +#define ERRnoresource 89 /* No resources currently available for request. */ +#define ERRtoomanyuids 90 /* too many userids */ +#define ERRbaduid 91 /* bad userid */ +#define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */ +#define ERRuseSTD 251 /* temporarily unable to use raw mode, use standard mode */ +#define ERRcontMPX 252 /* resume MPX mode */ +#define ERRbadPW /* reserved */ +#define ERRnosupport 0xFFFF +#define ERRunknownsmb 22 /* from NT 3.5 response */ + +/* Error codes for the ERRHRD class */ + +#define ERRnowrite 19 /* read only media */ +#define ERRbadunit 20 /* Unknown device */ +#define ERRnotready 21 /* Drive not ready */ +#define ERRbadcmd 22 /* Unknown command */ +#define ERRdata 23 /* Data (CRC) error */ +#define ERRbadreq 24 /* Bad request structure length */ +#define ERRseek 25 +#define ERRbadmedia 26 +#define ERRbadsector 27 +#define ERRnopaper 28 +#define ERRwrite 29 /* write fault */ +#define ERRread 30 /* read fault */ +#define ERRgeneral 31 /* General hardware failure */ +#define ERRwrongdisk 34 +#define ERRFCBunavail 35 +#define ERRsharebufexc 36 /* share buffer exceeded */ +#define ERRdiskfull 39 + + +/* these are win32 error codes. There are only a few places where + these matter for Samba, primarily in the NT printing code */ +#define WERR_OK W_ERROR(0) +#define WERR_BADFUNC W_ERROR(1) +#define WERR_BADFILE W_ERROR(2) +#define WERR_ACCESS_DENIED W_ERROR(5) +#define WERR_BADFID W_ERROR(6) +#define WERR_NOMEM W_ERROR(8) +#define WERR_GENERAL_FAILURE W_ERROR(31) +#define WERR_NOT_SUPPORTED W_ERROR(50) +#define WERR_DEVICE_NOT_EXIST W_ERROR(55) +#define WERR_PRINTQ_FULL W_ERROR(61) +#define WERR_NO_SPOOL_SPACE W_ERROR(62) +#define WERR_NO_SUCH_SHARE W_ERROR(67) +#define WERR_ALREADY_EXISTS W_ERROR(80) +#define WERR_BAD_PASSWORD W_ERROR(86) +#define WERR_INVALID_PARAM W_ERROR(87) +#define WERR_SEM_TIMEOUT W_ERROR(121) +#define WERR_INSUFFICIENT_BUFFER W_ERROR(122) +#define WERR_INVALID_NAME W_ERROR(123) +#define WERR_UNKNOWN_LEVEL W_ERROR(124) +#define WERR_OBJECT_PATH_INVALID W_ERROR(161) +#define WERR_NO_MORE_ITEMS W_ERROR(259) +#define WERR_MORE_DATA W_ERROR(234) +#define WERR_INVALID_OWNER W_ERROR(1307) +#define WERR_IO_PENDING W_ERROR(997) +#define WERR_CAN_NOT_COMPLETE W_ERROR(1003) +#define WERR_INVALID_FLAGS W_ERROR(1004) +#define WERR_REG_CORRUPT W_ERROR(1015) +#define WERR_REG_IO_FAILURE W_ERROR(1016) +#define WERR_REG_FILE_INVALID W_ERROR(1017) +#define WERR_NO_SUCH_SERVICE W_ERROR(1060) +#define WERR_INVALID_SERVICE_CONTROL W_ERROR(1052) +#define WERR_SERVICE_ALREADY_RUNNING W_ERROR(1056) +#define WERR_SERVICE_DISABLED W_ERROR(1058) +#define WERR_SERVICE_NEVER_STARTED W_ERROR(1077) +#define WERR_NOT_FOUND W_ERROR(1168) +#define WERR_INVALID_COMPUTER_NAME W_ERROR(1210) +#define WERR_INVALID_DOMAINNAME W_ERROR(1212) +#define WERR_MACHINE_LOCKED W_ERROR(1271) +#define WERR_REVISION_MISMATCH W_ERROR(1306) +#define WERR_NO_LOGON_SERVERS W_ERROR(1311) +#define WERR_NO_SUCH_LOGON_SESSION W_ERROR(1312) +#define WERR_USER_ALREADY_EXISTS W_ERROR(1316) +#define WERR_NO_SUCH_USER W_ERROR(1317) +#define WERR_GROUP_EXISTS W_ERROR(1318) +#define WERR_MEMBER_IN_GROUP W_ERROR(1320) +#define WERR_USER_NOT_IN_GROUP W_ERROR(1321) +#define WERR_WRONG_PASSWORD W_ERROR(1323) +#define WERR_PASSWORD_RESTRICTION W_ERROR(1325) +#define WERR_LOGON_FAILURE W_ERROR(1326) +#define WERR_NO_SUCH_DOMAIN W_ERROR(1355) +#define WERR_NONE_MAPPED W_ERROR(1332) +#define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338) +#define WERR_INVALID_DOMAIN_STATE W_ERROR(1353) +#define WERR_INVALID_DOMAIN_ROLE W_ERROR(1354) +#define WERR_SPECIAL_ACCOUNT W_ERROR(1371) +#define WERR_NO_SUCH_ALIAS W_ERROR(1376) +#define WERR_MEMBER_IN_ALIAS W_ERROR(1378) +#define WERR_ALIAS_EXISTS W_ERROR(1379) +#define WERR_TIME_SKEW W_ERROR(1398) +#define WERR_EVENTLOG_FILE_CORRUPT W_ERROR(1500) +#define WERR_SERVER_UNAVAILABLE W_ERROR(1722) +#define WERR_INVALID_FORM_NAME W_ERROR(1902) +#define WERR_INVALID_FORM_SIZE W_ERROR(1903) +#define WERR_PASSWORD_MUST_CHANGE W_ERROR(1907) +#define WERR_DOMAIN_CONTROLLER_NOT_FOUND W_ERROR(1908) +#define WERR_ACCOUNT_LOCKED_OUT W_ERROR(1909) + +#define WERR_DEVICE_NOT_AVAILABLE W_ERROR(4319) +#define WERR_STATUS_MORE_ENTRIES W_ERROR(0x0105) + +#define WERR_DS_DRA_BAD_DN W_ERROR(8439) +#define WERR_DS_DRA_BAD_NC W_ERROR(8440) + +#define WERR_PRINTER_DRIVER_ALREADY_INSTALLED W_ERROR(ERRdriveralreadyinstalled) +#define WERR_UNKNOWN_PORT W_ERROR(ERRunknownprinterport) +#define WERR_UNKNOWN_PRINTER_DRIVER W_ERROR(ERRunknownprinterdriver) +#define WERR_UNKNOWN_PRINTPROCESSOR W_ERROR(ERRunknownprintprocessor) +#define WERR_INVALID_SEPARATOR_FILE W_ERROR(ERRinvalidseparatorfile) +#define WERR_INVALID_PRIORITY W_ERROR(ERRinvalidjobpriority) +#define WERR_INVALID_PRINTER_NAME W_ERROR(ERRinvalidprintername) +#define WERR_PRINTER_ALREADY_EXISTS W_ERROR(ERRprinteralreadyexists) +#define WERR_INVALID_PRINTER_COMMAND W_ERROR(ERRinvalidprintercommand) +#define WERR_INVALID_DATATYPE W_ERROR(ERRinvaliddatatype) +#define WERR_INVALID_ENVIRONMENT W_ERROR(ERRinvalidenvironment) + +#define WERR_UNKNOWN_PRINT_MONITOR W_ERROR(ERRunknownprintmonitor) +#define WERR_PRINTER_DRIVER_IN_USE W_ERROR(ERRprinterdriverinuse) +#define WERR_SPOOL_FILE_NOT_FOUND W_ERROR(ERRspoolfilenotfound) +#define WERR_SPL_NO_STARTDOC W_ERROR(ERRnostartdoc) +#define WERR_SPL_NO_ADDJOB W_ERROR(ERRnoaddjob) +#define WERR_PRINT_PROCESSOR_ALREADY_INSTALLED W_ERROR(ERRprintprocessoralreadyinstalled) +#define WERR_PRINT_MONITOR_ALREADY_INSTALLED W_ERROR(ERRprintmonitoralreadyinstalled) +#define WERR_INVALID_PRINT_MONITOR W_ERROR(ERRinvalidprintmonitor) +#define WERR_PRINT_MONITOR_IN_USE W_ERROR(ERRprintmonitorinuse) +#define WERR_PRINTER_HAS_JOBS_QUEUED W_ERROR(ERRprinterhasjobsqueued) + +/* Configuration Manager Errors */ +/* Basically Win32 errors meanings are specific to the \ntsvcs pipe */ + +#define WERR_CM_NO_MORE_HW_PROFILES W_ERROR(35) +#define WERR_CM_NO_SUCH_VALUE W_ERROR(37) + + +/* DFS errors */ + +#ifndef NERR_BASE +#define NERR_BASE (2100) +#endif + +#ifndef MAX_NERR +#define MAX_NERR (NERR_BASE+899) +#endif + +#define WERR_BUF_TOO_SMALL W_ERROR(NERR_BASE+23) +#define WERR_JOB_NOT_FOUND W_ERROR(NERR_BASE+51) +#define WERR_DEST_NOT_FOUND W_ERROR(NERR_BASE+52) +#define WERR_GROUP_NOT_FOUND W_ERROR(NERR_BASE+120) +#define WERR_USER_NOT_FOUND W_ERROR(NERR_BASE+121) +#define WERR_USER_EXISTS W_ERROR(NERR_BASE+124) +#define WERR_NET_NAME_NOT_FOUND W_ERROR(NERR_BASE+210) +#define WERR_NOT_LOCAL_DOMAIN W_ERROR(NERR_BASE+220) +#define WERR_DC_NOT_FOUND W_ERROR(NERR_BASE+353) +#define WERR_DFS_NO_SUCH_VOL W_ERROR(NERR_BASE+562) +#define WERR_DFS_NO_SUCH_SHARE W_ERROR(NERR_BASE+565) +#define WERR_DFS_NO_SUCH_SERVER W_ERROR(NERR_BASE+573) +#define WERR_DFS_INTERNAL_ERROR W_ERROR(NERR_BASE+590) +#define WERR_DFS_CANT_CREATE_JUNCT W_ERROR(NERR_BASE+569) +#define WERR_SETUP_ALREADY_JOINED W_ERROR(NERR_BASE+591) +#define WERR_SETUP_NOT_JOINED W_ERROR(NERR_BASE+592) +#define WERR_SETUP_DOMAIN_CONTROLLER W_ERROR(NERR_BASE+593) +#define WERR_DEFAULT_JOIN_REQUIRED W_ERROR(NERR_BASE+594) + +#endif /* _DOSERR_H */ diff --git a/source3/include/dynconfig.h b/source3/include/dynconfig.h new file mode 100644 index 0000000000..758bde33cc --- /dev/null +++ b/source3/include/dynconfig.h @@ -0,0 +1,89 @@ +/* + Unix SMB/CIFS implementation. + Copyright (C) 2001 by Martin Pool <mbp@samba.org> + Copyright (C) 2003 by Jim McDonough <jmcd@us.ibm.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/** + * @file dynconfig.h + * + * @brief Exported global configurations. + **/ + +const char *get_dyn_SBINDIR(void); +const char *set_dyn_SBINDIR(const char *newpath); +bool is_default_dyn_SBINDIR(void); + +const char *get_dyn_BINDIR(void); +const char *set_dyn_BINDIR(const char *newpath); +bool is_default_dyn_BINDIR(void); + +const char *get_dyn_SWATDIR(void); +const char *set_dyn_SWATDIR(const char *newpath); +bool is_default_dyn_SWATDIR(void); + +const char *get_dyn_CONFIGFILE(void); +const char *set_dyn_CONFIGFILE(const char *newpath); +bool is_default_dyn_CONFIGFILE(void); + +const char *get_dyn_LOGFILEBASE(void); +const char *set_dyn_LOGFILEBASE(const char *newpath); +bool is_default_dyn_LOGFILEBASE(void); + +const char *get_dyn_LMHOSTSFILE(void); +const char *set_dyn_LMHOSTSFILE(const char *newpath); +bool is_default_dyn_LMHOSTSFILE(void); + +const char *get_dyn_CODEPAGEDIR(void); +const char *set_dyn_CODEPAGEDIR(const char *newpath); +bool is_default_dyn_CODEPAGEDIR(void); + +const char *get_dyn_LIBDIR(void); +const char *set_dyn_LIBDIR(const char *newpath); +bool is_default_dyn_LIBDIR(void); + +const char *get_dyn_MODULESDIR(void); +const char *set_dyn_MODULESDIR(const char *newpath); +bool is_default_dyn_MODULESDIR(void); + +const char *get_dyn_SHLIBEXT(void); +const char *set_dyn_SHLIBEXT(const char *newpath); +bool is_default_dyn_SHLIBEXT(void); + +const char *get_dyn_LOCKDIR(void); +const char *set_dyn_LOCKDIR(const char *newpath); +bool is_default_dyn_LOCKDIR(void); + +const char *get_dyn_PIDDIR(void); +const char *set_dyn_PIDDIR(const char *newpath); +bool is_default_dyn_PIDDIR(void); + +const char *get_dyn_SMB_PASSWD_FILE(void); +const char *set_dyn_SMB_PASSWD_FILE(const char *newpath); +bool is_default_dyn_SMB_PASSWD_FILE(void); + +const char *get_dyn_PRIVATE_DIR(void); +const char *set_dyn_PRIVATE_DIR(const char *newpath); +bool is_default_dyn_PRIVATE_DIR(void); + +/* + * For STATEDIR and CACHEDIR, there are only getter functions. + * In non-FHS-mode, these are configurable via LOCKDIR. + * In FHS-mode, these are their own fixed directories. + */ +const char *get_dyn_STATEDIR(void); + +const char *get_dyn_CACHEDIR(void); diff --git a/source3/include/event.h b/source3/include/event.h new file mode 100644 index 0000000000..0465fae471 --- /dev/null +++ b/source3/include/event.h @@ -0,0 +1,24 @@ +/* + Unix SMB/CIFS implementation. + event handling + Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Volker Lendecke 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* bits for file descriptor event flags */ +#define EVENT_FD_READ 1 +#define EVENT_FD_WRITE 2 + diff --git a/source3/include/fake_file.h b/source3/include/fake_file.h new file mode 100644 index 0000000000..93da106030 --- /dev/null +++ b/source3/include/fake_file.h @@ -0,0 +1,39 @@ +/* + Unix SMB/CIFS implementation. + FAKE FILE suppport, for faking up special files windows want access to + Copyright (C) Stefan (metze) Metzmacher 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _FAKE_FILE_H +#define _FAKE_FILE_H + +enum FAKE_FILE_TYPE { + FAKE_FILE_TYPE_NONE = 0, + FAKE_FILE_TYPE_QUOTA +}; + +/* +we now get the unix name --metze +*/ +#define FAKE_FILE_NAME_QUOTA_WIN32 "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION" +#define FAKE_FILE_NAME_QUOTA_UNIX "$Extend/$Quota:$Q:$INDEX_ALLOCATION" + +struct fake_file_handle { + enum FAKE_FILE_TYPE type; + void *private_data; +}; + +#endif /* _FAKE_FILE_H */ diff --git a/source3/include/gpo.h b/source3/include/gpo.h new file mode 100644 index 0000000000..bf5ff6a598 --- /dev/null +++ b/source3/include/gpo.h @@ -0,0 +1,158 @@ +/* + * Unix SMB/CIFS implementation. + * Group Policy Object Support + * Copyright (C) Guenther Deschner 2005-2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +enum GPO_LINK_TYPE { + GP_LINK_UNKOWN = 0, + GP_LINK_MACHINE = 1, + GP_LINK_SITE = 2, + GP_LINK_DOMAIN = 3, + GP_LINK_OU = 4, + GP_LINK_LOCAL = 5 /* for convenience */ +}; + +/* GPO_OPTIONS */ +#define GPO_FLAG_DISABLE 0x00000001 +#define GPO_FLAG_FORCE 0x00000002 + +/* GPO_LIST_FLAGS */ +#define GPO_LIST_FLAG_MACHINE 0x00000001 +#define GPO_LIST_FLAG_SITEONLY 0x00000002 + +/* following flags from http://support.microsoft.com/kb/312164/EN-US/ */ +#define GPO_INFO_FLAG_MACHINE 0x00000001 +#define GPO_INFO_FLAG_BACKGROUND 0x00000010 +#define GPO_INFO_FLAG_SLOWLINK 0x00000020 +#define GPO_INFO_FLAG_VERBOSE 0x00000040 +#define GPO_INFO_FLAG_NOCHANGES 0x00000080 +#define GPO_INFO_FLAG_LINKTRANSITION 0x00000100 +#define GPO_INFO_FLAG_LOGRSOP_TRANSITION 0x00000200 +#define GPO_INFO_FLAG_FORCED_REFRESH 0x00000400 +#define GPO_INFO_FLAG_SAFEMODE_BOOT 0x00000800 + +#define GPO_VERSION_USER(x) (x >> 16) +#define GPO_VERSION_MACHINE(x) (x & 0xffff) + +struct GROUP_POLICY_OBJECT { + uint32_t options; /* GPFLAGS_* */ + uint32_t version; + const char *ds_path; + const char *file_sys_path; + const char *display_name; + const char *name; + const char *link; + enum GPO_LINK_TYPE link_type; + const char *user_extensions; + const char *machine_extensions; + SEC_DESC *security_descriptor; + struct GROUP_POLICY_OBJECT *next, *prev; +}; + +/* the following is seen on the DS (see adssearch.pl for details) */ + +/* the type field in a 'gPLink', the same as GPO_FLAG ? */ +#define GPO_LINK_OPT_NONE 0x00000000 +#define GPO_LINK_OPT_DISABLED 0x00000001 +#define GPO_LINK_OPT_ENFORCED 0x00000002 + +/* GPO_LINK_OPT_ENFORCED takes precedence over GPOPTIONS_BLOCK_INHERITANCE */ + +/* 'gPOptions', maybe a bitmask as well */ +enum GPO_INHERIT { + GPOPTIONS_INHERIT = 0, + GPOPTIONS_BLOCK_INHERITANCE = 1 +}; + +/* 'flags' in a 'groupPolicyContainer' object */ +#define GPFLAGS_ALL_ENABLED 0x00000000 +#define GPFLAGS_USER_SETTINGS_DISABLED 0x00000001 +#define GPFLAGS_MACHINE_SETTINGS_DISABLED 0x00000002 +#define GPFLAGS_ALL_DISABLED (GPFLAGS_USER_SETTINGS_DISABLED | \ + GPFLAGS_MACHINE_SETTINGS_DISABLED) + +struct GP_LINK { + const char *gp_link; /* raw link name */ + uint32_t gp_opts; /* inheritance options GPO_INHERIT */ + uint32_t num_links; /* number of links */ + char **link_names; /* array of parsed link names */ + uint32_t *link_opts; /* array of parsed link opts GPO_LINK_OPT_* */ +}; + +struct GP_EXT { + const char *gp_extension; /* raw extension name */ + uint32_t num_exts; + char **extensions; + char **extensions_guid; + char **snapins; + char **snapins_guid; + struct GP_EXT *next, *prev; +}; + +#define GPO_CACHE_DIR "gpo_cache" +#define GPT_INI "GPT.INI" +#define GPO_REFRESH_INTERVAL 60*90 + +#define GPO_REG_STATE_MACHINE "State\\Machine" + +enum gp_reg_action { + GP_REG_ACTION_NONE = 0, + GP_REG_ACTION_ADD_VALUE = 1, + GP_REG_ACTION_ADD_KEY = 2, + GP_REG_ACTION_DEL_VALUES = 3, + GP_REG_ACTION_DEL_VALUE = 4, + GP_REG_ACTION_DEL_ALL_VALUES = 5, + GP_REG_ACTION_DEL_KEYS = 6, + GP_REG_ACTION_SEC_KEY_SET = 7, + GP_REG_ACTION_SEC_KEY_RESET = 8 +}; + +struct gp_registry_entry { + enum gp_reg_action action; + const char *key; + const char *value; + struct registry_value *data; +}; + +struct gp_registry_value { + const char *value; + struct registry_value *data; +}; + +struct gp_registry_entry2 { + enum gp_reg_action action; + const char *key; + size_t num_values; + struct gp_registry_value **values; +}; + +struct gp_registry_entries { + size_t num_entries; + struct gp_registry_entry **entries; +}; + +struct gp_registry_context { + const struct nt_user_token *token; + const char *path; + struct registry_key *curr_key; +}; + +#define GP_EXT_GUID_SECURITY "827D319E-6EAC-11D2-A4EA-00C04F79F83A" +#define GP_EXT_GUID_REGISTRY "35378EAC-683F-11D2-A89A-00C04FBBCFA2" +#define GP_EXT_GUID_SCRIPTS "42B5FAAE-6536-11D2-AE5A-0000F87571E3" + +#include "libgpo/gpext/gpext.h" diff --git a/source3/include/hmacmd5.h b/source3/include/hmacmd5.h new file mode 100644 index 0000000000..ae588fb889 --- /dev/null +++ b/source3/include/hmacmd5.h @@ -0,0 +1,29 @@ +/* + Unix SMB/CIFS implementation. + Interface header: Scheduler service + Copyright (C) Luke Kenneth Casson Leighton 1996-1999 + Copyright (C) Andrew Tridgell 1992-1999 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _HMAC_MD5_H + +typedef struct { + struct MD5Context ctx; + unsigned char k_ipad[65]; + unsigned char k_opad[65]; +} HMACMD5Context; + +#endif /* _HMAC_MD5_H */ diff --git a/source3/include/idmap.h b/source3/include/idmap.h new file mode 100644 index 0000000000..95c3e4c0c2 --- /dev/null +++ b/source3/include/idmap.h @@ -0,0 +1,81 @@ +#ifndef _IDMAP_H_ +#define _IDMAP_H_ +/* + Unix SMB/CIFS implementation. + + Idmap headers + + Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 + Copyright (C) Simo Sorce 2003 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* idmap version determines auto-conversion - this is the database + structure version specifier. */ + +#define IDMAP_VERSION 2 + +/* The interface version specifier. + Updated to 3 for enum types by JRA. */ + +/* Updated to 4, completely new interface, SSS */ + +#define SMB_IDMAP_INTERFACE_VERSION 4 + +struct idmap_domain { + const char *name; + struct idmap_methods *methods; + void *private_data; +}; + +/* Filled out by IDMAP backends */ +struct idmap_methods { + + /* Called when backend is first loaded */ + NTSTATUS (*init)(struct idmap_domain *dom, const char *params); + + /* Map an array of uids/gids to SIDs. The caller specifies + the uid/gid and type. Gets back the SID. */ + NTSTATUS (*unixids_to_sids)(struct idmap_domain *dom, struct id_map **ids); + + /* Map an arry of SIDs to uids/gids. The caller sets the SID + and type and gets back a uid or gid. */ + NTSTATUS (*sids_to_unixids)(struct idmap_domain *dom, struct id_map **ids); + + NTSTATUS (*set_mapping)(struct idmap_domain *dom, const struct id_map *map); + NTSTATUS (*remove_mapping)(struct idmap_domain *dom, const struct id_map *map); + + /* Called to dump backends data */ + /* NOTE: caller must use talloc_free to free maps when done */ + NTSTATUS (*dump_data)(struct idmap_domain *dom, struct id_map **maps, int *num_maps); + + /* Called when backend is unloaded */ + NTSTATUS (*close_fn)(struct idmap_domain *dom); +}; + +struct idmap_alloc_methods { + + /* Called when backend is first loaded */ + NTSTATUS (*init)(const char *compat_params); + + NTSTATUS (*allocate_id)(struct unixid *id); + NTSTATUS (*get_id_hwm)(struct unixid *id); + NTSTATUS (*set_id_hwm)(struct unixid *id); + + /* Called when backend is unloaded */ + NTSTATUS (*close_fn)(void); +}; + +#endif /* _IDMAP_H_ */ diff --git a/source3/include/includes.h b/source3/include/includes.h new file mode 100644 index 0000000000..9c5ea08f6d --- /dev/null +++ b/source3/include/includes.h @@ -0,0 +1,1320 @@ +#ifndef _INCLUDES_H +#define _INCLUDES_H +/* + Unix SMB/CIFS implementation. + Machine customisation and include handling + Copyright (C) Andrew Tridgell 1994-1998 + Copyright (C) 2002 by Martin Pool <mbp@samba.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* work around broken krb5.h on sles9 */ +#ifdef SIZEOF_LONG +#undef SIZEOF_LONG +#endif + +#include "lib/replace/replace.h" + +/* make sure we have included the correct config.h */ +#ifndef NO_CONFIG_H /* for some tests */ +#ifndef CONFIG_H_IS_FROM_SAMBA +#error "make sure you have removed all config.h files from standalone builds!" +#error "the included config.h isn't from samba!" +#endif +#endif /* NO_CONFIG_H */ + +/* only do the C++ reserved word check when we compile + to include --with-developer since too many systems + still have comflicts with their header files (e.g. IRIX 6.4) */ + +#if !defined(__cplusplus) && defined(DEVELOPER) +#define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define public #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define protected #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define template #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define this #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define new #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define delete #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#define friend #error DONT_USE_CPLUSPLUS_RESERVED_NAMES +#endif + +#include "local.h" + +#ifdef AIX +#define DEFAULT_PRINTING PRINT_AIX +#define PRINTCAP_NAME "/etc/qconfig" +#endif + +#ifdef HPUX +#define DEFAULT_PRINTING PRINT_HPUX +#endif + +#ifdef QNX +#define DEFAULT_PRINTING PRINT_QNX +#endif + +#ifdef SUNOS4 +/* on SUNOS4 termios.h conflicts with sys/ioctl.h */ +#undef HAVE_TERMIOS_H +#endif + +#ifndef _PUBLIC_ +#ifdef HAVE_VISIBILITY_ATTR +# define _PUBLIC_ __attribute__((visibility("default"))) +#else +# define _PUBLIC_ +#endif +#endif + +#if defined(__GNUC__) && !defined(__cplusplus) +/** gcc attribute used on function parameters so that it does not emit + * warnings about them being unused. **/ +# define UNUSED(param) param __attribute__ ((unused)) +#else +# define UNUSED(param) param +/** Feel free to add definitions for other compilers here. */ +#endif + +#ifdef RELIANTUNIX +/* + * <unistd.h> has to be included before any other to get + * large file support on Reliant UNIX. Yes, it's broken :-). + */ +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#endif /* RELIANTUNIX */ + +#include "system/capability.h" +#include "system/dir.h" +#include "system/filesys.h" +#include "system/glob.h" +#include "system/iconv.h" +#include "system/locale.h" +#include "system/network.h" +#include "system/passwd.h" +#include "system/readline.h" +#include "system/select.h" +#include "system/shmem.h" +#include "system/syslog.h" +#include "system/terminal.h" +#include "system/time.h" +#include "system/wait.h" + +#if defined(HAVE_RPC_RPC_H) +/* + * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h. + */ +#if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT) +#undef AUTH_ERROR +#endif +/* + * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which + * was included above. However <rpc/rpc.h> includes <sys/xti.h> which defines + * them again without checking if they already exsist. This generates + * two "Redefinition of macro" warnings for every single .c file that is + * compiled. + */ +#if defined(HPUX) && defined(TCP_NODELAY) +#undef TCP_NODELAY +#endif +#if defined(HPUX) && defined(TCP_MAXSEG) +#undef TCP_MAXSEG +#endif +#include <rpc/rpc.h> +#endif + +#if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT) +#define HAVE_NETGROUP 1 +#endif + +#if defined (HAVE_NETGROUP) +#if defined(HAVE_RPCSVC_YP_PROT_H) +/* + * HP-UX 11.X has TCP_NODELAY and TCP_MAXSEG defined in <netinet/tcp.h> which + * was included above. However <rpc/rpc.h> includes <sys/xti.h> which defines + * them again without checking if they already exsist. This generates + * two "Redefinition of macro" warnings for every single .c file that is + * compiled. + */ +#if defined(HPUX) && defined(TCP_NODELAY) +#undef TCP_NODELAY +#endif +#if defined(HPUX) && defined(TCP_MAXSEG) +#undef TCP_MAXSEG +#endif +#include <rpcsvc/yp_prot.h> +#endif +#if defined(HAVE_RPCSVC_YPCLNT_H) +#include <rpcsvc/ypclnt.h> +#endif +#endif /* HAVE_NETGROUP */ + +#if HAVE_KRB5_H +#include <krb5.h> +#else +#undef HAVE_KRB5 +#endif + +#if HAVE_LBER_H +#include <lber.h> +#if defined(HPUX) && !defined(_LBER_TYPES_H) +/* Define ber_tag_t and ber_int_t for using + * HP LDAP-UX Integration products' LDAP libraries. +*/ +#ifndef ber_tag_t +typedef unsigned long ber_tag_t; +typedef int ber_int_t; +#endif +#endif /* defined(HPUX) && !defined(_LBER_TYPES_H) */ +#ifndef LBER_USE_DER +#define LBER_USE_DER 0x01 +#endif +#endif + +#if HAVE_LDAP_H +#include <ldap.h> +#ifndef LDAP_CONST +#define LDAP_CONST const +#endif +#ifndef LDAP_OPT_SUCCESS +#define LDAP_OPT_SUCCESS 0 +#endif +/* Solaris 8 and maybe other LDAP implementations spell this "..._INPROGRESS": */ +#if defined(LDAP_SASL_BIND_INPROGRESS) && !defined(LDAP_SASL_BIND_IN_PROGRESS) +#define LDAP_SASL_BIND_IN_PROGRESS LDAP_SASL_BIND_INPROGRESS +#endif +/* Solaris 8 defines SSL_LDAP_PORT, not LDAPS_PORT and it only does so if + LDAP_SSL is defined - but SSL is not working. We just want the + port number! Let's just define LDAPS_PORT correct. */ +#if !defined(LDAPS_PORT) +#define LDAPS_PORT 636 +#endif +#else +#undef HAVE_LDAP +#endif + +#if HAVE_GSSAPI_H +#include <gssapi.h> +#elif HAVE_GSSAPI_GSSAPI_H +#include <gssapi/gssapi.h> +#elif HAVE_GSSAPI_GSSAPI_GENERIC_H +#include <gssapi/gssapi_generic.h> +#endif + +#if HAVE_COM_ERR_H +#include <com_err.h> +#endif + +#if HAVE_SYS_ATTRIBUTES_H +#include <sys/attributes.h> +#endif + +#ifndef ENOATTR +#define ENOATTR ENODATA +#endif + +/* mutually exclusive (SuSE 8.2) */ +#if HAVE_ATTR_XATTR_H +#include <attr/xattr.h> +#elif HAVE_SYS_XATTR_H +#include <sys/xattr.h> +#endif + +#ifdef HAVE_SYS_EA_H +#include <sys/ea.h> +#endif + +#ifdef HAVE_SYS_EXTATTR_H +#include <sys/extattr.h> +#endif + +#ifdef HAVE_SYS_UIO_H +#include <sys/uio.h> +#endif + +#if HAVE_LANGINFO_H +#include <langinfo.h> +#endif + +#if HAVE_NETGROUP_H +#include <netgroup.h> +#endif + +#if defined(HAVE_AIO_H) && defined(WITH_AIO) +#include <aio.h> +#endif + +/* skip valgrind headers on 64bit AMD boxes */ +#ifndef HAVE_64BIT_LINUX +/* Special macros that are no-ops except when run under Valgrind on + * x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */ +#if HAVE_VALGRIND_MEMCHECK_H + /* memcheck.h includes valgrind.h */ +#include <valgrind/memcheck.h> +#elif HAVE_VALGRIND_H +#include <valgrind.h> +#endif +#endif + +/* If we have --enable-developer and the valgrind header is present, + * then we're OK to use it. Set a macro so this logic can be done only + * once. */ +#if defined(DEVELOPER) && !defined(HAVE_64BIT_LINUX) +#if (HAVE_VALGRIND_H || HAVE_VALGRIND_VALGRIND_H) +#define VALGRIND +#endif +#endif + + +/* we support ADS if we want it and have krb5 and ldap libs */ +#if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP) +#define HAVE_ADS +#endif + +/* + * Define VOLATILE if needed. + */ + +#if defined(HAVE_VOLATILE) +#define VOLATILE volatile +#else +#define VOLATILE +#endif + +/* + * Define additional missing types + */ +#if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX) +typedef sig_atomic_t SIG_ATOMIC_T; +#elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX) +typedef sig_atomic_t VOLATILE SIG_ATOMIC_T; +#else +typedef int VOLATILE SIG_ATOMIC_T; +#endif + +#ifndef uchar +#define uchar unsigned char +#endif + +#ifdef HAVE_UNSIGNED_CHAR +#define schar signed char +#else +#define schar char +#endif + +/* + Samba needs type definitions for int16, int32, uint16 and uint32. + + Normally these are signed and unsigned 16 and 32 bit integers, but + they actually only need to be at least 16 and 32 bits + respectively. Thus if your word size is 8 bytes just defining them + as signed and unsigned int will work. +*/ + +#ifndef uint8 +#define uint8 unsigned char +#endif + +#if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H) +# if (SIZEOF_SHORT == 4) +# define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16; +# else /* SIZEOF_SHORT != 4 */ +# define int16 short +# endif /* SIZEOF_SHORT != 4 */ + /* needed to work around compile issue on HP-UX 11.x */ +# define _INT16 1 +#endif + +/* + * Note we duplicate the size tests in the unsigned + * case as int16 may be a typedef from rpc/rpc.h + */ + +#if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H) +#if (SIZEOF_SHORT == 4) +#define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16; +#else /* SIZEOF_SHORT != 4 */ +#define uint16 unsigned short +#endif /* SIZEOF_SHORT != 4 */ +#endif + +#if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H) +# if (SIZEOF_INT == 4) +# define int32 int +# elif (SIZEOF_LONG == 4) +# define int32 long +# elif (SIZEOF_SHORT == 4) +# define int32 short +# else + /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */ +# define int32 int +# endif + /* needed to work around compile issue on HP-UX 11.x */ +# define _INT32 1 +#endif + +/* + * Note we duplicate the size tests in the unsigned + * case as int32 may be a typedef from rpc/rpc.h + */ + +#if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H) +#if (SIZEOF_INT == 4) +#define uint32 unsigned int +#elif (SIZEOF_LONG == 4) +#define uint32 unsigned long +#elif (SIZEOF_SHORT == 4) +#define uint32 unsigned short +#else +/* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */ +#define uint32 unsigned +#endif +#endif + +/* + * check for 8 byte long long + */ + +#if !defined(uint64) +#if (SIZEOF_LONG == 8) +#define uint64 unsigned long +#elif (SIZEOF_LONG_LONG == 8) +#define uint64 unsigned long long +#endif /* don't lie. If we don't have it, then don't use it */ +#endif + +#if !defined(int64) +#if (SIZEOF_LONG == 8) +#define int64 long +#elif (SIZEOF_LONG_LONG == 8) +#define int64 long long +#endif /* don't lie. If we don't have it, then don't use it */ +#endif + + +/* + * Types for devices, inodes and offsets. + */ + +#ifndef SMB_DEV_T +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T) +# define SMB_DEV_T dev64_t +# else +# define SMB_DEV_T dev_t +# endif +#endif + +#ifndef LARGE_SMB_DEV_T +# if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)) || (defined(SIZEOF_DEV_T) && (SIZEOF_DEV_T == 8)) +# define LARGE_SMB_DEV_T 1 +# endif +#endif + +#ifdef LARGE_SMB_DEV_T +#define SDEV_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32)) +#define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(((SMB_BIG_UINT)(IVAL((p),(ofs))))| (((SMB_BIG_UINT)(IVAL((p),(ofs)+4))) << 32))) +#else +#define SDEV_T_VAL(p, ofs, v) (SIVAL((p),(ofs),v),SIVAL((p),(ofs)+4,0)) +#define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(IVAL((p),(ofs)))) +#endif + +/* + * Setup the correctly sized inode type. + */ + +#ifndef SMB_INO_T +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T) +# define SMB_INO_T ino64_t +# else +# define SMB_INO_T ino_t +# endif +#endif + +#ifndef LARGE_SMB_INO_T +# if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8)) +# define LARGE_SMB_INO_T 1 +# endif +#endif + +#ifdef LARGE_SMB_INO_T +#define SINO_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32)) +#define INO_T_VAL(p, ofs) ((SMB_INO_T)(((SMB_BIG_UINT)(IVAL(p,ofs)))| (((SMB_BIG_UINT)(IVAL(p,(ofs)+4))) << 32))) +#else +#define SINO_T_VAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0)) +#define INO_T_VAL(p, ofs) ((SMB_INO_T)(IVAL((p),(ofs)))) +#endif + +#ifndef SMB_OFF_T +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) +# define SMB_OFF_T off64_t +# else +# define SMB_OFF_T off_t +# endif +#endif + +#if defined(HAVE_LONGLONG) +#define SMB_BIG_UINT unsigned long long +#define SMB_BIG_INT long long +#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32)) +#else +#define SMB_BIG_UINT unsigned long +#define SMB_BIG_INT long +#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0)) +#endif + +#define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8) + +/* this should really be a 64 bit type if possible */ +#define br_off SMB_BIG_UINT + +#define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8) + +/* + * Set the define that tells us if we can do 64 bit + * NT SMB calls. + */ + +#ifndef LARGE_SMB_OFF_T +# if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8)) +# define LARGE_SMB_OFF_T 1 +# endif +#endif + +#ifdef LARGE_SMB_OFF_T +#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32)) +#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32)) +#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ))) +#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \ + (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) ) +#else +#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0)) +#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0)) +#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF ))) +#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \ + (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) ) +#endif + +/* + * Type for stat structure. + */ + +#ifndef SMB_STRUCT_STAT +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STAT64) && defined(HAVE_OFF64_T) +# define SMB_STRUCT_STAT struct stat64 +# else +# define SMB_STRUCT_STAT struct stat +# endif +#endif + +/* + * Type for dirent structure. + */ + +#ifndef SMB_STRUCT_DIRENT +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64) +# define SMB_STRUCT_DIRENT struct dirent64 +# else +# define SMB_STRUCT_DIRENT struct dirent +# endif +#endif + +/* + * Type for DIR structure. + */ + +#ifndef SMB_STRUCT_DIR +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIR64) +# define SMB_STRUCT_DIR DIR64 +# else +# define SMB_STRUCT_DIR DIR +# endif +#endif + +/* + * Defines for 64 bit fcntl locks. + */ + +#ifndef SMB_STRUCT_FLOCK +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T) +# define SMB_STRUCT_FLOCK struct flock64 +# else +# define SMB_STRUCT_FLOCK struct flock +# endif +#endif + +#ifndef SMB_F_SETLKW +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T) +# define SMB_F_SETLKW F_SETLKW64 +# else +# define SMB_F_SETLKW F_SETLKW +# endif +#endif + +#ifndef SMB_F_SETLK +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T) +# define SMB_F_SETLK F_SETLK64 +# else +# define SMB_F_SETLK F_SETLK +# endif +#endif + +#ifndef SMB_F_GETLK +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T) +# define SMB_F_GETLK F_GETLK64 +# else +# define SMB_F_GETLK F_GETLK +# endif +#endif + +/* + * Type for aiocb structure. + */ + +#ifndef SMB_STRUCT_AIOCB +# if defined(WITH_AIO) +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_AIOCB64) +# define SMB_STRUCT_AIOCB struct aiocb64 +# else +# define SMB_STRUCT_AIOCB struct aiocb +# endif +# else +# define SMB_STRUCT_AIOCB int /* AIO not being used but we still need the define.... */ +# endif +#endif + +#ifndef HAVE_STRUCT_TIMESPEC +struct timespec { + time_t tv_sec; /* Seconds. */ + long tv_nsec; /* Nanoseconds. */ +}; +#endif + +#ifndef MIN +#define MIN(a,b) ((a)<(b)?(a):(b)) +#endif + +#ifndef MAX +#define MAX(a,b) ((a)>(b)?(a):(b)) +#endif + +#ifdef HAVE_BROKEN_GETGROUPS +#define GID_T int +#else +#define GID_T gid_t +#endif + +#ifndef NGROUPS_MAX +#define NGROUPS_MAX 32 /* Guess... */ +#endif + +/* Our own fstrings */ + +/* + -------------- + / \ + / REST \ + / IN \ + / PEACE \ + / \ + | The infamous pstring | + | | + | | + | 7 December | + | | + | 2007 | + *| * * * | * + _________)/\\_//(\/(/\)/\//\/\///|_)_______ +*/ + +#ifndef FSTRING_LEN +#define FSTRING_LEN 256 +typedef char fstring[FSTRING_LEN]; +#endif + +/* Lists, trees, caching, database... */ +#include "xfile.h" +#include "intl.h" +#include "dlinklist.h" +#include "tdb.h" +#include "util_tdb.h" + +#include "lib/talloc/talloc.h" +/* And a little extension. Abort on type mismatch */ +#define talloc_get_type_abort(ptr, type) \ + (type *)talloc_check_name_abort(ptr, #type) + +#include "nt_status.h" +#include "ads.h" +#include "ads_dns.h" +#include "interfaces.h" +#include "trans2.h" +#include "nterr.h" +#include "ntioctl.h" +#include "charset.h" +#include "dynconfig.h" +#include "util_getent.h" +#include "debugparse.h" +#include "version.h" +#include "privileges.h" +#include "messages.h" +#include "locking.h" +#include "smb.h" +#include "nameserv.h" +#include "secrets.h" +#include "byteorder.h" +#include "privileges.h" +#include "rpc_misc.h" +#include "rpc_dce.h" +#include "mapping.h" +#include "passdb.h" +#include "rpc_secdes.h" +#include "gpo.h" +#include "authdata.h" +#include "msdfs.h" +#include "rap.h" +#include "md5.h" +#include "hmacmd5.h" +#include "ntlmssp.h" +#include "auth.h" +#include "ntdomain.h" +#include "rpc_svcctl.h" +#include "rpc_ntsvcs.h" +#include "rpc_lsa.h" +#include "reg_objects.h" +#include "reg_db.h" +#include "rpc_spoolss.h" +#include "rpc_eventlog.h" +#include "rpc_perfcount.h" +#include "rpc_perfcount_defs.h" +#include "librpc/gen_ndr/notify.h" +#include "librpc/gen_ndr/xattr.h" +#include "librpc/gen_ndr/messaging.h" +#include "librpc/rpc/dcerpc.h" +#include "nt_printing.h" +#include "idmap.h" +#include "client.h" + +#include "session.h" +#include "asn_1.h" +#include "popt.h" +#include "mangle.h" +#include "module.h" +#include "nsswitch/winbind_client.h" +#include "spnego.h" +#include "rpc_client.h" +#include "event.h" +#include "dbwrap.h" +#include "packet.h" +#include "ctdbd_conn.h" +#include "talloc_stack.h" +#include "memcache.h" +#include "async_req.h" +#include "async_smb.h" +#include "async_sock.h" + +#include "lib/smbconf/smbconf.h" + +/* Defines for wisXXX functions. */ +#define UNI_UPPER 0x1 +#define UNI_LOWER 0x2 +#define UNI_DIGIT 0x4 +#define UNI_XDIGIT 0x8 +#define UNI_SPACE 0x10 + +#include "nsswitch/winbind_nss.h" + +/* forward declaration from printing.h to get around + header file dependencies */ + +struct printjob; + +/* forward declarations from smbldap.c */ + +#include "smbldap.h" + +#include "smb_ldap.h" + +struct dns_reg_state; + +void dns_register_smbd(struct dns_reg_state ** dns_state_ptr, + unsigned port, + int *maxfd, + fd_set *listen_set, + struct timeval *timeout); + +void dns_register_close(struct dns_reg_state ** dns_state_ptr); + + +bool dns_register_smbd_reply(struct dns_reg_state *dns_state, + fd_set *lfds, struct timeval *timeout); + +/* + * Reasons for cache flush. + */ + +enum flush_reason_enum { + SEEK_FLUSH, + READ_FLUSH, + WRITE_FLUSH, + READRAW_FLUSH, + OPLOCK_RELEASE_FLUSH, + CLOSE_FLUSH, + SYNC_FLUSH, + SIZECHANGE_FLUSH, + /* NUM_FLUSH_REASONS must remain the last value in the enumeration. */ + NUM_FLUSH_REASONS}; + +#include "nss_info.h" +#include "modules/nfs4_acls.h" +#include "nsswitch/libwbclient/wbclient.h" + +/* generated rpc server implementation functions */ +#include "librpc/gen_ndr/srv_echo.h" +#include "librpc/gen_ndr/srv_svcctl.h" +#include "librpc/gen_ndr/srv_lsa.h" +#include "librpc/gen_ndr/srv_eventlog.h" +#include "librpc/gen_ndr/srv_winreg.h" +#include "librpc/gen_ndr/srv_initshutdown.h" + +/***** automatically generated prototypes *****/ +#ifndef NO_PROTO_H +#include "proto.h" +#endif + +#if defined(HAVE_POSIX_ACLS) +#include "modules/vfs_posixacl.h" +#endif + +#if defined(HAVE_TRU64_ACLS) +#include "modules/vfs_tru64acl.h" +#endif + +#if defined(HAVE_SOLARIS_ACLS) || defined(HAVE_UNIXWARE_ACLS) +#include "modules/vfs_solarisacl.h" +#endif + +#if defined(HAVE_HPUX_ACLS) +#include "modules/vfs_hpuxacl.h" +#endif + +#if defined(HAVE_IRIX_ACLS) +#include "modules/vfs_irixacl.h" +#endif + +#ifdef HAVE_LDAP +#include "ads_protos.h" +#endif + +/* We need this after proto.h to reference GetTimeOfDay(). */ +#include "smbprofile.h" + +/* String routines */ + +#include "srvstr.h" +#include "safe_string.h" + +/* prototypes from lib/util_transfer_file.c */ +#include "transfer_file.h" + +#ifdef __COMPAR_FN_T +#define QSORT_CAST (__compar_fn_t) +#endif + +#ifndef QSORT_CAST +#define QSORT_CAST (int (*)(const void *, const void *)) +#endif + +#ifndef DEFAULT_PRINTING +#ifdef HAVE_CUPS +#define DEFAULT_PRINTING PRINT_CUPS +#define PRINTCAP_NAME "cups" +#elif defined(SYSV) +#define DEFAULT_PRINTING PRINT_SYSV +#define PRINTCAP_NAME "lpstat" +#else +#define DEFAULT_PRINTING PRINT_BSD +#define PRINTCAP_NAME "/etc/printcap" +#endif +#endif + +#ifndef PRINTCAP_NAME +#define PRINTCAP_NAME "/etc/printcap" +#endif + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif + +#ifndef SIGRTMIN +#define SIGRTMIN 32 +#endif + +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif + +#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS) +#define OSF1_ENH_SEC 1 +#endif + +#ifndef ALLOW_CHANGE_PASSWORD +#if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID)) +#define ALLOW_CHANGE_PASSWORD 1 +#endif +#endif + +/* what is the longest significant password available on your system? + Knowing this speeds up password searches a lot */ +#ifndef PASSWORD_LENGTH +#define PASSWORD_LENGTH 8 +#endif + +#ifndef HAVE_PIPE +#define SYNC_DNS 1 +#endif + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK 0x7f000001 +#endif + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif + +#ifndef HAVE_CRYPT +#define crypt ufc_crypt +#endif + +#ifndef O_ACCMODE +#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) +#endif + +#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID) +#define ULTRIX_AUTH 1 +#endif + +#if (defined(USE_SETRESUID) && !defined(HAVE_SETRESUID_DECL)) +/* stupid glibc */ +int setresuid(uid_t ruid, uid_t euid, uid_t suid); +#endif +#if (defined(USE_SETRESUID) && !defined(HAVE_SETRESGID_DECL)) +int setresgid(gid_t rgid, gid_t egid, gid_t sgid); +#endif + +/* + * Some older systems seem not to have MAXHOSTNAMELEN + * defined. + */ +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 255 +#endif + +/* yuck, I'd like a better way of doing this */ +#define DIRP_SIZE (256 + 32) + +/* + * glibc on linux doesn't seem to have MSG_WAITALL + * defined. I think the kernel has it though.. + */ + +#ifndef MSG_WAITALL +#define MSG_WAITALL 0 +#endif + +/* default socket options. Dave Miller thinks we should default to TCP_NODELAY + given the socket IO pattern that Samba uses */ +#ifdef TCP_NODELAY +#define DEFAULT_SOCKET_OPTIONS "TCP_NODELAY" +#else +#define DEFAULT_SOCKET_OPTIONS "" +#endif + +/* dmalloc -- free heap debugger (dmalloc.org). This should be near + * the *bottom* of include files so as not to conflict. */ +#ifdef ENABLE_DMALLOC +# include <dmalloc.h> +#endif + + +/* Some POSIX definitions for those without */ + +#ifndef S_IFDIR +#define S_IFDIR 0x4000 +#endif +#ifndef S_ISDIR +#define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR) +#endif +#ifndef S_IRWXU +#define S_IRWXU 00700 /* read, write, execute: owner */ +#endif +#ifndef S_IRUSR +#define S_IRUSR 00400 /* read permission: owner */ +#endif +#ifndef S_IWUSR +#define S_IWUSR 00200 /* write permission: owner */ +#endif +#ifndef S_IXUSR +#define S_IXUSR 00100 /* execute permission: owner */ +#endif +#ifndef S_IRWXG +#define S_IRWXG 00070 /* read, write, execute: group */ +#endif +#ifndef S_IRGRP +#define S_IRGRP 00040 /* read permission: group */ +#endif +#ifndef S_IWGRP +#define S_IWGRP 00020 /* write permission: group */ +#endif +#ifndef S_IXGRP +#define S_IXGRP 00010 /* execute permission: group */ +#endif +#ifndef S_IRWXO +#define S_IRWXO 00007 /* read, write, execute: other */ +#endif +#ifndef S_IROTH +#define S_IROTH 00004 /* read permission: other */ +#endif +#ifndef S_IWOTH +#define S_IWOTH 00002 /* write permission: other */ +#endif +#ifndef S_IXOTH +#define S_IXOTH 00001 /* execute permission: other */ +#endif + +/* For sys_adminlog(). */ +#ifndef LOG_EMERG +#define LOG_EMERG 0 /* system is unusable */ +#endif + +#ifndef LOG_ALERT +#define LOG_ALERT 1 /* action must be taken immediately */ +#endif + +#ifndef LOG_CRIT +#define LOG_CRIT 2 /* critical conditions */ +#endif + +#ifndef LOG_ERR +#define LOG_ERR 3 /* error conditions */ +#endif + +#ifndef LOG_WARNING +#define LOG_WARNING 4 /* warning conditions */ +#endif + +#ifndef LOG_NOTICE +#define LOG_NOTICE 5 /* normal but significant condition */ +#endif + +#ifndef LOG_INFO +#define LOG_INFO 6 /* informational */ +#endif + +#ifndef LOG_DEBUG +#define LOG_DEBUG 7 /* debug-level messages */ +#endif + +#if HAVE_KERNEL_SHARE_MODES +#ifndef LOCK_MAND +#define LOCK_MAND 32 /* This is a mandatory flock */ +#define LOCK_READ 64 /* ... Which allows concurrent read operations */ +#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */ +#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */ +#endif +#endif + +extern int DEBUGLEVEL; + +#define MAX_SEC_CTX_DEPTH 8 /* Maximum number of security contexts */ + + +#ifdef GLIBC_HACK_FCNTL64 +/* this is a gross hack. 64 bit locking is completely screwed up on + i386 Linux in glibc 2.1.95 (which ships with RedHat 7.0). This hack + "fixes" the problem with the current 2.4.0test kernels +*/ +#define fcntl fcntl64 +#undef F_SETLKW +#undef F_SETLK +#define F_SETLK 13 +#define F_SETLKW 14 +#endif + + +/* Needed for sys_dlopen/sys_dlsym/sys_dlclose */ +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif + +#ifndef RTLD_LAZY +#define RTLD_LAZY 0 +#endif + +#ifndef RTLD_NOW +#define RTLD_NOW 0 +#endif + +/* needed for some systems without iconv. Doesn't really matter + what error code we use */ +#ifndef EILSEQ +#define EILSEQ EIO +#endif + +/* add varargs prototypes with printf checking */ +/*PRINTFLIKE2 */ +int fdprintf(int , const char *, ...) PRINTF_ATTRIBUTE(2,3); +/*PRINTFLIKE1 */ +int d_printf(const char *, ...) PRINTF_ATTRIBUTE(1,2); +/*PRINTFLIKE2 */ +int d_fprintf(FILE *f, const char *, ...) PRINTF_ATTRIBUTE(2,3); + +/* PRINTFLIKE2 */ +void sys_adminlog(int priority, const char *format_str, ...) PRINTF_ATTRIBUTE(2,3); + +/* PRINTFLIKE2 */ +int fstr_sprintf(fstring s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); + +int d_vfprintf(FILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0); + +int smb_xvasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0); + +int asprintf_strupper_m(char **strp, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); +char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); + +/* we used to use these fns, but now we have good replacements + for snprintf and vsnprintf */ +#define slprintf snprintf +#define vslprintf vsnprintf + +/* we need to use __va_copy() on some platforms */ +#ifdef HAVE_VA_COPY +#define VA_COPY(dest, src) va_copy(dest, src) +#else +#ifdef HAVE___VA_COPY +#define VA_COPY(dest, src) __va_copy(dest, src) +#else +#define VA_COPY(dest, src) (dest) = (src) +#endif +#endif + +/* + * Veritas File System. Often in addition to native. + * Quotas different. + */ +#if defined(HAVE_SYS_FS_VX_QUOTA_H) +#define VXFS_QUOTA +#endif + +#ifndef XATTR_CREATE +#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ +#endif + +#ifndef XATTR_REPLACE +#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ +#endif + +#if defined(HAVE_KRB5) + +krb5_error_code smb_krb5_parse_name(krb5_context context, + const char *name, /* in unix charset */ + krb5_principal *principal); + +krb5_error_code smb_krb5_unparse_name(krb5_context context, + krb5_const_principal principal, + char **unix_name); + +#ifndef HAVE_KRB5_SET_REAL_TIME +krb5_error_code krb5_set_real_time(krb5_context context, int32_t seconds, int32_t microseconds); +#endif + +krb5_error_code krb5_set_default_tgs_ktypes(krb5_context ctx, const krb5_enctype *enc); + +#if defined(HAVE_KRB5_AUTH_CON_SETKEY) && !defined(HAVE_KRB5_AUTH_CON_SETUSERUSERKEY) +krb5_error_code krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock); +#endif + +#ifndef HAVE_KRB5_FREE_UNPARSED_NAME +void krb5_free_unparsed_name(krb5_context ctx, char *val); +#endif + +/* Stub out initialize_krb5_error_table since it is not present in all + * Kerberos implementations. If it's not present, it's not necessary to + * call it. + */ +#ifndef HAVE_INITIALIZE_KRB5_ERROR_TABLE +#define initialize_krb5_error_table() +#endif + +/* Samba wrapper function for krb5 functionality. */ +bool setup_kaddr( krb5_address *pkaddr, struct sockaddr_storage *paddr); +int create_kerberos_key_from_string(krb5_context context, krb5_principal host_princ, krb5_data *password, krb5_keyblock *key, krb5_enctype enctype, bool no_salt); +bool get_auth_data_from_tkt(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, krb5_ticket *tkt); +krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt); +krb5_error_code smb_krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters); +#if defined(HAVE_KRB5_LOCATE_KDC) +krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters); +#endif +krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes); +bool get_krb5_smb_session_key(krb5_context context, krb5_auth_context auth_context, DATA_BLOB *session_key, bool remote); +krb5_error_code smb_krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *kt_entry); +krb5_principal kerberos_fetch_salt_princ_for_host_princ(krb5_context context, krb5_principal host_princ, int enctype); +void kerberos_set_creds_enctype(krb5_creds *pcreds, int enctype); +bool kerberos_compatible_enctypes(krb5_context context, krb5_enctype enctype1, krb5_enctype enctype2); +void kerberos_free_data_contents(krb5_context context, krb5_data *pdata); +NTSTATUS decode_pac_data(TALLOC_CTX *mem_ctx, + DATA_BLOB *pac_data_blob, + krb5_context context, + krb5_keyblock *service_keyblock, + krb5_const_principal client_principal, + time_t tgs_authtime, + struct PAC_DATA **pac_data_out); +void smb_krb5_checksum_from_pac_sig(krb5_checksum *cksum, + struct PAC_SIGNATURE_DATA *sig); +krb5_error_code smb_krb5_verify_checksum(krb5_context context, + const krb5_keyblock *keyblock, + krb5_keyusage usage, + krb5_checksum *cksum, + uint8 *data, + size_t length); +time_t get_authtime_from_tkt(krb5_ticket *tkt); +void smb_krb5_free_ap_req(krb5_context context, + krb5_ap_req *ap_req); +krb5_error_code smb_krb5_get_keyinfo_from_ap_req(krb5_context context, + const krb5_data *inbuf, + krb5_kvno *kvno, + krb5_enctype *enctype); +krb5_error_code krb5_rd_req_return_keyblock_from_keytab(krb5_context context, + krb5_auth_context *auth_context, + const krb5_data *inbuf, + krb5_const_principal server, + krb5_keytab keytab, + krb5_flags *ap_req_options, + krb5_ticket **ticket, + krb5_keyblock **keyblock); +krb5_error_code smb_krb5_parse_name_norealm(krb5_context context, + const char *name, + krb5_principal *principal); +bool smb_krb5_principal_compare_any_realm(krb5_context context, + krb5_const_principal princ1, + krb5_const_principal princ2); +int cli_krb5_get_ticket(const char *principal, time_t time_offset, + DATA_BLOB *ticket, DATA_BLOB *session_key_krb5, uint32 extra_ap_opts, const char *ccname, time_t *tgs_expire); +krb5_error_code smb_krb5_renew_ticket(const char *ccache_string, const char *client_string, const char *service_string, time_t *expire_time); +krb5_error_code kpasswd_err_to_krb5_err(krb5_error_code res_code); +krb5_error_code smb_krb5_gen_netbios_krb5_address(smb_krb5_addresses **kerb_addr); +krb5_error_code smb_krb5_free_addresses(krb5_context context, smb_krb5_addresses *addr); +NTSTATUS krb5_to_nt_status(krb5_error_code kerberos_error); +krb5_error_code nt_status_to_krb5(NTSTATUS nt_status); +void smb_krb5_free_error(krb5_context context, krb5_error *krberror); +krb5_error_code handle_krberror_packet(krb5_context context, + krb5_data *packet); + +void smb_krb5_get_init_creds_opt_free(krb5_context context, + krb5_get_init_creds_opt *opt); +krb5_error_code smb_krb5_get_init_creds_opt_alloc(krb5_context context, + krb5_get_init_creds_opt **opt); +krb5_error_code smb_krb5_mk_error(krb5_context context, + krb5_error_code error_code, + const krb5_principal server, + krb5_data *reply); +krb5_enctype smb_get_enctype_from_kt_entry(krb5_keytab_entry *kt_entry); +krb5_error_code smb_krb5_enctype_to_string(krb5_context context, + krb5_enctype enctype, + char **etype_s); +krb5_error_code smb_krb5_open_keytab(krb5_context context, + const char *keytab_name, + bool write_access, + krb5_keytab *keytab); +krb5_error_code smb_krb5_keytab_name(TALLOC_CTX *mem_ctx, + krb5_context context, + krb5_keytab keytab, + const char **keytab_name); +int smb_krb5_kt_add_entry_ext(krb5_context context, + krb5_keytab keytab, + krb5_kvno kvno, + const char *princ_s, + krb5_enctype *enctypes, + krb5_data password, + bool no_salt, + bool keep_old_entries); + +#endif /* HAVE_KRB5 */ + + +#ifdef HAVE_LDAP + +/* function declarations not included in proto.h */ +LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to); + +#endif /* HAVE_LDAP */ + +#if defined(HAVE_LINUX_READAHEAD) && ! defined(HAVE_READAHEAD_DECL) +ssize_t readahead(int fd, off64_t offset, size_t count); +#endif + +/* TRUE and FALSE are part of the C99 standard and gcc, but + unfortunately many vendor compilers don't support them. Use True + and False instead. */ + +#ifdef TRUE +#undef TRUE +#endif +#define TRUE __ERROR__XX__DONT_USE_TRUE + +#ifdef FALSE +#undef FALSE +#endif +#define FALSE __ERROR__XX__DONT_USE_FALSE + +/* If we have blacklisted mmap() try to avoid using it accidentally by + undefining the HAVE_MMAP symbol. */ + +#ifdef MMAP_BLACKLIST +#undef HAVE_MMAP +#endif + +#define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr))) +#define CONST_ADD(type, ptr) ((type) ((const void *) (ptr))) + +#ifndef NORETURN_ATTRIBUTE +#if (__GNUC__ >= 3) +#define NORETURN_ATTRIBUTE __attribute__ ((noreturn)) +#else +#define NORETURN_ATTRIBUTE +#endif +#endif + +void smb_panic( const char *why ) NORETURN_ATTRIBUTE ; +void dump_core(void) NORETURN_ATTRIBUTE ; +void exit_server(const char *const reason) NORETURN_ATTRIBUTE ; +void exit_server_cleanly(const char *const reason) NORETURN_ATTRIBUTE ; +void exit_server_fault(void) NORETURN_ATTRIBUTE ; + +#ifdef HAVE_LIBNSCD +#include "libnscd.h" +#endif + +#if defined(HAVE_IPV6) +void in6_addr_to_sockaddr_storage(struct sockaddr_storage *ss, + struct in6_addr ip); +#endif + +#endif /* _INCLUDES_H */ diff --git a/source3/include/interfaces.h b/source3/include/interfaces.h new file mode 100644 index 0000000000..84501cee41 --- /dev/null +++ b/source3/include/interfaces.h @@ -0,0 +1,51 @@ +/* + Unix SMB/CIFS implementation. + Machine customisation and include handling + Copyright (C) Jeremy Allison <jra@samba.org> 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +/* + This structure is used by lib/interfaces.c to return the list of network + interfaces on the machine +*/ + +#ifndef _INTERFACES_H +#define _INTERFACES_H + +#include "lib/replace/replace.h" +#include "lib/replace/system/network.h" + +#define MAX_INTERFACES 128 + +struct iface_struct { + char name[16]; + int flags; + struct sockaddr_storage ip; + struct sockaddr_storage netmask; + struct sockaddr_storage bcast; +}; + +bool make_netmask(struct sockaddr_storage *pss_out, + const struct sockaddr_storage *pss_in, + unsigned long masklen); +void make_bcast(struct sockaddr_storage *pss_out, + const struct sockaddr_storage *pss_in, + const struct sockaddr_storage *nmask); +void make_net(struct sockaddr_storage *pss_out, + const struct sockaddr_storage *pss_in, + const struct sockaddr_storage *nmask); +int get_interfaces(struct iface_struct *ifaces, int max_interfaces); + +#endif diff --git a/source3/include/intl.h b/source3/include/intl.h new file mode 100644 index 0000000000..cb0dc346cc --- /dev/null +++ b/source3/include/intl.h @@ -0,0 +1,23 @@ +/* + Unix SMB/CIFS implementation. + internationalisation headers + Copyright (C) Andrew Tridgell 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + + +/* ideally we would have a static mapping, but that precludes + dynamic loading. This is a reasonable compromise */ +#define N_(x) (x) diff --git a/source3/include/libmsrpc.h b/source3/include/libmsrpc.h new file mode 100644 index 0000000000..3f2a7260ca --- /dev/null +++ b/source3/include/libmsrpc.h @@ -0,0 +1,3045 @@ +/* + * Unix SMB/CIFS implementation. + * MS-RPC client library API definitions/prototypes + * + * Copyright (C) Chris Nicholls 2005. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef LIBMSRPC_H +#define LIBMSRPC_H + + +#include "includes.h" +#include "libsmbclient.h" +#include "libsmb_internal.h" + +/*server capability levels*/ +#define SRV_WIN_NT4 1 +#define SRV_WIN_2K 2 +#define SRV_WIN_2K_SP3 3 +#define SRV_WIN_2K3 4 + +/**@defgroup handle Server Handle*/ +/**@defgroup Library_Functions Library/Utility Functions*/ +/**@defgroup lsa_defs LSA Definitions*/ +/**@defgroup LSA_Functions LSA Functions*/ +/**@defgroup reg_defs Registry Definitions*/ +/**@defgroup Reg_Functions Registry Functions*/ +/**@defgroup sam_defs SAM Definitions*/ +/**@defgroup SAM_Functions SAM Functions*/ +/**@defgroup svc_defs Service Control Definitions*/ +/**@defgroup SCM_Functions Service Control Functions*/ + +/**Operation was unsuccessful*/ +#define CAC_FAILURE 0 +/**Operation was successful*/ +#define CAC_SUCCESS 1 +/**Operation was only partially successful + * an example of this is if you try to lookup a list of accounts to SIDs and not all accounts can be resolved*/ +#define CAC_PARTIAL_SUCCESS 2 + +/**@ingroup CAC_errors Use this to see if the last operation failed - useful for enumeration functions that use multiple calls*/ +#define CAC_OP_FAILED(status) !NT_STATUS_IS_OK(status) && \ + NT_STATUS_V(status) != NT_STATUS_V(STATUS_SOME_UNMAPPED) && \ + NT_STATUS_V(status) != NT_STATUS_V(STATUS_NO_MORE_FILES) && \ + NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_NO_MORE_ENTRIES) && \ + NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_NONE_MAPPED) && \ + NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_GUIDS_EXHAUSTED) + + +/**Privilege string constants*/ +#define CAC_SE_CREATE_TOKEN "SeCreateTokenPrivilege" +#define CAC_SE_ASSIGN_PRIMARY_TOKEN "SeAssignPrimaryTokenPrivilege" +#define CAC_SE_LOCK_MEMORY "SeLockMemoryPrivilege" +#define CAC_SE_INCREASE_QUOTA "SeIncreaseQuotaPrivilege" +#define CAC_SE_MACHINE_ACCOUNT "SeMachineAccountPrivilege" +#define CAC_SE_TCB "SeTcbPrivilege" +#define CAC_SE_SECURITY "SeSecurityPrivilege" +#define CAC_SE_TAKE_OWNERSHIP "SeTakeOwnershipPrivilege" +#define CAC_SE_LOAD_DRIVER "SeLoadDriverPrivilege" +#define CAC_SE_SYSTEM_PROFILE "SeSystemProfilePrivilege" +#define CAC_SE_SYSTEM_TIME "SeSystemtimePrivilege" +#define CAC_SE_PROFILE_SINGLE_PROC "SeProfileSingleProcessPrivilege" +#define CAC_SE_INCREASE_BASE_PRIORITY "SeIncreaseBasePriorityPrivilege" +#define CAC_SE_CREATE_PAGEFILE "SeCreatePagefilePrivilege" +#define CAC_SE_CREATE_PERMANENT "SeCreatePermanentPrivilege" +#define CAC_SE_BACKUP "SeBackupPrivilege" +#define CAC_SE_RESTORE "SeRestorePrivilege" +#define CAC_SE_SHUTDOWN "SeShutdownPrivilege" +#define CAC_SE_DEBUG "SeDebugPrivilege" +#define CAC_SE_AUDIT "SeAuditPrivilege" +#define CAC_SE_SYSTEM_ENV "SeSystemEnvironmentPrivilege" +#define CAC_SE_CHANGE_NOTIFY "SeChangeNotifyPrivilege" +#define CAC_SE_REMOTE_SHUTDOWN "SeRemoteShutdownPrivilege" +#define CAC_SE_UNDOCK "SeUndockPrivilege" +#define CAC_SE_SYNC_AGENT "SeSyncAgentPrivilege" +#define CAC_SE_ENABLE_DELEGATION "SeEnableDelegationPrivilege" +#define CAC_SE_MANAGE_VOLUME "SeManageVolumePrivilege" +#define CAC_SE_IMPERSONATE "SeImpersonatePrivilege" +#define CAC_SE_CREATE_GLOBAL "SeCreateGlobalPrivilege" +#define CAC_SE_PRINT_OPERATOR "SePrintOperatorPrivilege" +#define CAC_SE_NETWORK_LOGON "SeNetworkLogonRight" +#define CAC_SE_INTERACTIVE_LOGON "SeInteractiveLogonRight" +#define CAC_SE_BATCH_LOGON "SeBatchLogonRight" +#define CAC_SE_SERVICE_LOGON "SeServiceLogonRight" +#define CAC_SE_ADD_USERS "SeAddUsersPrivilege" +#define CAC_SE_DISK_OPERATOR "SeDiskOperatorPrivilege" + +/** + * @addtogroup lsa_defs + * @{ + */ +/**used to specify what data to retrieve using cac_LsaQueryTrustedDomainInformation*/ +#define CAC_INFO_TRUSTED_DOMAIN_NAME 0x1 +#define CAC_INFO_TRUSTED_DOMAIN_POSIX_OFFSET 0x3 +#define CAC_INFO_TRUSTED_DOMAIN_PASSWORD 0x4 + +/**Used when requesting machine domain information*/ +#define CAC_DOMAIN_INFO 0x0003 + +/**Used when requesting machine local information*/ +#define CAC_LOCAL_INFO 0x0005 + +/**Stores information about a SID*/ +typedef struct _CACSIDINFO { + /**The actual SID*/ + DOM_SID sid; + + /**The name of the object which maps to this SID*/ + char *name; + + /**The domain the SID belongs to*/ + char *domain; +} CacSidInfo; +/* @} */ + +/** + * @addtogroup reg_defs + * @{ + */ +/**Null terminated string*/ +typedef char* REG_SZ_DATA; + +/**Null terminated string with windows environment variables that should be expanded*/ +typedef char* REG_EXPAND_SZ_DATA; + +/**Binary data of some kind*/ +typedef struct _REGBINARYDATA { + uint32 data_length; + uint8 * data; +} REG_BINARY_DATA; + +/**32-bit (little endian) number*/ +typedef uint32 REG_DWORD_DATA; + +/**32-bit big endian number*/ +typedef uint32 REG_DWORD_BE_DATA; + +/**array of strings*/ +typedef struct _REGMULTISZDATA { + uint32 num_strings; + + char **strings; +} REG_MULTI_SZ_DATA; + +typedef union _REGVALUEDATA { + REG_SZ_DATA reg_sz; + REG_EXPAND_SZ_DATA reg_expand_sz; + REG_BINARY_DATA reg_binary; + REG_DWORD_DATA reg_dword; + REG_DWORD_BE_DATA reg_dword_be; + REG_MULTI_SZ_DATA reg_multi_sz; +} REG_VALUE_DATA; +/**@}*/ + +/** + * @addtogroup sam_defs + * @{ + */ + +#define CAC_USER_RID 0x1 +#define CAC_GROUP_RID 0x2 + +typedef struct _CACLOOKUPRIDSRECORD { + char *name; + uint32 rid; + + /**If found, this will be one of: + * - CAC_USER_RID + * - CAC_GROUP_RID + */ + uint32 type; + + /*if the name or RID was looked up, then found = True*/ + bool found; +} CacLookupRidsRecord; + +typedef struct _CACUSERINFO { + /**Last logon time*/ + time_t logon_time; + + /**Last logoff time*/ + time_t logoff_time; + + /**Last kickoff time*/ + time_t kickoff_time; + + /**Last password set time*/ + time_t pass_last_set_time; + + /**Time password can change*/ + time_t pass_can_change_time; + + /**Time password must change*/ + time_t pass_must_change_time; + + /**LM user password*/ + uint8 lm_password[8]; + + /**NT user password*/ + uint8 nt_password[8]; + + /**User's RID*/ + uint32 rid; + + /**RID of primary group*/ + uint32 group_rid; + + /**User's ACB mask*/ + uint32 acb_mask; + + /**Bad password count*/ + uint16 bad_passwd_count; + + /**Number of logons*/ + uint16 logon_count; + + /**Change password at next logon?*/ + bool pass_must_change; + + /**Username*/ + char *username; + + /**User's full name*/ + char *full_name; + + /**User's home directory*/ + char *home_dir; + + /**Home directory drive*/ + char *home_drive; + + /**Logon script*/ + char *logon_script; + + /**Path to profile*/ + char *profile_path; + + /**Account description*/ + char *description; + + /**Login from workstations*/ + char *workstations; + + char *dial; + + /**Possible logon hours*/ + LOGON_HRS *logon_hours; + +} CacUserInfo; + +typedef struct _CACGROUPINFO { + /**Group name*/ + char *name; + + /**Description*/ + char *description; + + /**Number of members*/ + uint32 num_members; +} CacGroupInfo, CacAliasInfo; + +/**Represents a period (duration) of time*/ +typedef struct _CACTIME { + /**Number of days*/ + uint32 days; + + /**Number of hours*/ + uint32 hours; + + /**Number of minutes*/ + uint32 minutes; + + /**number of seconds*/ + uint32 seconds; +} CacTime; + + +typedef struct _CACDOMINFO { + /**The server role. Should be one of: + * ROLE_STANDALONE + * ROLE_DOMAIN_MEMBER + * ROLE_DOMAIN_BDC + * ROLE_DOMAIN_PDC + * see include/smb.h + */ + uint32 server_role; + + /**Number of domain users*/ + uint32 num_users; + + /**Number of domain groups*/ + uint32 num_domain_groups; + + /**Number of local groups*/ + uint32 num_local_groups; + + /**Comment*/ + char *comment; + + /**Domain name*/ + char *domain_name; + + /**Server name*/ + char *server_name; + + /**Minimum password length*/ + uint16 min_pass_length; + + /**How many previous passwords to remember - ie, password cannot be the same as N previous passwords*/ + uint16 pass_history; + + /**How long (from now) before passwords expire*/ + CacTime expire; + + /**How long (from now) before passwords can be changed*/ + CacTime min_pass_age; + + /**How long users are locked out for too many bad password attempts*/ + CacTime lockout_duration; + + /**How long before lockouts are reset*/ + CacTime lockout_reset; + + /**How many bad password attempts before lockout occurs*/ + uint16 num_bad_attempts; +} CacDomainInfo; + +/**@}*/ /*sam_defs*/ + +/**@addtogroup svc_defs + * @{ + */ +typedef struct _CACSERVICE { + /**The service name*/ + char *service_name; + + /**The display name of the service*/ + char *display_name; + + /**Current status of the service - see include/rpc_svcctl.h for SERVICE_STATUS definition*/ + SERVICE_STATUS status; +} CacService; + +typedef struct __CACSERVICECONFIG { + /**The service type*/ + uint32 type; + + /**The start type. Should be one of: + * - SVCCTL_BOOT_START + * - SVCCTL_SYSTEM_START + * - SVCCTL_AUTO_START + * - SVCCTL_DEMAND_START + */ + uint32 start_type; + + uint32 error_control; + + /**Path to executable*/ + char *exe_path; + + /***/ + char *load_order_group; + + uint32 tag_id; + + /**Any dependencies for the service*/ + char *dependencies; + + /**Run as...*/ + char *start_name; + + /**Service display name*/ + char *display_name; + +} CacServiceConfig; +/**@}*/ /*svc_defs*/ + +#include "libmsrpc_internal.h" + +/** + * @addtogroup handle + * @{ + */ + +/** + * Server handle used to keep track of client/server/pipe information. Use cac_NewServerHandle() to allocate. + * Initiliaze as many values as possible before calling cac_Connect(). + * + * @note When allocating memory for the fields, use SMB_MALLOC() (or equivalent) instead of talloc() (or equivalent) - + * If memory is not allocated for a field, cac_Connect will allocate sizeof(fstring) bytes for it. + * + * @note It may be wise to allocate large buffers for these fields and strcpy data into them. + * + * @see cac_NewServerHandle() + * @see cac_FreeHandle() + */ +typedef struct _CACSERVERHANDLE { + /** debug level + */ + int debug; + + /** netbios name used to make connections + */ + char *netbios_name; + + /** domain name used to make connections + */ + char *domain; + + /** username used to make connections + */ + char *username; + + /** user's password plain text string + */ + char *password; + + /** name or IP address of server we are currently working with + */ + char *server; + + /**stores the latest NTSTATUS code + */ + NTSTATUS status; + + /** internal. do not modify! + */ + struct CacServerHandleInternal _internal; + +} CacServerHandle; + +/*@}*/ + +/**internal function. do not call this function*/ +SMBCSRV *cac_GetServer(CacServerHandle *hnd); + + +/** @addtogroup Library_Functions + * @{ + */ +/** + * Initializes the library - do not need to call this function. Open's smb.conf as well as initializes logging. + * @param debug Debug level for library to use + */ + +void cac_Init(int debug); + +/** + * Creates an un-initialized CacServerHandle + * @param allocate_fields If True, the function will allocate sizeof(fstring) bytes for all char * fields in the handle + * @return - un-initialized server handle + * - NULL if no memory could be allocated + */ +CacServerHandle * cac_NewServerHandle(bool allocate_fields); + +/** + * Specifies the smbc_get_auth_data_fn to use if you do not want to use the default. + * @param hnd non-NULL server handle + * @param auth_fn auth_data_fn to set in server handle + */ + +void cac_SetAuthDataFn(CacServerHandle *hnd, smbc_get_auth_data_fn auth_fn); + +/** Use your own libsmbclient context - not necessary. + * @note You must still call cac_Connect() after specifying your own libsmbclient context + * @param hnd Initialized, but not connected CacServerHandle + * @param ctx The libsmbclient context you would like to use. + */ +void cac_SetSmbcContext(CacServerHandle *hnd, SMBCCTX *ctx); + +/** Connects to a specified server. If there is already a connection to a different server, + * it will be cleaned up before connecting to the new server. + * @param hnd Pre-initialized CacServerHandle + * @param srv (Optional) Name or IP of the server to connect to. If NULL, server from the CacServerHandle will be used. + * + * @return CAC_FAILURE if the operation could not be completed successfully (hnd->status will also be set with a NTSTATUS code) + * @return CAC_SUCCESS if the operation succeeded + */ +int cac_Connect(CacServerHandle *hnd, const char *srv); + + +/** + * Cleans up any data used by the CacServerHandle. If the libsmbclient context was set using cac_SetSmbcContext(), it will not be free'd. + * @param hnd the CacServerHandle to destroy + */ +void cac_FreeHandle(CacServerHandle * hnd); + +/** + * Initializes a CacTime structure based on an NTTIME structure + * If the function fails, then the CacTime structure will be zero'd out + */ +void cac_InitCacTime(CacTime *cactime, NTTIME nttime); + +/** + * Called by cac_NewServerHandle() if allocate_fields = True. You can call this if you want to, allocates sizeof(fstring) char's for every char * field + * @param hnd Uninitialized server handle + * @return CAC_FAILURE Memory could not be allocated + * @return CAC_SUCCESS Memory was allocated + */ +int cac_InitHandleMem(CacServerHandle *hnd); + +/** + * Default smbc_get_auth_data_fn for libmsrpc. This function is called when libmsrpc needs to get more information about the + * client (username/password, workgroup). + * This function provides simple prompts to the user to enter the information. This description his here so you know how to re-define this function. + * @see cac_SetAuthDataFn() + * @param pServer Name/IP of the server to connect to. + * @param pShare Share name to connect to + * @param pWorkgroup libmsrpc passes in the workgroup/domain name from hnd->domain. It can be modified in the function. + * @param maxLenWorkgroup The maximum length of a string pWogroup can hold. + * @param pUsername libmsrpc passes in the username from hnd->username. It can be modified in the function. + * @param maxLenUsername The maximum length of a string pUsername can hold. + * @param pPassword libmsrpc pass in the password from hnd->password. It can be modified in the function. + * @param maxLenPassword The maximum length of a string pPassword can hold. + */ +void cac_GetAuthDataFn(const char * pServer, + const char * pShare, + char * pWorkgroup, + int maxLenWorkgroup, + char * pUsername, + int maxLenUsername, + char * pPassword, + int maxLenPassword); + + +/**@}*/ + +/***************** + * LSA Functions * + *****************/ + +/** @addtogroup LSA_Functions + * @{ + */ + +struct LsaOpenPolicy { + /**Inputs*/ + struct { + /**Access Mask. Refer to Security Access Masks in include/rpc_secdes.h*/ + uint32 access; + + /**Use security quality of service? (True/False)*/ + bool security_qos; + } in; + + /**Outputs*/ + struct { + /**Handle to the open policy (needed for all other operations)*/ + POLICY_HND *pol; + } out; +}; + +/** + * Opens a policy handle on a remote machine. + * @param hnd fully initialized CacServerHandle for remote machine + * @param mem_ctx Talloc context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE if the policy could not be opened. hnd->status set with appropriate NTSTATUS + * @return CAC_SUCCESS if the policy could be opened, the policy handle can be found + */ +int cac_LsaOpenPolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpenPolicy *op); + + +/** + * Closes an LSA policy handle (Retrieved using cac_LsaOpenPolicy). + * If successful, the handle will be closed on the server, and memory for pol will be freed + * @param hnd - An initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param pol - the policy handle to close + * @return CAC_FAILURE could not close the policy handle, hnd->status is set to the appropriate NTSTATUS error code + * @return CAC_SUCCESS the policy handle was closed + */ +int cac_LsaClosePolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *pol); + + +struct LsaGetNamesFromSids { + struct { + /**handle to and open LSA policy*/ + POLICY_HND *pol; + + /**the number of SIDs to lookup*/ + uint32 num_sids; + + /**array of SIDs to lookup*/ + DOM_SID *sids; + } in; + + struct { + /**The number of names returned (in case of CAC_PARTIAL_SUCCESS)*/ + uint32 num_found; + + /**array of SID info each index is one sid */ + CacSidInfo *sids; + + /**in case of partial success, an array of SIDs that could not be looked up (NULL if all sids were looked up)*/ + DOM_SID *unknown; + } out; +}; + +/** + * Looks up the names for a list of SIDS + * @param hnd initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op input and output parameters + * @return CAC_FAILURE none of the SIDs could be looked up hnd->status is set with appropriate NTSTATUS error code + * @return CAC_SUCCESS all of the SIDs were translated and a list of names has been output + * @return CAC_PARTIAL_SUCCESS not all of the SIDs were translated, as a result the number of returned names is less than the original list of SIDs + */ +int cac_LsaGetNamesFromSids(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaGetNamesFromSids *op); + +struct LsaGetSidsFromNames { + struct { + /**handle to an open LSA policy*/ + POLICY_HND *pol; + + /**number of SIDs to lookup*/ + uint32 num_names; + + /**array of strings listing the names*/ + char **names; + } in; + + struct { + /**The number of SIDs returned (in case of partial success*/ + uint32 num_found; + + /**array of SID info for the looked up names*/ + CacSidInfo *sids; + + /**in case of partial success, the names that were not looked up*/ + char **unknown; + } out; +}; + +/** + * Looks up the SIDs for a list of names + * @param hnd initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op input and output parameters + * @return CAC_FAILURE none of the SIDs could be looked up hnd->status is set with appropriate NTSTATUS error code + * @return CAC_SUCCESS all of the SIDs were translated and a list of names has been output + * @return CAC_PARTIAL_SUCCESS not all of the SIDs were translated, as a result the number of returned names is less than the original list of SIDs + */ +int cac_LsaGetSidsFromNames(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaGetSidsFromNames *op); + +struct LsaFetchSid { + struct { + /**handle to an open LSA policy*/ + POLICY_HND *pol; + + /**can be CAC_LOCAL_INFO, CAC_DOMAIN_INFO, or (CAC_LOCAL_INFO | CAC_DOMAIN_INFO)*/ + uint16 info_class; + } in; + + struct { + /**the machine's local SID and domain name (NULL if not asked for)*/ + CacSidInfo *local_sid; + + /**the machine's domain SID and name (NULL if not asked for)*/ + CacSidInfo *domain_sid; + + } out; +}; + +/** + * Looks up the domain or local sid of a machine with an open LSA policy handle + * @param hnd initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op input and output parameters + * @return CAC_FAILURE if the SID could not be fetched + * @return CAC_SUCCESS if the SID was fetched + * @return CAC_PARTIAL_SUCCESS if you asked for both local and domain sids but only one was returned + */ +int cac_LsaFetchSid(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaFetchSid *op); + +struct LsaQueryInfoPolicy { + struct { + /**Open LSA policy handle on remote server*/ + POLICY_HND *pol; + } in; + + struct { + /**remote server's domain name*/ + char *domain_name; + + /**remote server's dns name*/ + char *dns_name; + + /**remote server's forest name*/ + char *forest_name; + + /**remote server's domain guid*/ + struct GUID *domain_guid; + + /**remote server's domain SID*/ + DOM_SID *domain_sid; + } out; +}; + +/** + * Retrieves information about the LSA machine/domain + * @param hnd initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op input and output parameters + * Note: for pre-Windows 2000 machines, only op->out.SID and op->out.domain will be set. @see cac_LsaFetchSid + * @return - CAC_FAILURE if the operation was not successful. hnd->status will be set with an accurate NT_STATUS code + * @return CAC_SUCCESS the operation was successful. + */ +int cac_LsaQueryInfoPolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaQueryInfoPolicy *op); + +struct LsaEnumSids { + struct { + /**Open LSA Policy handle*/ + POLICY_HND *pol; + + /**The prefered maximum number of SIDs returned per call*/ + uint32 pref_max_sids; + } in; + + struct { + /**used to keep track of how many sids have been retrieved over multiple calls + * should be set to zero via ZERO_STRUCT() befrore the first call. Use the same struct LsaEnumSids for multiple calls*/ + uint32 resume_idx; + + /**The number of sids returned this call*/ + uint32 num_sids; + + /**Array of sids returned*/ + DOM_SID *sids; + + } out; +}; + +/** + * Enumerates the SIDs in the LSA. Can be enumerated in blocks by calling the function multiple times. + * Example: while(cac_LsaEnumSids(hnd, mem_ctx, op) { ... } + * @param hnd - An initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE there was an error during operations OR there are no more results + * @return CAC_SUCCESS the operation completed and results were returned + */ +int cac_LsaEnumSids(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumSids *op); + +struct LsaEnumAccountRights { + struct { + /**Open LSA Policy handle*/ + POLICY_HND *pol; + + /**(Optional) SID of the account - must supply either sid or name*/ + DOM_SID *sid; + + /**(Optional) name of the account - must supply either sid or name*/ + char *name; + } in; + + struct { + /**Count of rights for this account*/ + uint32 num_privs; + + /**array of privilege names*/ + char **priv_names; + } out; +}; + +/** + * Enumerates rights assigned to a given account. Takes a SID instead of account handle as input + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE the rights could not be retrieved. hnd->status is set with NT_STATUS code + * @return CAC_SUCCESS the operation was successful. + */ + +int cac_LsaEnumAccountRights(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumAccountRights *op); + +struct LsaEnumTrustedDomains { + struct { + /**Open LSA policy handle*/ + POLICY_HND *pol; + } in; + + struct { + /**used to keep track of how many domains have been retrieved over multiple calls + * should be set to zero via ZERO_STRUCT() before the first call. Use the same struct LsaEnumSids for multiple calls*/ + uint32 resume_idx; + + /**The number of domains returned by the remote server this call*/ + uint32 num_domains; + + /**array of trusted domain names returned by the remote server*/ + char **domain_names; + + /**array of trusted domain sids returned by the remote server*/ + DOM_SID *domain_sids; + } out; +}; + +/** + * Enumerates the trusted domains in the LSA. + * @param hnd - An initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op - initialized parameters + * @return CAC_FAILURE there was an error during operations OR there are no more results + * @return CAC_SUCCESS the operation completed and results were returned + */ +int cac_LsaEnumTrustedDomains(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumTrustedDomains *op); + +struct LsaOpenTrustedDomain { + struct { + /**an open LSA policy handle*/ + POLICY_HND *pol; + + /**SID of the trusted domain to open*/ + DOM_SID *domain_sid; + + /**Desired access on the open domain*/ + uint32 access; + } in; + + struct { + /**A handle to the policy that is opened*/ + POLICY_HND *domain_pol; + } out; +}; + +/** + * Opens a trusted domain by SID. + * @param hnd An initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op initialized I/O parameters + * @return CAC_FAILURE a handle to the domain could not be opened. hnd->status is set with approriate NT_STATUS code + * @return CAC_SUCCESS the domain was opened successfully + */ +int cac_LsaOpenTrustedDomain(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpenTrustedDomain *op); + +struct LsaQueryTrustedDomainInfo { + struct { + /**Open LSA policy handle*/ + POLICY_HND *pol; + + /**Info class of returned data*/ + uint16 info_class; + + /**(Optional)SID of trusted domain to query (must specify either SID or name of trusted domain)*/ + DOM_SID *domain_sid; + + /**(Optional)Name of trusted domain to query (must specify either SID or name of trusted domain)*/ + char *domain_name; + } in; + + struct { + /**information about the trusted domain*/ + LSA_TRUSTED_DOMAIN_INFO *info; + } out; +}; + +/** + * Retrieves information a trusted domain. + * @param hnd An initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op initialized I/O parameters + * @return CAC_FAILURE a handle to the domain could not be opened. hnd->status is set with approriate NT_STATUS code + * @return CAC_SUCCESS the domain was opened successfully + */ + +int cac_LsaQueryTrustedDomainInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaQueryTrustedDomainInfo *op); + +struct LsaEnumPrivileges { + struct { + /**An open LSA policy handle*/ + POLICY_HND *pol; + + /**The _preferred_ maxinum number of privileges returned per call*/ + uint32 pref_max_privs; + } in; + + struct { + /**Used to keep track of how many privileges have been retrieved over multiple calls. Do not modify this value between calls*/ + uint32 resume_idx; + + /**The number of privileges returned this call*/ + uint32 num_privs; + + /**Array of privilege names*/ + char **priv_names; + + /**Array of high bits for privilege LUID*/ + uint32 *high_bits; + + /**Array of low bits for privilege LUID*/ + uint32 *low_bits; + } out; +}; + +/** + * Enumerates the Privileges supported by the LSA. Can be enumerated in blocks by calling the function multiple times. + * Example: while(cac_LsaEnumPrivileges(hnd, mem_ctx, op) { ... } + * @param hnd An initialized and connected server handle + * @param mem_ctx Talloc context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE there was an error during operations OR there are no more results + * @return CAC_SUCCESS the operation completed and results were returned + * @see CAC_OP_FAILED() + */ +int cac_LsaEnumPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumPrivileges *op); + +struct LsaOpenAccount { + struct { + /**An open LSA policy handle*/ + POLICY_HND *pol; + + /**(Optional) account SID - must supply either sid or name*/ + DOM_SID *sid; + + /**(Optional) account name - must supply either sid or name*/ + char *name; + + /**desired access for the handle*/ + uint32 access; + } in; + + struct { + /**A handle to the opened user*/ + POLICY_HND *user; + } out; +}; + +/** + * Opens a handle to an account in the LSA + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE the account could not be opened. hnd->status has appropriate NT_STATUS code + * @return CAC_SUCCESS the account was opened + */ +int cac_LsaOpenAccount(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpenAccount *op); + +struct LsaAddPrivileges { + struct { + /**An open LSA policy handle*/ + POLICY_HND *pol; + + /**(Optional) The user's SID (must specify at least sid or name)*/ + DOM_SID *sid; + + /**(Optional) The user's name (must specify at least sid or name)*/ + char *name; + + /**The privilege names of the privileges to add for the account*/ + char **priv_names; + + /**The number of privileges in the priv_names array*/ + uint32 num_privs; + + } in; +}; + +/** + * Adds Privileges an account. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE the privileges could not be set. hnd->status has appropriate NT_STATUS code + * @return CAC_SUCCESS the privileges were set. + */ +int cac_LsaAddPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaAddPrivileges *op); + +struct LsaRemovePrivileges { + struct { + /**An open handle to the LSA*/ + POLICY_HND *pol; + + /**(Optional) The account SID (must specify at least sid or name)*/ + DOM_SID *sid; + + /**(Optional) The account name (must specify at least sid or name)*/ + char *name; + + /**The privilege names of the privileges to remove from the account*/ + char **priv_names; + + /**The number of privileges in the priv_names array*/ + uint32 num_privs; + + } in; + +}; + +/** + * Removes a _specific_ set of privileges from an account + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE the privileges could not be removed. hnd->status is set with NT_STATUS code + * @return CAC_SUCCESS the privileges were removed + */ +int cac_LsaRemovePrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaRemovePrivileges *op); + +struct LsaClearPrivileges { + struct { + /**An open handle to the LSA*/ + POLICY_HND *pol; + + /**(Optional) The user's SID (must specify at least sid or name)*/ + DOM_SID *sid; + + /**(Optional) The user's name (must specify at least sid or name)*/ + char *name; + } in; + +}; + +/** + * Removes ALL privileges from an account + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE the operation was not successful, hnd->status set with NT_STATUS code + * @return CAC_SUCCESS the opeartion was successful. + */ +int cac_LsaClearPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaClearPrivileges *op); + +/** + * Sets an accounts priviliges. Removes all privileges and then adds specified privileges. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE The operation could not complete successfully + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_LsaSetPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaAddPrivileges *op); + +struct LsaGetSecurityObject { + struct { + /**Open LSA policy handle*/ + POLICY_HND *pol; + } in; + + struct { + /**Returned security descriptor information*/ + SEC_DESC_BUF *sec; + } out; +}; + +/** + * Retrieves Security Descriptor information about the LSA + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE The operation could not complete successfully + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_LsaGetSecurityObject(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaGetSecurityObject *op); + + +/**@}*/ /*LSA_Functions*/ + +/********************** + * Registry Functions * + *********************/ + +/**@addtogroup Reg_Functions + * @{ + */ + +struct RegConnect { + struct { + /** must be one of : + * HKEY_CLASSES_ROOT, + * HKEY_LOCAL_MACHINE, + * HKEY_USERS, + * HKEY_PERFORMANCE_DATA, + */ + int root; + + /**desired access on the root key + * combination of: + * REG_KEY_READ, + * REG_KEY_WRITE, + * REG_KEY_EXECUTE, + * REG_KEY_ALL, + * found in include/rpc_secdes.h*/ + uint32 access; + } in; + + struct { + POLICY_HND *key; + } out; +}; + +/** + * Opens a handle to the registry on the server + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegConnect(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegConnect *op); + +/** + * Closes an open registry handle + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param key The Key/Handle to close + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegClose(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *key); + +struct RegOpenKey { + struct { + /**(Optional)parent key. + * If this is NULL, then cac_RegOpenKey() will attempt to connect to the registry, name MUST start with something like:<br> + * HKEY_LOCAL_MACHINE\ or an abbreviation like HKCR\ + * + * supported root names: + * - HKEY_LOCAL_MACHINE\ or HKLM\ + * - HKEY_CLASSES_ROOT\ or HKCR\ + * - HKEY_USERS\ or HKU\ + * - HKEY_PERFORMANCE_DATA or HKPD\ + */ + POLICY_HND *parent_key; + + /**name/path of key*/ + char *name; + + /**desired access on this key*/ + uint32 access; + } in; + + struct { + POLICY_HND *key; + } out; +}; + +/** + * Opens a registry key + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_RegOpenKey(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegOpenKey *op); + +struct RegEnumKeys { + struct { + /**enumerate subkeys of this key*/ + POLICY_HND *key; + + /**maximum number of keys to enumerate each call*/ + uint32 max_keys; + } in; + + struct { + /**keeps track of the index to resume enumerating*/ + uint32 resume_idx; + + /**the number of keys returned this call*/ + uint32 num_keys; + + /**array of key names*/ + char **key_names; + + /**class names of the keys*/ + char **class_names; + + /**last modification time of the key*/ + time_t *mod_times; + } out; +}; + +/** + * Enumerates Subkeys of a given key. Can be run in a loop. Example: while(cac_RegEnumKeys(hnd, mem_ctx, op)) { ... } + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @see CAC_OP_FAILED() + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegEnumKeys(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegEnumKeys *op); + + +struct RegCreateKey { + struct { + /**create a subkey of parent_key*/ + POLICY_HND *parent_key; + + /**name of the key to create*/ + char *key_name; + + /**class of the key*/ + char *class_name; + + /**Access mask to open the key with. See REG_KEY_* in include/rpc_secdes.h*/ + uint32 access; + } in; + + struct { + /**Open handle to the key*/ + POLICY_HND *key; + } out; +}; + +/** + * Creates a registry key, if the key already exists, it will be opened __Creating keys is not currently working__. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parmeters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegCreateKey(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegCreateKey *op); + +struct RegDeleteKey { + struct { + /**handle to open registry key*/ + POLICY_HND *parent_key; + + /**name of the key to delete*/ + char *name; + + /**delete recursively. WARNING: this might not always work as planned*/ + bool recursive; + } in; + +}; + +/** + * Deletes a subkey of an open key. Note: if you run this with op->in.recursive == True, and the operation fails, it may leave the key in an inconsistent state. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_RegDeleteKey(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegDeleteKey *op); + +struct RegDeleteValue { + struct { + /**handle to open registry key*/ + POLICY_HND *parent_key; + + /**name of the value to delete*/ + char *name; + } in; +}; + +/** + * Deletes a registry value. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegDeleteValue(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegDeleteValue *op); + +struct RegQueryKeyInfo { + struct { + /**Open handle to the key to query*/ + POLICY_HND *key; + } in; + + struct { + /**name of the key class*/ + char *class_name; + + /**number of subkeys of the key*/ + uint32 num_subkeys; + + /**length (in characters) of the longest subkey name*/ + uint32 longest_subkey; + + /**length (in characters) of the longest class name*/ + uint32 longest_class; + + /**number of values in this key*/ + uint32 num_values; + + /**length (in characters) of the longest value name*/ + uint32 longest_value_name; + + /**length (in bytes) of the biggest value data*/ + uint32 longest_value_data; + + /**size (in bytes) of the security descriptor*/ + uint32 security_desc_size; + + /**time of the last write*/ + time_t last_write_time; + } out; +}; + +/** + * Retrieves information about an open key + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_RegQueryKeyInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegQueryKeyInfo *op); + +struct RegSaveKey { + struct { + /**Open key to be saved*/ + POLICY_HND *key; + + /**The path (on the remote computer) to save the file to*/ + char *filename; + } in; +}; + +/** + * Saves a key to a file on the remote machine __Not currently working__. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_RegSaveKey(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSaveKey *op); + +struct RegQueryValue { + struct { + /**handle to open registry key*/ + POLICY_HND *key; + + /**name of the value to query*/ + char *val_name; + } in; + + struct { + /**Value type. + * One of: + * - REG_DWORD (equivalent to REG_DWORD_LE) + * - REG_DWORD_BE + * - REG_SZ + * - REG_EXPAND_SZ + * - REG_MULTI_SZ + * - REG_BINARY + */ + uint32 type; + + /**The value*/ + REG_VALUE_DATA *data; + } out; +}; + +/** + * Retrieves a value (type and data) _not currently working_. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_RegQueryValue(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegQueryValue *op); + +struct RegEnumValues { + struct { + /**handle to open key*/ + POLICY_HND *key; + + /**max number of values returned per call*/ + uint32 max_values; + + } in; + + struct { + /**keeps track of the index to resume from - used over multiple calls*/ + uint32 resume_idx; + + /**the number of values that were returned this call*/ + uint32 num_values; + + /**Array of value types. A type can be one of: + * - REG_DWORD (equivalent to REG_DWORD_LE) + * - REG_DWORD_BE + * - REG_SZ + * - REG_EXPAND_SZ + * - REG_MULTI_SZ + * - REG_BINARY + */ + uint32 *types; + + /**array of strings storing the names of the values*/ + char **value_names; + + /**array of pointers to the value data returned*/ + REG_VALUE_DATA **values; + } out; +}; + +/** + * Enumerates a number of Registry values in an open registry key. + * Can be run in a loop. Example: while(cac_RegEnumValues(hnd, mem_ctx, op)) { ... } + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @see CAC_OP_FAILED() + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegEnumValues(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegEnumValues *op); + +struct RegSetValue { + struct { + /**Handle to open registry key*/ + POLICY_HND *key; + + /**Name of the value*/ + char *val_name; + + /**Value type. + * One of: + * - REG_DWORD (equivalent to REG_DWORD_LE) + * - REG_DWORD_BE + * - REG_SZ + * - REG_EXPAND_SZ + * - REG_MULTI_SZ + * - REG_BINARY + */ + uint32 type; + + /**the value*/ + REG_VALUE_DATA value; + } in; +}; + +/** + * Sets or creates value (type and data). + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegSetValue(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSetValue *op); + +struct RegGetVersion { + struct { + /**open registry key*/ + POLICY_HND *key; + } in; + + struct { + /**version number*/ + uint32 version; + } out; +}; + +/** + * Retrieves the registry version number + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegGetVersion(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegGetVersion *op); + +struct RegGetKeySecurity { + struct { + /**Handle to key to query*/ + POLICY_HND *key; + + /**Info that you want. Should be a combination of (1 or more or'd): + * - OWNER_SECURITY_INFORMATION + * - GROUP_SECURITY_INFORMATION + * - DACL_SECURITY_INFORMATION + * - SACL_SECURITY_INFORMATION + * - UNPROTECTED_SACL_SECURITY_INFORMATION + * - UNPROTECTED_DACL_SECURITY_INFORMATION + * - PROTECTED_SACL_SECURITY_INFORMATION + * - PROTECTED_DACL_SECURITY_INFORMATION + * + * or use: + * - ALL_SECURITY_INFORMATION + * + * all definitions from include/rpc_secdes.h + */ + uint32 info_type; + } in; + + struct { + /**size of the data returned*/ + uint32 size; + + /**Security descriptor*/ + SEC_DESC *descriptor; + } out; +}; + +/** + * Retrieves a key security descriptor. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_RegGetKeySecurity(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegGetKeySecurity *op); + +struct RegSetKeySecurity { + struct { + /**Handle to key to query*/ + POLICY_HND *key; + + /**Info that you want. Should be a combination of (1 or more or'd): + * - OWNER_SECURITY_INFORMATION + * - GROUP_SECURITY_INFORMATION + * - DACL_SECURITY_INFORMATION + * - SACL_SECURITY_INFORMATION + * - UNPROTECTED_SACL_SECURITY_INFORMATION + * - UNPROTECTED_DACL_SECURITY_INFORMATION + * - PROTECTED_SACL_SECURITY_INFORMATION + * - PROTECTED_DACL_SECURITY_INFORMATION + * + * or use: + * - ALL_SECURITY_INFORMATION + * + * all definitions from include/rpc_secdes.h + */ + uint32 info_type; + + /**size of the descriptor*/ + size_t size; + + /**Security descriptor*/ + SEC_DESC *descriptor; + } in; +}; + +/** + * Sets the key security descriptor. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_RegSetKeySecurity(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSetKeySecurity *op); + +/**@}*/ /*Reg_Functions*/ + +struct Shutdown { + struct { + /**the message to display (can be NULL)*/ + char *message; + + /**timeout in seconds*/ + uint32 timeout; + + /**False = shutdown, True = reboot*/ + bool reboot; + + /**force the*/ + bool force; + + /*FIXME: make this useful*/ + uint32 reason; + } in; +}; + + +/** + * Shutdown the server _not currently working_. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_Shutdown(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct Shutdown *op); + +/** + * Attempt to abort initiated shutdown on the server _not currently working_. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_AbortShutdown(CacServerHandle *hnd, TALLOC_CTX *mem_ctx); + +/***************** + * SAM Functions * + *****************/ + +/**@addtogroup SAM_Functions + * @{ + */ +struct SamConnect { + struct { + /**Access mask to open with + * see generic access masks in include/smb.h*/ + uint32 access; + } in; + + struct { + POLICY_HND *sam; + } out; +}; + +/** + * Connects to the SAM. This can be skipped by just calling cac_SamOpenDomain() + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_SamConnect(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamConnect *op); + + +/** + * Closes any (SAM, domain, user, group, etc.) SAM handle. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param sam Handle to close + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_SamClose(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *sam); + +struct SamOpenDomain { + struct { + /**The desired access. See generic access masks - include/smb.h*/ + uint32 access; + + /**(Optional) An open handle to the SAM. If it is NULL, the function will connect to the SAM with the access mask above*/ + POLICY_HND *sam; + + /**(Optional) The SID of the domain to open. + * If this this is NULL, the function will attempt to open the domain specified in hnd->domain */ + DOM_SID *sid; + } in; + + struct { + /**handle to the open domain*/ + POLICY_HND *dom_hnd; + + /**Handle to the open SAM*/ + POLICY_HND *sam; + } out; +}; + +/** + * Opens a handle to a domain. This must be called before any other SAM functions + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamOpenDomain(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamOpenDomain *op); + +struct SamCreateUser { + struct { + /**Open domain handle*/ + POLICY_HND *dom_hnd; + + /**Username*/ + char *name; + + /**See Allowable account control bits in include/smb.h*/ + uint32 acb_mask; + } in; + + struct { + /**handle to the user*/ + POLICY_HND *user_hnd; + + /**rid of the user*/ + uint32 rid; + } out; +}; + +/** + * Creates a new domain user, if the account already exists it will _not_ be opened and hnd->status will be NT_STATUS_USER_EXISTS + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_SamCreateUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamCreateUser *op); + +struct SamOpenUser { + struct { + /**Handle to open SAM connection*/ + POLICY_HND *dom_hnd; + + /**desired access - see generic access masks in include/smb.h*/ + uint32 access; + + /**RID of the user*/ + uint32 rid; + + /**(Optional) name of the user - must supply either RID or user name*/ + char *name; + } in; + + struct { + /**Handle to the user*/ + POLICY_HND *user_hnd; + } out; +}; + +/** + * Opens a domain user. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamOpenUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamOpenUser *op); + +/** + * Deletes a domain user. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param user_hnd Open handle to the user + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamDeleteUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *user_hnd); + + +struct SamEnumUsers { + struct { + /**Open handle to a domain*/ + POLICY_HND *dom_hnd; + + /**Enumerate users with specific ACB. If 0, all users will be enumerated*/ + uint32 acb_mask; + } in; + + struct { + /**where to resume from. Used over multiple calls*/ + uint32 resume_idx; + + /**the number of users returned this call*/ + uint32 num_users; + + /**Array storing the rids of the returned users*/ + uint32 *rids; + + /**Array storing the names of all the users returned*/ + char **names; + + bool done; + } out; +}; + +/** + * Enumerates domain users. Can be used as a loop condition. Example: while(cac_SamEnumUsers(hnd, mem_ctx, op)) { ... } + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamEnumUsers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamEnumUsers *op); + +struct SamGetNamesFromRids { + struct { + /**An open handle to the domain SAM from cac_SamOpenDomain()*/ + POLICY_HND *dom_hnd; + + /**Number of RIDs to resolve*/ + uint32 num_rids; + + /**Array of RIDs to resolve*/ + uint32 *rids; + } in; + + struct { + /**the number of names returned - if this is 0, the map is NULL*/ + uint32 num_names; + + /**array contiaing the Names and RIDs*/ + CacLookupRidsRecord *map; + } out; +}; + +/** + * Returns a list of names which map to a list of RIDs. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetNamesFromRids(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetNamesFromRids *op); + +struct SamGetRidsFromNames { + struct { + /**An open handle to the domain SAM from cac_SamOpenDomain()*/ + POLICY_HND *dom_hnd; + + /**Number of names to resolve*/ + uint32 num_names; + + /**Array of names to resolve*/ + char **names; + } in; + + struct { + /**the number of names returned - if this is 0, then map is NULL*/ + uint32 num_rids; + + /**array contiaing the Names and RIDs*/ + CacLookupRidsRecord *map; + } out; +}; + +/** + * Returns a list of RIDs which map to a list of names. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetRidsFromNames(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetRidsFromNames *op); + +struct SamGetGroupsForUser { + struct { + /**An open handle to the user*/ + POLICY_HND *user_hnd; + } in; + + struct { + /**The number of groups the user is a member of*/ + uint32 num_groups; + + /**The RIDs of the groups*/ + uint32 *rids; + + /**The attributes of the groups*/ + uint32 *attributes; + } out; +}; +/** + * Retrieves a list of groups that a user is a member of. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetGroupsForUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetGroupsForUser *op); + +struct SamOpenGroup { + struct { + /**Open handle to the domain SAM*/ + POLICY_HND *dom_hnd; + + /**Desired access to open the group with. See Generic access masks in include/smb.h*/ + uint32 access; + + /**rid of the group*/ + uint32 rid; + } in; + + struct { + /**Handle to the group*/ + POLICY_HND *group_hnd; + } out; +}; + +/** + * Opens a domain group. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamOpenGroup(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamOpenGroup *op); + +struct SamCreateGroup { + struct { + /**Open handle to the domain SAM*/ + POLICY_HND *dom_hnd; + + /**Desired access to open the group with. See Generic access masks in include/smb.h*/ + uint32 access; + + /**The name of the group*/ + char *name; + } in; + + struct { + /**Handle to the group*/ + POLICY_HND *group_hnd; + } out; +}; + +/** + * Creates a group. If the group already exists it will not be opened. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamCreateGroup(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamCreateGroup *op); + +/** + * Deletes a domain group. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param group_hnd Open handle to the group. + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamDeleteGroup(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *group_hnd); + +struct SamGetGroupMembers { + struct { + /**Open handle to a group*/ + POLICY_HND *group_hnd; + } in; + + struct { + /**The number of members in the group*/ + uint32 num_members; + + /**An array storing the RIDs of the users*/ + uint32 *rids; + + /**The attributes*/ + uint32 *attributes; + } out; +}; + +/** + * Retrives a list of users in a group. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetGroupMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetGroupMembers *op); + +struct SamAddGroupMember { + struct { + /**Open handle to a group*/ + POLICY_HND *group_hnd; + + /**RID of new member*/ + uint32 rid; + } in; +}; + +/** + * Adds a user to a group. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamAddGroupMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamAddGroupMember *op); + +struct SamRemoveGroupMember { + struct { + /**Open handle to a group*/ + POLICY_HND *group_hnd; + + /**RID of member to remove*/ + uint32 rid; + } in; +}; + +/** + * Removes a user from a group. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamRemoveGroupMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamRemoveGroupMember *op); + +/** + * Removes all the members of a group - warning: if this function fails is is possible that some but not all members were removed + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param group_hnd Open handle to the group to clear + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamClearGroupMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *group_hnd); + +struct SamSetGroupMembers { + struct { + /**Open handle to the group*/ + POLICY_HND *group_hnd; + + /**Number of members in the group - if this is 0, all members of the group will be removed*/ + uint32 num_members; + + /**The RIDs of the users to add*/ + uint32 *rids; + } in; +}; + +/** + * Clears the members of a group and adds a list of members to the group + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamSetGroupMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetGroupMembers *op); + +struct SamEnumGroups { + struct { + /**Open handle to a domain*/ + POLICY_HND *dom_hnd; + } in; + + struct { + /**Where to resume from _do not_ modify this value. Used over multiple calls.*/ + uint32 resume_idx; + + /**the number of users returned this call*/ + uint32 num_groups; + + /**Array storing the rids of the returned groups*/ + uint32 *rids; + + /**Array storing the names of all the groups returned*/ + char **names; + + /**Array storing the descriptions of all the groups returned*/ + char **descriptions; + + bool done; + } out; +}; + +/** + * Enumerates domain groups. Can be used as a loop condition. Example: while(cac_SamEnumGroups(hnd, mem_ctx, op)) { ... } + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamEnumGroups(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamEnumGroups *op); + +struct SamEnumAliases { + struct { + /**Open handle to a domain*/ + POLICY_HND *dom_hnd; + } in; + + struct { + /**where to resume from. Used over multiple calls*/ + uint32 resume_idx; + + /**the number of users returned this call*/ + uint32 num_aliases; + + /**Array storing the rids of the returned groups*/ + uint32 *rids; + + /**Array storing the names of all the groups returned*/ + char **names; + + /**Array storing the descriptions of all the groups returned*/ + char **descriptions; + + bool done; + } out; +}; + +/** + * Enumerates domain aliases. Can be used as a loop condition. Example: while(cac_SamEnumAliases(hnd, mem_ctx, op)) { ... } + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamEnumAliases(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamEnumAliases *op); + +struct SamCreateAlias { + struct { + /**Open handle to the domain SAM*/ + POLICY_HND *dom_hnd; + + /**The name of the alias*/ + char *name; + } in; + + struct { + /**Handle to the group*/ + POLICY_HND *alias_hnd; + } out; +}; + +/** + * Creates an alias. If the alias already exists it will not be opened. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_SamCreateAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamCreateAlias *op); + +struct SamOpenAlias { + struct { + /**Open handle to the domain SAM*/ + POLICY_HND *dom_hnd; + + /**Desired access to open the group with. See Generic access masks in include/smb.h*/ + uint32 access; + + /**rid of the alias*/ + uint32 rid; + } in; + + struct { + /**Handle to the alias*/ + POLICY_HND *alias_hnd; + } out; +}; + +/** + * Opens a handle to an alias. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamOpenAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamOpenAlias *op); + +/** + * Deletes an alias. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param alias_hnd Open handle to the alias + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamDeleteAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *alias_hnd); + +struct SamAddAliasMember { + struct { + /**Open handle to a alias*/ + POLICY_HND *alias_hnd; + + /**SID of new member*/ + DOM_SID *sid; + } in; +}; + +/** + * Adds an account to an alias. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamAddAliasMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamAddAliasMember *op); + +struct SamRemoveAliasMember { + struct { + /**Open handle to the alias*/ + POLICY_HND *alias_hnd; + + /**The SID of the member*/ + DOM_SID *sid; + } in; +}; + +/** + * Removes an account from an alias. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamRemoveAliasMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamRemoveAliasMember *op); + +struct SamGetAliasMembers { + struct { + /**Open handle to the alias*/ + POLICY_HND *alias_hnd; + } in; + + struct { + /**The number of members*/ + uint32 num_members; + + /**An array storing the SIDs of the accounts*/ + DOM_SID *sids; + } out; +}; + +/** + * Retrieves a list of all accounts in an alias. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetAliasMembers *op); + +/** + * Removes all the members of an alias - warning: if this function fails is is possible that some but not all members were removed + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param alias_hnd Handle to the alias to clear + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_SamClearAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *alias_hnd); + +struct SamSetAliasMembers { + struct { + /**Open handle to the group*/ + POLICY_HND *alias_hnd; + + /**Number of members in the group - if this is 0, all members of the group will be removed*/ + uint32 num_members; + + /**The SIDs of the accounts to add*/ + DOM_SID *sids; + } in; +}; + +/** + * Clears the members of an alias and adds a list of members to the alias + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamSetAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetAliasMembers *op); + + +struct SamUserChangePasswd { + struct { + /**The username*/ + char *username; + + /**The current password*/ + char *password; + + /**The new password*/ + char *new_password; + } in; +}; +/**Used by a user to change their password*/ +int cac_SamUserChangePasswd(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamUserChangePasswd *op); + +/** + * Enables a user + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param user_hnd Open handle to the user to enable + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamEnableUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *user_hnd); + +/** + * Disables a user + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param user_hnd Open handle to the user to disables + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamDisableUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *user_hnd); + +struct SamSetPassword { + struct { + /**Open handle to a user*/ + POLICY_HND *user_hnd; + + /**The new password*/ + char *password; + } in; +}; + +/** + * Sets a user's password + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_SamSetPassword(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetPassword *op); + +struct SamGetUserInfo { + struct { + /**Open Handle to a user*/ + POLICY_HND *user_hnd; + } in; + + struct { + CacUserInfo *info; + } out; +}; + +/** + * Retrieves user information using a CacUserInfo structure. If you would like to use a SAM_USERINFO_CTR directly, use cac_SamGetUserInfoCtr() + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @see cac_SamGetUserInfoCtr() + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetUserInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetUserInfo *op); + +struct SamSetUserInfo { + struct { + /**Open handle to a user*/ + POLICY_HND *user_hnd; + + /**Structure containing the data you would like to set*/ + CacUserInfo *info; + } in; +}; + +/** + * Sets the user info using a CacUserInfo structure. If you would like to use a SAM_USERINFO_CTR directly use cac_SamSetUserInfoCtr(). + * @note All fields in the CacUserInfo structure will be set. Best to call cac_GetUserInfo() modify fields that you want, and then call cac_SetUserInfo(). + * @note When calling this, you _must_ set the user's password. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @see cac_SamSetUserInfoCtr() + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamSetUserInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetUserInfo *op); + +struct SamGetUserInfoCtr { + struct { + /**Open handle to a user*/ + POLICY_HND *user_hnd; + + /**What USER_INFO structure you want. See include/rpc_samr.h*/ + uint16 info_class; + } in; + + struct { + /**returned user info*/ + SAM_USERINFO_CTR *ctr; + } out; +}; + +/** + * Retrieves user information using a SAM_USERINFO_CTR structure. If you don't want to use this structure, user SamGetUserInfo() + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @see cac_SamGetUserInfo() + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetUserInfoCtr(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetUserInfoCtr *op); + +struct SamSetUserInfoCtr { + struct { + /**Open handle to a user*/ + POLICY_HND *user_hnd; + + /**user info - make sure ctr->switch_value is set properly*/ + SAM_USERINFO_CTR *ctr; + } in; +}; + +/** + * Sets the user info using a SAM_USERINFO_CTR structure. If you don't want to use this structure, use cac_SamSetUserInfo() + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @see cac_SamSetUserInfo() + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_SamSetUserInfoCtr(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetUserInfoCtr *op); + +struct SamRenameUser { + struct { + /**Open handle to user*/ + POLICY_HND *user_hnd; + + /**New user name*/ + char *new_name; + } in; +}; + +/** + * Changes the name of a user. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamRenameUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamRenameUser *op); + +struct SamGetGroupInfo { + struct { + /**Open handle to a group*/ + POLICY_HND *group_hnd; + } in; + + struct { + /**Returned info about the group*/ + CacGroupInfo *info; + } out; +}; + +/** + * Retrieves information about a group. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetGroupInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetGroupInfo *op); + +struct SamSetGroupInfo { + struct { + /**Open handle to a group*/ + POLICY_HND *group_hnd; + + /**group info*/ + CacGroupInfo *info; + } in; +}; + +/** + * Sets information about a group. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamSetGroupInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetGroupInfo *op); + +struct SamRenameGroup { + struct { + /**Open handle to a group*/ + POLICY_HND *group_hnd; + + /**New name*/ + char *new_name; + } in; +}; + +/** + * Changes the name of a group + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ + +int cac_SamRenameGroup(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamRenameGroup *op); + +struct SamGetAliasInfo { + struct { + /**Open handle to an alias*/ + POLICY_HND *alias_hnd; + } in; + + struct { + /**Returned alias info*/ + CacAliasInfo *info; + } out; +}; + +/** + * Retrieves information about an alias. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamGetAliasInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetAliasInfo *op); + +struct SamSetAliasInfo { + struct { + /**Open handle to an alias*/ + POLICY_HND *alias_hnd; + + /**Returned alias info*/ + CacAliasInfo *info; + } in; +}; + +/** + * Sets information about an alias. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code + * @return CAC_SUCCESS The operation completed successfully + */ +int cac_SamSetAliasInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetAliasInfo *op); + +struct SamGetDomainInfo { + struct { + /**Open handle to the domain SAM*/ + POLICY_HND *dom_hnd; + } in; + + struct { + /**Returned domain info*/ + CacDomainInfo *info; + } out; +}; + +/** + * Gets domain information in the form of a CacDomainInfo structure. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @see SamGetDomainInfoCtr() + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + * @return CAC_PARTIAL_SUCCESS - This function makes 3 rpc calls, if one or two fail and the rest succeed, + * not all fields in the CacDomainInfo structure will be filled + */ +int cac_SamGetDomainInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDomainInfo *op); + +struct SamGetDomainInfoCtr { + struct { + /**Open handle to domain*/ + POLICY_HND *dom_hnd; + + /**What info level you want*/ + uint16 info_class; + } in; + + struct { + SAM_UNK_CTR *info; + } out; +}; + +/** + * Gets domain information in the form of a SAM_UNK_CTR structure. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @see SamGetDomainInfo() + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SamGetDomainInfoCtr(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDomainInfoCtr *op); + +struct SamGetDisplayInfo { + struct { + /**Open handle to domain*/ + POLICY_HND *dom_hnd; + + /**What type of data*/ + uint16 info_class; + + /**(Optional)If 0, max_entries and max_size will be filled in by the function*/ + uint32 max_entries; + + /**(Optional)If 0, max_entries and max_size will be filled in by the function*/ + uint32 max_size; + } in; + + struct { + /**Do not modify this value, use the same value between multiple calls (ie in while loop)*/ + uint32 resume_idx; + + /**Number of entries returned*/ + uint32 num_entries; + + /**Returned display info*/ + SAM_DISPINFO_CTR ctr; + + /**Internal value. Do not modify.*/ + uint32 loop_count; + + bool done; + } out; +}; + +/** + * Gets dislpay information using a SAM_DISPINFO_CTR. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SamGetDisplayInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDisplayInfo *op); + +struct SamLookupDomain { + struct { + /**Open handle to the sam (opened with cac_SamConnect() or cac_SamOpenDomain()*/ + POLICY_HND *sam; + + /**Name of the domain to lookup*/ + char *name; + } in; + + struct { + /**SID of the domain*/ + DOM_SID *sid; + } out; +}; + +/** + * Looks up a Domain SID given it's name. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SamLookupDomain(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamLookupDomain *op); + +struct SamGetSecurityObject { + struct { + /**An open handle (SAM, domain or user)*/ + POLICY_HND *pol; + } in; + + struct { + SEC_DESC_BUF *sec; + } out; +}; + +/** + * Retrievies Security descriptor information for a SAM/Domain/user + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SamGetSecurityObject(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetSecurityObject *op); + +struct SamFlush { + struct { + /**Open handle to the domain SAM*/ + POLICY_HND *dom_hnd; + + /**(Optional)Domain SID. If NULL, the domain in hnd->domain will be opened*/ + DOM_SID *sid; + + /**(Optional)Desired access to re-open the domain with. If 0, MAXIMUM_ALLOWED_ACCESS is used.*/ + uint32 access; + } in; +}; + +/** + * Closes the domain handle, then re-opens it - effectively flushing any changes made. + * WARNING: if this fails you will no longer have an open handle to the domain SAM. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SamFlush(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamFlush *op); + +/**@}*/ /*SAM_Functions*/ + +/**@addtogroup SCM_Functions + * @{ + */ + +struct SvcOpenScm { + struct { + /**Desired access to open the Handle with. See SC_RIGHT_MGR_* or SC_MANAGER_* in include/rpc_secdes.h*/ + uint32 access; + } in; + + struct { + /**Handle to the SCM*/ + POLICY_HND *scm_hnd; + } out; +}; + +/** + * Opens a handle to the SCM on the remote machine. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcOpenScm(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcOpenScm *op); + +/** + * Closes an Svc handle (SCM or Service) + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param scm_hnd The handle to close + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcClose(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *scm_hnd); + +struct SvcEnumServices { + struct { + /**Open handle to the SCM*/ + POLICY_HND *scm_hnd; + + /**(Optional)Type of service to enumerate. Possible values: + * - SVCCTL_TYPE_WIN32 + * - SVCCTL_TYPE_DRIVER + * If this is 0, (SVCCTL_TYPE_DRIVER | SVCCTL_TYPE_WIN32) is assumed. + */ + uint32 type; + + /**(Optional)State of service to enumerate. Possible values: + * - SVCCTL_STATE_ACTIVE + * - SVCCTL_STATE_INACTIVE + * - SVCCTL_STATE_ALL + * If this is 0, SVCCTL_STATE_ALL is assumed. + */ + uint32 state; + } in; + + struct { + /**Number of services returned*/ + uint32 num_services; + + /**Array of service structures*/ + CacService *services; + } out; +}; + +/** + * Enumerates services on the remote machine. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcEnumServices(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcEnumServices *op); + +struct SvcOpenService { + struct { + /**Handle to the Service Control Manager*/ + POLICY_HND *scm_hnd; + + /**Access mask to open service with see SERVICE_* or SC_RIGHT_SVC_* in include/rpc_secdes.h*/ + uint32 access; + + /**The name of the service. _not_ the display name*/ + char *name; + } in; + + struct { + /**Handle to the open service*/ + POLICY_HND *svc_hnd; + } out; +}; + +/** + * Opens a handle to a service. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ + +int cac_SvcOpenService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcOpenService *op); + +struct SvcGetStatus { + struct { + /**Open handle to the service to query*/ + POLICY_HND *svc_hnd; + } in; + + struct { + /**The status of the service. See include/rpc_svcctl.h for SERVICE_STATUS definition.*/ + SERVICE_STATUS status; + } out; +}; + +/** + * Retrieves the status of a service. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcGetStatus(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetStatus *op); + +struct SvcStartService { + struct { + /**open handle to the service*/ + POLICY_HND *svc_hnd; + + /**Array of parameters to start the service with. Can be NULL if num_parms is 0*/ + char **parms; + + /**Number of parameters in the parms array*/ + uint32 num_parms; + + /**Number of seconds to wait for the service to actually start. If this is 0, then the status will not be checked after the initial call*/ + uint32 timeout; + } in; +}; + +/** + * Attempts to start a service. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ + +int cac_SvcStartService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcStartService *op); + +struct SvcControlService { + struct { + /**Open handle to the service to control*/ + POLICY_HND *svc_hnd; + + /**The control operation to perform. Possible values (from include/rpc_svcctl.h): + * - SVCCTL_CONTROL_STOP + * - SVCCTL_CONTROL_PAUSE + * - SVCCTL_CONTROL_CONTINUE + * - SVCCTL_CONTROL_SHUTDOWN + */ + uint32 control; + } in; + + struct { + /**The returned status of the service, _immediately_ after the call*/ + SERVICE_STATUS *status; + } out; +}; + +/** + * Performs a control operation on a service and _immediately_ returns. + * @see cac_SvcStopService() + * @see cac_SvcPauseService() + * @see cac_SvcContinueService() + * @see cac_SvcShutdownService() + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcControlService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcControlService *op); + +struct SvcStopService { + struct { + /**Open handle to the service*/ + POLICY_HND *svc_hnd; + + /**Number of seconds to wait for the service to actually start. + * If this is 0, then the status will not be checked after the initial call and CAC_SUCCESS might be returned if the status isn't actually started + */ + uint32 timeout; + } in; + + struct { + /**Status of the service after the operation*/ + SERVICE_STATUS status; + } out; +}; + +/** + * Attempts to stop a service. + * @see cacSvcControlService() + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured. + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcStopService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcStopService *op); + +struct SvcPauseService { + struct { + /**Open handle to the service*/ + POLICY_HND *svc_hnd; + + /**Number of seconds to wait for the service to actually start. + * If this is 0, then the status will not be checked after the initial call and CAC_SUCCESS might be returned if the status isn't actually started + */ + uint32 timeout; + } in; + + struct { + /**Status of the service after the operation*/ + SERVICE_STATUS status; + } out; +}; + +/** + * Attempts to pause a service. + * @see cacSvcControlService() + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured. + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcPauseService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcPauseService *op); + +struct SvcContinueService { + struct { + /**Open handle to the service*/ + POLICY_HND *svc_hnd; + + /**Number of seconds to wait for the service to actually start. + * If this is 0, then the status will not be checked after the initial call and CAC_SUCCESS might be returned if the status isn't actually started + */ + uint32 timeout; + } in; + + struct { + /**Status of the service after the operation*/ + SERVICE_STATUS status; + } out; +}; + +/** + * Attempts to continue a paused service. + * @see cacSvcControlService() + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured. + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcContinueService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcContinueService *op); + +struct SvcGetDisplayName { + struct { + /**Open handle to the service*/ + POLICY_HND *svc_hnd; + } in; + + struct { + /**The returned display name of the service*/ + char *display_name; + } out; +}; + +/** + * Retrieves the display name of a service _not currently working_ + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcGetDisplayName(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetDisplayName *op); + +struct SvcGetServiceConfig { + struct { + /**Open handle to the service*/ + POLICY_HND *svc_hnd; + } in; + + struct { + /**Returned Configuration information*/ + CacServiceConfig config; + } out; +}; + +/** + * Retrieves configuration information about a service. + * @param hnd Initialized and connected server handle + * @param mem_ctx Context for memory allocation + * @param op Initialized Parameters + * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately + * @return CAC_SUCCESS - the operation was successful + */ +int cac_SvcGetServiceConfig(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetServiceConfig *op); + +/**@}*/ /*SCM_Functions*/ + +struct rpc_pipe_client *cac_GetPipe(CacServerHandle *hnd, int pi_idx); + +#endif /* LIBMSRPC_H */ + + diff --git a/source3/include/libmsrpc_internal.h b/source3/include/libmsrpc_internal.h new file mode 100644 index 0000000000..623c43f9c3 --- /dev/null +++ b/source3/include/libmsrpc_internal.h @@ -0,0 +1,73 @@ +/* + * Unix SMB/CIFS implementation. + * MS-RPC client internal definitions + * Copyright (C) Chris Nicholls 2005. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef LIBMSRPC_INTERNAL_H +#define LIBMSRPC_INTERNAL_H + +#include "libmsrpc.h" + +/*definitions*/ + +struct CacServerHandleInternal { + /*stores the os type of the server*/ + uint16 srv_level; + + /*stores the initialized/active pipes*/ + bool pipes[PI_MAX_PIPES]; + + /*underlying smbc context*/ + SMBCCTX *ctx; + + /*did the user supply this SMBCCTX?*/ + bool user_supplied_ctx; +}; + +/*used to get a struct rpc_pipe_client* to be passed into rpccli* calls*/ + +/*nessecary prototypes*/ +bool rid_in_list(uint32 rid, uint32 *list, uint32 list_len); + +int cac_ParseRegPath(char *path, uint32 *reg_type, char **key_name); + +REG_VALUE_DATA *cac_MakeRegValueData(TALLOC_CTX *mem_ctx, uint32 data_type, REGVAL_BUFFER buf); + +RPC_DATA_BLOB *cac_MakeRpcDataBlob(TALLOC_CTX *mem_ctx, uint32 data_type, REG_VALUE_DATA data); + +SAM_USERINFO_CTR *cac_MakeUserInfoCtr(TALLOC_CTX *mem_ctx, CacUserInfo *info); + +CacUserInfo *cac_MakeUserInfo(TALLOC_CTX *mem_ctx, SAM_USERINFO_CTR *ctr); +CacGroupInfo *cac_MakeGroupInfo(TALLOC_CTX *mem_ctx, GROUP_INFO_CTR *ctr); +GROUP_INFO_CTR *cac_MakeGroupInfoCtr(TALLOC_CTX *mem_ctx, CacGroupInfo *info); +CacAliasInfo *cac_MakeAliasInfo(TALLOC_CTX *mem_ctx, ALIAS_INFO_CTR ctr); +ALIAS_INFO_CTR *cac_MakeAliasInfoCtr(TALLOC_CTX *mem_ctx, CacAliasInfo *info); +CacDomainInfo *cac_MakeDomainInfo(TALLOC_CTX *mem_ctx, SAM_UNK_INFO_1 *info1, SAM_UNK_INFO_2 *info2, SAM_UNK_INFO_12 *info12); +CacService *cac_MakeServiceArray(TALLOC_CTX *mem_ctx, ENUM_SERVICES_STATUS *svc, uint32 num_services); +int cac_InitCacServiceConfig(TALLOC_CTX *mem_ctx, SERVICE_CONFIG *src, CacServiceConfig *dest); + +/*moved to libmsrpc.h*/ +/*struct rpc_pipe_client *cac_GetPipe(CacServerHandle *hnd, int pi_idx);*/ + +SMBCSRV *smbc_attr_server(SMBCCTX *context, + const char *server, const char *share, + fstring workgroup, + fstring username, fstring password, + POLICY_HND *pol); + + +#endif /* LIBMSRPC_INTERNAL_H */ diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h new file mode 100644 index 0000000000..3b909d13b9 --- /dev/null +++ b/source3/include/libsmb_internal.h @@ -0,0 +1,536 @@ +/* + Unix SMB/Netbios implementation. + SMB client library implementation + Copyright (C) Andrew Tridgell 1998 + Copyright (C) Richard Sharpe 2000, 2002 + Copyright (C) John Terpstra 2000 + Copyright (C) Tom Jansen (Ninja ISD) 2002 + Copyright (C) Derrell Lipman 2003-2008 + Copyright (C) Jeremy Allison 2007, 2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "includes.h" + + +#ifndef _LIBSMB_INTERNAL_H_ +#define _LIBSMB_INTERNAL_H_ + +#include "../include/libsmbclient.h" + +#define SMBC_MAX_NAME 1023 +#define SMBC_FILE_MODE (S_IFREG | 0444) +#define SMBC_DIR_MODE (S_IFDIR | 0555) + +/* + * DOS Attribute values (used internally) + */ +typedef struct DOS_ATTR_DESC { + int mode; + SMB_OFF_T size; + time_t create_time; + time_t access_time; + time_t write_time; + time_t change_time; + SMB_INO_T inode; +} DOS_ATTR_DESC; + + +/* + * Internal flags for extended attributes + */ + +/* internal mode values */ +#define SMBC_XATTR_MODE_ADD 1 +#define SMBC_XATTR_MODE_REMOVE 2 +#define SMBC_XATTR_MODE_REMOVE_ALL 3 +#define SMBC_XATTR_MODE_SET 4 +#define SMBC_XATTR_MODE_CHOWN 5 +#define SMBC_XATTR_MODE_CHGRP 6 + +#define CREATE_ACCESS_READ READ_CONTROL_ACCESS + +/*We should test for this in configure ... */ +#ifndef ENOTSUP +#define ENOTSUP EOPNOTSUPP +#endif + + +struct _SMBCSRV { + struct cli_state *cli; + dev_t dev; + bool no_pathinfo; + bool no_pathinfo2; + bool no_nt_session; + POLICY_HND pol; + + SMBCSRV *next, *prev; + +}; + +/* + * Keep directory entries in a list + */ +struct smbc_dir_list { + struct smbc_dir_list *next; + struct smbc_dirent *dirent; +}; + + +/* + * Structure for open file management + */ +struct _SMBCFILE { + int cli_fd; + char *fname; + SMB_OFF_T offset; + struct _SMBCSRV *srv; + bool file; + struct smbc_dir_list *dir_list, *dir_end, *dir_next; + int dir_type, dir_error; + + SMBCFILE *next, *prev; +}; + + +/* + * Context structure + */ +struct SMBC_internal_data { + + /* True when this handle is initialized */ + bool initialized; + + /* dirent pointer location + * + * Leave room for any urlencoded filename and the comment field. + * + * We really should use sizeof(struct smbc_dirent) plus (NAME_MAX * 3) + * plus whatever the max length of a comment is, plus a couple of null + * terminators (one after the filename, one after the comment). + * + * According to <linux/limits.h>, NAME_MAX is 255. Is it longer + * anyplace else? + */ + char dirent[1024]; + + /* + * server connection list + */ + SMBCSRV * servers; + + /* + * open file/dir list + */ + SMBCFILE * files; + + /* + * Log to standard error instead of the more typical standard output + */ + bool debug_stderr; + + /* + * Support "Create Time" in get/set with the *xattr() functions, if + * true. This replaces the dos attribute strings C_TIME, A_TIME and + * M_TIME with CHANGE_TIME, ACCESS_TIME and WRITE_TIME, and adds + * CREATE_TIME. Default is FALSE, i.e. to use the old-style shorter + * names and to not support CREATE time, for backward compatibility. + */ + bool full_time_names; + + /* + * The share mode of a file being opened. To match POSIX semantics + * (and maintain backward compatibility), DENY_NONE is the default. + */ + smbc_share_mode share_mode; + + /* + * Authentication function which includes the context. This will be + * used if set; otherwise context->callbacks.auth_fn() will be used. + */ + smbc_get_auth_data_with_context_fn auth_fn_with_context; + + /* + * An opaque (to this library) user data handle which can be set + * and retrieved with smbc_option_set() and smbc_option_get(). + */ + void * user_data; + + /* + * Should we attempt UNIX smb encryption ? + * Set to 0 if we should never attempt, set to 1 if + * encryption requested, set to 2 if encryption required. + */ + smbc_smb_encrypt_level smb_encryption_level; + + struct smbc_server_cache * server_cache; + + /* POSIX emulation functions */ + struct + { +#if 0 /* Left in libsmbclient.h for backward compatibility */ + smbc_open_fn open_fn; + smbc_creat_fn creat_fn; + smbc_read_fn read_fn; + smbc_write_fn write_fn; + smbc_unlink_fn unlink_fn; + smbc_rename_fn rename_fn; + smbc_lseek_fn lseek_fn; + smbc_stat_fn stat_fn; + smbc_fstat_fn fstat_fn; +#endif + smbc_ftruncate_fn ftruncate_fn; +#if 0 /* Left in libsmbclient.h for backward compatibility */ + smbc_close_fn close_fn; + smbc_opendir_fn opendir_fn; + smbc_closedir_fn closedir_fn; + smbc_readdir_fn readdir_fn; + smbc_getdents_fn getdents_fn; + smbc_mkdir_fn mkdir_fn; + smbc_rmdir_fn rmdir_fn; + smbc_telldir_fn telldir_fn; + smbc_lseekdir_fn lseekdir_fn; + smbc_fstatdir_fn fstatdir_fn; + smbc_chmod_fn chmod_fn; + smbc_utimes_fn utimes_fn; + smbc_setxattr_fn setxattr_fn; + smbc_getxattr_fn getxattr_fn; + smbc_removexattr_fn removexattr_fn; + smbc_listxattr_fn listxattr_fn; +#endif + } posix_emu; + +#if 0 /* Left in libsmbclient.h for backward compatibility */ + /* Printing-related functions */ + struct + { + smbc_print_file_fn print_file_fn; + smbc_open_print_job_fn open_print_job_fn; + smbc_list_print_jobs_fn list_print_jobs_fn; + smbc_unlink_print_job_fn unlink_print_job_fn; + } printing; +#endif + +#if 0 /* None available yet */ + /* SMB high-level functions */ + struct + { + } smb; + +#endif +}; + +/* Functions in libsmb_cache.c */ +int +SMBC_add_cached_server(SMBCCTX * context, + SMBCSRV * newsrv, + const char * server, + const char * share, + const char * workgroup, + const char * username); + +SMBCSRV * +SMBC_get_cached_server(SMBCCTX * context, + const char * server, + const char * share, + const char * workgroup, + const char * user); + +int +SMBC_remove_cached_server(SMBCCTX * context, + SMBCSRV * server); + +int +SMBC_purge_cached_servers(SMBCCTX * context); + + +/* Functions in libsmb_dir.c */ +int +SMBC_check_options(char *server, + char *share, + char *path, + char *options); + +SMBCFILE * +SMBC_opendir_ctx(SMBCCTX *context, + const char *fname); + +int +SMBC_closedir_ctx(SMBCCTX *context, + SMBCFILE *dir); + +struct smbc_dirent * +SMBC_readdir_ctx(SMBCCTX *context, + SMBCFILE *dir); + +int +SMBC_getdents_ctx(SMBCCTX *context, + SMBCFILE *dir, + struct smbc_dirent *dirp, + int count); + +int +SMBC_mkdir_ctx(SMBCCTX *context, + const char *fname, + mode_t mode); + +int +SMBC_rmdir_ctx(SMBCCTX *context, + const char *fname); + +off_t +SMBC_telldir_ctx(SMBCCTX *context, + SMBCFILE *dir); + +int +SMBC_lseekdir_ctx(SMBCCTX *context, + SMBCFILE *dir, + off_t offset); + +int +SMBC_fstatdir_ctx(SMBCCTX *context, + SMBCFILE *dir, + struct stat *st); + +int +SMBC_chmod_ctx(SMBCCTX *context, + const char *fname, + mode_t newmode); + +int +SMBC_utimes_ctx(SMBCCTX *context, + const char *fname, + struct timeval *tbuf); + +int +SMBC_unlink_ctx(SMBCCTX *context, + const char *fname); + +int +SMBC_rename_ctx(SMBCCTX *ocontext, + const char *oname, + SMBCCTX *ncontext, + const char *nname); + + +/* Functions in libsmb_file.c */ +SMBCFILE * +SMBC_open_ctx(SMBCCTX *context, + const char *fname, + int flags, + mode_t mode); + +SMBCFILE * +SMBC_creat_ctx(SMBCCTX *context, + const char *path, + mode_t mode); + +ssize_t +SMBC_read_ctx(SMBCCTX *context, + SMBCFILE *file, + void *buf, + size_t count); + +ssize_t +SMBC_write_ctx(SMBCCTX *context, + SMBCFILE *file, + const void *buf, + size_t count); + +int +SMBC_close_ctx(SMBCCTX *context, + SMBCFILE *file); + +bool +SMBC_getatr(SMBCCTX * context, + SMBCSRV *srv, + char *path, + uint16 *mode, + SMB_OFF_T *size, + struct timespec *create_time_ts, + struct timespec *access_time_ts, + struct timespec *write_time_ts, + struct timespec *change_time_ts, + SMB_INO_T *ino); + +bool +SMBC_setatr(SMBCCTX * context, SMBCSRV *srv, char *path, + time_t create_time, + time_t access_time, + time_t write_time, + time_t change_time, + uint16 mode); + +off_t +SMBC_lseek_ctx(SMBCCTX *context, + SMBCFILE *file, + off_t offset, + int whence); + +int +SMBC_ftruncate_ctx(SMBCCTX *context, + SMBCFILE *file, + off_t length); + + +/* Functions in libsmb_misc.c */ +int +SMBC_dlist_contains(SMBCFILE * list, SMBCFILE *p); + +int +SMBC_errno(SMBCCTX *context, + struct cli_state *c); + + +/* Functions in libsmb_path.c */ +int +SMBC_urldecode(char *dest, + char *src, + size_t max_dest_len); + +int +SMBC_urlencode(char *dest, + char *src, + int max_dest_len); + +int +SMBC_parse_path(TALLOC_CTX *ctx, + SMBCCTX *context, + const char *fname, + char **pp_workgroup, + char **pp_server, + char **pp_share, + char **pp_path, + char **pp_user, + char **pp_password, + char **pp_options); + + +/* Functions in libsmb_printjob.c */ +SMBCFILE * +SMBC_open_print_job_ctx(SMBCCTX *context, + const char *fname); + +int +SMBC_print_file_ctx(SMBCCTX *c_file, + const char *fname, + SMBCCTX *c_print, + const char *printq); + +int +SMBC_list_print_jobs_ctx(SMBCCTX *context, + const char *fname, + smbc_list_print_job_fn fn); + +int +SMBC_unlink_print_job_ctx(SMBCCTX *context, + const char *fname, + int id); + + +/* Functions in libsmb_server.c */ +int +SMBC_check_server(SMBCCTX * context, + SMBCSRV * server); + +int +SMBC_remove_unused_server(SMBCCTX * context, + SMBCSRV * srv); + +void +SMBC_call_auth_fn(TALLOC_CTX *ctx, + SMBCCTX *context, + const char *server, + const char *share, + char **pp_workgroup, + char **pp_username, + char **pp_password); + +void +SMBC_get_auth_data(const char *server, const char *share, + char *workgroup_buf, int workgroup_buf_len, + char *username_buf, int username_buf_len, + char *password_buf, int password_buf_len); + +SMBCSRV * +SMBC_find_server(TALLOC_CTX *ctx, + SMBCCTX *context, + const char *server, + const char *share, + char **pp_workgroup, + char **pp_username, + char **pp_password); + +SMBCSRV * +SMBC_server(TALLOC_CTX *ctx, + SMBCCTX *context, + bool connect_if_not_found, + const char *server, + const char *share, + char **pp_workgroup, + char **pp_username, + char **pp_password); + +SMBCSRV * +SMBC_attr_server(TALLOC_CTX *ctx, + SMBCCTX *context, + const char *server, + const char *share, + char **pp_workgroup, + char **pp_username, + char **pp_password); + + +/* Functions in libsmb_stat.c */ +int +SMBC_stat_ctx(SMBCCTX *context, + const char *fname, + struct stat *st); + +int +SMBC_fstat_ctx(SMBCCTX *context, + SMBCFILE *file, + struct stat *st); + + +/* Functions in libsmb_xattr.c */ +int +SMBC_setxattr_ctx(SMBCCTX *context, + const char *fname, + const char *name, + const void *value, + size_t size, + int flags); + +int +SMBC_getxattr_ctx(SMBCCTX *context, + const char *fname, + const char *name, + const void *value, + size_t size); + +int +SMBC_removexattr_ctx(SMBCCTX *context, + const char *fname, + const char *name); + +int +SMBC_listxattr_ctx(SMBCCTX *context, + const char *fname, + char *list, + size_t size); + + +#endif diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h new file mode 100644 index 0000000000..a8b27b709e --- /dev/null +++ b/source3/include/libsmbclient.h @@ -0,0 +1,2819 @@ +/*===================================================================== + Unix SMB/Netbios implementation. + SMB client library API definitions + Copyright (C) Andrew Tridgell 1998 + Copyright (C) Richard Sharpe 2000 + Copyright (C) John Terpsra 2000 + Copyright (C) Tom Jansen (Ninja ISD) 2002 + Copyright (C) Derrell Lipman 2003-2008 + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + =====================================================================*/ + +#ifndef SMBCLIENT_H_INCLUDED +#define SMBCLIENT_H_INCLUDED + +#undef DEPRECATED_SMBC_INTERFACE +#if ! defined(__LIBSMBCLIENT_INTERNAL__) && defined(__GNUC__) +# define DEPRECATED_SMBC_INTERFACE __attribute__ ((deprecated)) +#else +# define DEPRECATED_SMBC_INTERFACE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/*-------------------------------------------------------------------*/ +/* The following are special comments to instruct DOXYGEN (automated + * documentation tool: +*/ +/** \defgroup libsmbclient +*/ +/** \defgroup structure Data Structures Type and Constants +* \ingroup libsmbclient +* Data structures, types, and constants +*/ +/** \defgroup callback Callback function types +* \ingroup libsmbclient +* Callback functions +*/ +/** \defgroup file File Functions +* \ingroup libsmbclient +* Functions used to access individual file contents +*/ +/** \defgroup directory Directory Functions +* \ingroup libsmbclient +* Functions used to access directory entries +*/ +/** \defgroup attribute Attributes Functions +* \ingroup libsmbclient +* Functions used to view or change file and directory attributes +*/ +/** \defgroup print Print Functions +* \ingroup libsmbclient +* Functions used to access printing functionality +*/ +/** \defgroup misc Miscellaneous Functions +* \ingroup libsmbclient +* Functions that don't fit in to other categories +*/ +/*-------------------------------------------------------------------*/ + +/* Make sure we have the following includes for now ... */ +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <utime.h> + +#define SMBC_BASE_FD 10000 /* smallest file descriptor returned */ + +#define SMBC_WORKGROUP 1 +#define SMBC_SERVER 2 +#define SMBC_FILE_SHARE 3 +#define SMBC_PRINTER_SHARE 4 +#define SMBC_COMMS_SHARE 5 +#define SMBC_IPC_SHARE 6 +#define SMBC_DIR 7 +#define SMBC_FILE 8 +#define SMBC_LINK 9 + +/**@ingroup structure + * Structure that represents a directory entry. + * + */ +struct smbc_dirent +{ + /** Type of entity. + SMBC_WORKGROUP=1, + SMBC_SERVER=2, + SMBC_FILE_SHARE=3, + SMBC_PRINTER_SHARE=4, + SMBC_COMMS_SHARE=5, + SMBC_IPC_SHARE=6, + SMBC_DIR=7, + SMBC_FILE=8, + SMBC_LINK=9,*/ + unsigned int smbc_type; + + /** Length of this smbc_dirent in bytes + */ + unsigned int dirlen; + /** The length of the comment string in bytes (does not include + * null terminator) + */ + unsigned int commentlen; + /** Points to the null terminated comment string + */ + char *comment; + /** The length of the name string in bytes (does not include + * null terminator) + */ + unsigned int namelen; + /** Points to the null terminated name string + */ + char name[1]; +}; + +/* + * Flags for smbc_setxattr() + * Specify a bitwise OR of these, or 0 to add or replace as necessary + */ +#define SMBC_XATTR_FLAG_CREATE 0x1 /* fail if attr already exists */ +#define SMBC_XATTR_FLAG_REPLACE 0x2 /* fail if attr does not exist */ + + +/* + * Mappings of the DOS mode bits, as returned by smbc_getxattr() when the + * attribute name "system.dos_attr.mode" (or "system.dos_attr.*" or + * "system.*") is specified. + */ +#define SMBC_DOS_MODE_READONLY 0x01 +#define SMBC_DOS_MODE_HIDDEN 0x02 +#define SMBC_DOS_MODE_SYSTEM 0x04 +#define SMBC_DOS_MODE_VOLUME_ID 0x08 +#define SMBC_DOS_MODE_DIRECTORY 0x10 +#define SMBC_DOS_MODE_ARCHIVE 0x20 + +/* + * Valid values for the option "open_share_mode", when calling + * smbc_setOptionOpenShareMode() + */ +typedef enum smbc_share_mode +{ + SMBC_SHAREMODE_DENY_DOS = 0, + SMBC_SHAREMODE_DENY_ALL = 1, + SMBC_SHAREMODE_DENY_WRITE = 2, + SMBC_SHAREMODE_DENY_READ = 3, + SMBC_SHAREMODE_DENY_NONE = 4, + SMBC_SHAREMODE_DENY_FCB = 7 +} smbc_share_mode; + + +/** + * Values for option SMB Encryption Level, as set and retrieved with + * smbc_setOptionSmbEncryptionLevel() and smbc_getOptionSmbEncryptionLevel() + */ +typedef enum smbc_smb_encrypt_level +{ + SMBC_ENCRYPTLEVEL_NONE = 0, + SMBC_ENCRYPTLEVEL_REQUEST = 1, + SMBC_ENCRYPTLEVEL_REQUIRE = 2 +} smbc_smb_encrypt_level; + + +typedef int smbc_bool; + + +#ifndef ENOATTR +# define ENOATTR ENOENT /* No such attribute */ +#endif + + + + +/**@ingroup structure + * Structure that represents a print job. + * + */ +#ifndef _CLIENT_H +struct print_job_info +{ + /** numeric ID of the print job + */ + unsigned short id; + + /** represents print job priority (lower numbers mean higher priority) + */ + unsigned short priority; + + /** Size of the print job + */ + size_t size; + + /** Name of the user that owns the print job + */ + char user[128]; + + /** Name of the print job. This will have no name if an anonymous print + * file was opened. Ie smb://server/printer + */ + char name[128]; + + /** Time the print job was spooled + */ + time_t t; +}; +#endif /* _CLIENT_H */ + + +/**@ingroup structure + * Server handle + */ +typedef struct _SMBCSRV SMBCSRV; + +/**@ingroup structure + * File or directory handle + */ +typedef struct _SMBCFILE SMBCFILE; + +/**@ingroup structure + * File or directory handle + */ +typedef struct _SMBCCTX SMBCCTX; + + +/* + * Flags for SMBCCTX->flags + * + * NEW CODE SHOULD NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE. + * Instead, use: + * smbc_setOptionUseKerberos() + * smbc_getOptionUseKerberos() + * smbc_setOptionFallbackAfterKerberos() + * smbc_getOptionFallbackAFterKerberos() + * smbc_setOptionNoAutoAnonymousLogin() + * smbc_getOptionNoAutoAnonymousLogin() + */ +# define SMB_CTX_FLAG_USE_KERBEROS (1 << 0) +# define SMB_CTX_FLAG_FALLBACK_AFTER_KERBEROS (1 << 1) +# define SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON (1 << 2) + + + +/**@ingroup callback + * Authentication callback function type (traditional method) + * + * Type for the the authentication function called by the library to + * obtain authentication credentals + * + * For kerberos support the function should just be called without + * prompting the user for credentials. Which means a simple 'return' + * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h + * and examples/libsmbclient/testbrowse.c. + * + * @param srv Server being authenticated to + * + * @param shr Share being authenticated to + * + * @param wg Pointer to buffer containing a "hint" for the + * workgroup to be authenticated. Should be filled in + * with the correct workgroup if the hint is wrong. + * + * @param wglen The size of the workgroup buffer in bytes + * + * @param un Pointer to buffer containing a "hint" for the + * user name to be use for authentication. Should be + * filled in with the correct workgroup if the hint is + * wrong. + * + * @param unlen The size of the username buffer in bytes + * + * @param pw Pointer to buffer containing to which password + * copied + * + * @param pwlen The size of the password buffer in bytes + * + */ +typedef void (*smbc_get_auth_data_fn)(const char *srv, + const char *shr, + char *wg, int wglen, + char *un, int unlen, + char *pw, int pwlen); +/**@ingroup callback + * Authentication callback function type (method that includes context) + * + * Type for the the authentication function called by the library to + * obtain authentication credentals + * + * For kerberos support the function should just be called without + * prompting the user for credentials. Which means a simple 'return' + * should work. Take a look at examples/libsmbclient/get_auth_data_fn.h + * and examples/libsmbclient/testbrowse.c. + * + * @param c Pointer to the smb context + * + * @param srv Server being authenticated to + * + * @param shr Share being authenticated to + * + * @param wg Pointer to buffer containing a "hint" for the + * workgroup to be authenticated. Should be filled in + * with the correct workgroup if the hint is wrong. + * + * @param wglen The size of the workgroup buffer in bytes + * + * @param un Pointer to buffer containing a "hint" for the + * user name to be use for authentication. Should be + * filled in with the correct workgroup if the hint is + * wrong. + * + * @param unlen The size of the username buffer in bytes + * + * @param pw Pointer to buffer containing to which password + * copied + * + * @param pwlen The size of the password buffer in bytes + * + */ +typedef void (*smbc_get_auth_data_with_context_fn)(SMBCCTX *c, + const char *srv, + const char *shr, + char *wg, int wglen, + char *un, int unlen, + char *pw, int pwlen); + + +/**@ingroup callback + * Print job info callback function type. + * + * @param i pointer to print job information structure + * + */ +typedef void (*smbc_list_print_job_fn)(struct print_job_info *i); + + +/**@ingroup callback + * Check if a server is still good + * + * @param c pointer to smb context + * + * @param srv pointer to server to check + * + * @return 0 when connection is good. 1 on error. + * + */ +typedef int (*smbc_check_server_fn)(SMBCCTX * c, SMBCSRV *srv); + +/**@ingroup callback + * Remove a server if unused + * + * @param c pointer to smb context + * + * @param srv pointer to server to remove + * + * @return 0 on success. 1 on failure. + * + */ +typedef int (*smbc_remove_unused_server_fn)(SMBCCTX * c, SMBCSRV *srv); + + +/**@ingroup callback + * Add a server to the cache system + * + * @param c pointer to smb context + * + * @param srv pointer to server to add + * + * @param server server name + * + * @param share share name + * + * @param workgroup workgroup used to connect + * + * @param username username used to connect + * + * @return 0 on success. 1 on failure. + * + */ +typedef int (*smbc_add_cached_srv_fn) (SMBCCTX * c, SMBCSRV *srv, + const char * server, const char * share, + const char * workgroup, const char * username); + +/**@ingroup callback + * Look up a server in the cache system + * + * @param c pointer to smb context + * + * @param server server name to match + * + * @param share share name to match + * + * @param workgroup workgroup to match + * + * @param username username to match + * + * @return pointer to SMBCSRV on success. NULL on failure. + * + */ +typedef SMBCSRV * (*smbc_get_cached_srv_fn) (SMBCCTX * c, const char * server, + const char * share, const char * workgroup, + const char * username); + +/**@ingroup callback + * Check if a server is still good + * + * @param c pointer to smb context + * + * @param srv pointer to server to remove + * + * @return 0 when found and removed. 1 on failure. + * + */ +typedef int (*smbc_remove_cached_srv_fn)(SMBCCTX * c, SMBCSRV *srv); + + +/**@ingroup callback + * Try to remove all servers from the cache system and disconnect + * + * @param c pointer to smb context + * + * @return 0 when found and removed. 1 on failure. + * + */ +typedef int (*smbc_purge_cached_fn) (SMBCCTX * c); + + + +/***************************************** + * Getters and setters for CONFIGURATION * + *****************************************/ + +/** Get the debug level */ +int +smbc_getDebug(SMBCCTX *c); + +/** Set the debug level */ +void +smbc_setDebug(SMBCCTX *c, int debug); + +/** Get the netbios name used for making connections */ +char * +smbc_getNetbiosName(SMBCCTX *c); + +/** Set the netbios name used for making connections */ +void +smbc_setNetbiosName(SMBCCTX *c, char * netbios_name); + +/** Get the workgroup used for making connections */ +char * +smbc_getWorkgroup(SMBCCTX *c); + +/** Set the workgroup used for making connections */ +void smbc_setWorkgroup(SMBCCTX *c, char * workgroup); + +/** Get the username used for making connections */ +char * +smbc_getUser(SMBCCTX *c); + +/** Set the username used for making connections */ +void +smbc_setUser(SMBCCTX *c, char * user); + +/** + * Get the timeout used for waiting on connections and response data + * (in milliseconds) + */ +int +smbc_getTimeout(SMBCCTX *c); + +/** + * Set the timeout used for waiting on connections and response data + * (in milliseconds) + */ +void +smbc_setTimeout(SMBCCTX *c, int timeout); + + + +/*********************************** + * Getters and setters for OPTIONS * + ***********************************/ + +/** Get whether to log to standard error instead of standard output */ +smbc_bool +smbc_getOptionDebugToStderr(SMBCCTX *c); + +/** Set whether to log to standard error instead of standard output */ +void +smbc_setOptionDebugToStderr(SMBCCTX *c, smbc_bool b); + +/** + * Get whether to use new-style time attribute names, e.g. WRITE_TIME rather + * than the old-style names such as M_TIME. This allows also setting/getting + * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME + * was supposed to be CHANGE_TIME but was confused and sometimes referred to + * CREATE_TIME.) + */ +smbc_bool +smbc_getOptionFullTimeNames(SMBCCTX *c); + +/** + * Set whether to use new-style time attribute names, e.g. WRITE_TIME rather + * than the old-style names such as M_TIME. This allows also setting/getting + * CREATE_TIME which was previously unimplemented. (Note that the old C_TIME + * was supposed to be CHANGE_TIME but was confused and sometimes referred to + * CREATE_TIME.) + */ +void +smbc_setOptionFullTimeNames(SMBCCTX *c, smbc_bool b); + +/** + * Get the share mode to use for files opened with SMBC_open_ctx(). The + * default is SMBC_SHAREMODE_DENY_NONE. + */ +smbc_share_mode +smbc_getOptionOpenShareMode(SMBCCTX *c); + +/** + * Set the share mode to use for files opened with SMBC_open_ctx(). The + * default is SMBC_SHAREMODE_DENY_NONE. + */ +void +smbc_setOptionOpenShareMode(SMBCCTX *c, smbc_share_mode share_mode); + +/** Retrieve a previously saved user data handle */ +void * +smbc_getOptionUserData(SMBCCTX *c); + +/** Save a user data handle */ +void +smbc_setOptionUserData(SMBCCTX *c, void *user_data); + +/** Get the encoded value for encryption level. */ +smbc_smb_encrypt_level +smbc_getOptionSmbEncryptionLevel(SMBCCTX *c); + +/** Set the encoded value for encryption level. */ +void +smbc_setOptionSmbEncryptionLevel(SMBCCTX *c, smbc_smb_encrypt_level level); + +/** + * Get from how many local master browsers should the list of workgroups be + * retrieved. It can take up to 12 minutes or longer after a server becomes a + * local master browser, for it to have the entire browse list (the list of + * workgroups/domains) from an entire network. Since a client never knows + * which local master browser will be found first, the one which is found + * first and used to retrieve a browse list may have an incomplete or empty + * browse list. By requesting the browse list from multiple local master + * browsers, a more complete list can be generated. For small networks (few + * workgroups), it is recommended that this value be set to 0, causing the + * browse lists from all found local master browsers to be retrieved and + * merged. For networks with many workgroups, a suitable value for this + * variable is probably somewhere around 3. (Default: 3). + */ +int +smbc_getOptionBrowseMaxLmbCount(SMBCCTX *c); + +/** + * Set from how many local master browsers should the list of workgroups be + * retrieved. It can take up to 12 minutes or longer after a server becomes a + * local master browser, for it to have the entire browse list (the list of + * workgroups/domains) from an entire network. Since a client never knows + * which local master browser will be found first, the one which is found + * first and used to retrieve a browse list may have an incomplete or empty + * browse list. By requesting the browse list from multiple local master + * browsers, a more complete list can be generated. For small networks (few + * workgroups), it is recommended that this value be set to 0, causing the + * browse lists from all found local master browsers to be retrieved and + * merged. For networks with many workgroups, a suitable value for this + * variable is probably somewhere around 3. (Default: 3). + */ +void +smbc_setOptionBrowseMaxLmbCount(SMBCCTX *c, int count); + +/** + * Get whether to url-encode readdir entries. + * + * There is a difference in the desired return strings from + * smbc_readdir() depending upon whether the filenames are to + * be displayed to the user, or whether they are to be + * appended to the path name passed to smbc_opendir() to call + * a further smbc_ function (e.g. open the file with + * smbc_open()). In the former case, the filename should be + * in "human readable" form. In the latter case, the smbc_ + * functions expect a URL which must be url-encoded. Those + * functions decode the URL. If, for example, smbc_readdir() + * returned a file name of "abc%20def.txt", passing a path + * with this file name attached to smbc_open() would cause + * smbc_open to attempt to open the file "abc def.txt" since + * the %20 is decoded into a space. + * + * Set this option to True if the names returned by + * smbc_readdir() should be url-encoded such that they can be + * passed back to another smbc_ call. Set it to False if the + * names returned by smbc_readdir() are to be presented to the + * user. + * + * For backwards compatibility, this option defaults to False. + */ +smbc_bool +smbc_getOptionUrlEncodeReaddirEntries(SMBCCTX *c); + +/** + * Set whether to url-encode readdir entries. + * + * There is a difference in the desired return strings from + * smbc_readdir() depending upon whether the filenames are to + * be displayed to the user, or whether they are to be + * appended to the path name passed to smbc_opendir() to call + * a further smbc_ function (e.g. open the file with + * smbc_open()). In the former case, the filename should be + * in "human readable" form. In the latter case, the smbc_ + * functions expect a URL which must be url-encoded. Those + * functions decode the URL. If, for example, smbc_readdir() + * returned a file name of "abc%20def.txt", passing a path + * with this file name attached to smbc_open() would cause + * smbc_open to attempt to open the file "abc def.txt" since + * the %20 is decoded into a space. + * + * Set this option to True if the names returned by + * smbc_readdir() should be url-encoded such that they can be + * passed back to another smbc_ call. Set it to False if the + * names returned by smbc_readdir() are to be presented to the + * user. + * + * For backwards compatibility, this option defaults to False. + */ +void +smbc_setOptionUrlEncodeReaddirEntries(SMBCCTX *c, smbc_bool b); + +/** + * Get whether to use the same connection for all shares on a server. + * + * Some Windows versions appear to have a limit to the number + * of concurrent SESSIONs and/or TREE CONNECTions. In + * one-shot programs (i.e. the program runs and then quickly + * ends, thereby shutting down all connections), it is + * probably reasonable to establish a new connection for each + * share. In long-running applications, the limitation can be + * avoided by using only a single connection to each server, + * and issuing a new TREE CONNECT when the share is accessed. + */ +smbc_bool +smbc_getOptionOneSharePerServer(SMBCCTX *c); + +/** + * Set whether to use the same connection for all shares on a server. + * + * Some Windows versions appear to have a limit to the number + * of concurrent SESSIONs and/or TREE CONNECTions. In + * one-shot programs (i.e. the program runs and then quickly + * ends, thereby shutting down all connections), it is + * probably reasonable to establish a new connection for each + * share. In long-running applications, the limitation can be + * avoided by using only a single connection to each server, + * and issuing a new TREE CONNECT when the share is accessed. + */ +void +smbc_setOptionOneSharePerServer(SMBCCTX *c, smbc_bool b); + +/** Get whether to enable use of kerberos */ +smbc_bool +smbc_getOptionUseKerberos(SMBCCTX *c); + +/** Set whether to enable use of kerberos */ +void +smbc_setOptionUseKerberos(SMBCCTX *c, smbc_bool b); + +/** Get whether to fallback after kerberos */ +smbc_bool +smbc_getOptionFallbackAfterKerberos(SMBCCTX *c); + +/** Set whether to fallback after kerberos */ +void +smbc_setOptionFallbackAfterKerberos(SMBCCTX *c, smbc_bool b); + +/** Get whether to automatically select anonymous login */ +smbc_bool +smbc_getOptionNoAutoAnonymousLogin(SMBCCTX *c); + +/** Set whether to automatically select anonymous login */ +void +smbc_setOptionNoAutoAnonymousLogin(SMBCCTX *c, smbc_bool b); + + + +/************************************* + * Getters and setters for FUNCTIONS * + *************************************/ + +/** Get the function for obtaining authentication data */ +smbc_get_auth_data_fn smbc_getFunctionAuthData(SMBCCTX *c); + +/** Set the function for obtaining authentication data */ +void smbc_setFunctionAuthData(SMBCCTX *c, smbc_get_auth_data_fn fn); + +/** Get the new-style authentication function which includes the context. */ +smbc_get_auth_data_with_context_fn +smbc_getFunctionAuthDataWithContext(SMBCCTX *c); + +/** Set the new-style authentication function which includes the context. */ +void +smbc_setFunctionAuthDataWithContext(SMBCCTX *c, + smbc_get_auth_data_with_context_fn fn); + +/** Get the function for checking if a server is still good */ +smbc_check_server_fn smbc_getFunctionCheckServer(SMBCCTX *c); + +/** Set the function for checking if a server is still good */ +void smbc_setFunctionCheckServer(SMBCCTX *c, smbc_check_server_fn fn); + +/** Get the function for removing a server if unused */ +smbc_remove_unused_server_fn smbc_getFunctionRemoveUnusedServer(SMBCCTX *c); + +/** Set the function for removing a server if unused */ +void smbc_setFunctionRemoveUnusedServer(SMBCCTX *c, + smbc_remove_unused_server_fn fn); + +/** Get the function for adding a cached server */ +smbc_add_cached_srv_fn smbc_getFunctionAddCachedServer(SMBCCTX *c); + +/** Set the function for adding a cached server */ +void smbc_setFunctionAddCachedServer(SMBCCTX *c, smbc_add_cached_srv_fn fn); + +/** Get the function for server cache lookup */ +smbc_get_cached_srv_fn smbc_getFunctionGetCachedServer(SMBCCTX *c); + +/** Set the function for server cache lookup */ +void smbc_setFunctionGetCachedServer(SMBCCTX *c, smbc_get_cached_srv_fn fn); + +/** Get the function for server cache removal */ +smbc_remove_cached_srv_fn smbc_getFunctionRemoveCachedServer(SMBCCTX *c); + +/** Set the function for server cache removal */ +void smbc_setFunctionRemoveCachedServer(SMBCCTX *c, + smbc_remove_cached_srv_fn fn); + +/** + * Get the function for server cache purging. This function tries to + * remove all cached servers (e.g. on disconnect) + */ +smbc_purge_cached_fn smbc_getFunctionPurgeCachedServers(SMBCCTX *c); + +/** + * Set the function for server cache purging. This function tries to + * remove all cached servers (e.g. on disconnect) + */ +void smbc_setFunctionPurgeCachedServers(SMBCCTX *c, + smbc_purge_cached_fn fn); + +/** Get the function to store private data of the server cache */ +struct smbc_server_cache * smbc_getServerCacheData(SMBCCTX *c); + +/** Set the function to store private data of the server cache */ +void smbc_setServerCacheData(SMBCCTX *c, struct smbc_server_cache * cache); + + + +/***************************************************************** + * Callable functions for files. * + * Each callable has a function signature typedef, a declaration * + * for the getter, and a declaration for the setter. * + *****************************************************************/ + +typedef SMBCFILE * (*smbc_open_fn)(SMBCCTX *c, + const char *fname, + int flags, + mode_t mode); +smbc_open_fn smbc_getFunctionOpen(SMBCCTX *c); +void smbc_setFunctionOpen(SMBCCTX *c, smbc_open_fn fn); + +typedef SMBCFILE * (*smbc_creat_fn)(SMBCCTX *c, + const char *path, + mode_t mode); +smbc_creat_fn smbc_getFunctionCreat(SMBCCTX *c); +void smbc_setFunctionCreat(SMBCCTX *c, smbc_creat_fn); + +typedef ssize_t (*smbc_read_fn)(SMBCCTX *c, + SMBCFILE *file, + void *buf, + size_t count); +smbc_read_fn smbc_getFunctionRead(SMBCCTX *c); +void smbc_setFunctionRead(SMBCCTX *c, smbc_read_fn fn); + +typedef ssize_t (*smbc_write_fn)(SMBCCTX *c, + SMBCFILE *file, + const void *buf, + size_t count); +smbc_write_fn smbc_getFunctionWrite(SMBCCTX *c); +void smbc_setFunctionWrite(SMBCCTX *c, smbc_write_fn fn); + +typedef int (*smbc_unlink_fn)(SMBCCTX *c, + const char *fname); +smbc_unlink_fn smbc_getFunctionUnlink(SMBCCTX *c); +void smbc_setFunctionUnlink(SMBCCTX *c, smbc_unlink_fn fn); + +typedef int (*smbc_rename_fn)(SMBCCTX *ocontext, + const char *oname, + SMBCCTX *ncontext, + const char *nname); +smbc_rename_fn smbc_getFunctionRename(SMBCCTX *c); +void smbc_setFunctionRename(SMBCCTX *c, smbc_rename_fn fn); + +typedef off_t (*smbc_lseek_fn)(SMBCCTX *c, + SMBCFILE * file, + off_t offset, + int whence); +smbc_lseek_fn smbc_getFunctionLseek(SMBCCTX *c); +void smbc_setFunctionLseek(SMBCCTX *c, smbc_lseek_fn fn); + +typedef int (*smbc_stat_fn)(SMBCCTX *c, + const char *fname, + struct stat *st); +smbc_stat_fn smbc_getFunctionStat(SMBCCTX *c); +void smbc_setFunctionStat(SMBCCTX *c, smbc_stat_fn fn); + +typedef int (*smbc_fstat_fn)(SMBCCTX *c, + SMBCFILE *file, + struct stat *st); +smbc_fstat_fn smbc_getFunctionFstat(SMBCCTX *c); +void smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn); + +typedef int (*smbc_ftruncate_fn)(SMBCCTX *c, + SMBCFILE *f, + off_t size); +smbc_ftruncate_fn smbc_getFunctionFtruncate(SMBCCTX *c); +void smbc_setFunctionFtruncate(SMBCCTX *c, smbc_ftruncate_fn fn); + +typedef int (*smbc_close_fn)(SMBCCTX *c, + SMBCFILE *file); +smbc_close_fn smbc_getFunctionClose(SMBCCTX *c); +void smbc_setFunctionClose(SMBCCTX *c, smbc_close_fn fn); + + + +/***************************************************************** + * Callable functions for directories. * + * Each callable has a function signature typedef, a declaration * + * for the getter, and a declaration for the setter. * + *****************************************************************/ + +typedef SMBCFILE * (*smbc_opendir_fn)(SMBCCTX *c, + const char *fname); +smbc_opendir_fn smbc_getFunctionOpendir(SMBCCTX *c); +void smbc_setFunctionOpendir(SMBCCTX *c, smbc_opendir_fn fn); + +typedef int (*smbc_closedir_fn)(SMBCCTX *c, + SMBCFILE *dir); +smbc_closedir_fn smbc_getFunctionClosedir(SMBCCTX *c); +void smbc_setFunctionClosedir(SMBCCTX *c, smbc_closedir_fn fn); + +typedef struct smbc_dirent * (*smbc_readdir_fn)(SMBCCTX *c, + SMBCFILE *dir); +smbc_readdir_fn smbc_getFunctionReaddir(SMBCCTX *c); +void smbc_setFunctionReaddir(SMBCCTX *c, smbc_readdir_fn fn); + +typedef int (*smbc_getdents_fn)(SMBCCTX *c, + SMBCFILE *dir, + struct smbc_dirent *dirp, + int count); +smbc_getdents_fn smbc_getFunctionGetdents(SMBCCTX *c); +void smbc_setFunctionGetdents(SMBCCTX *c, smbc_getdents_fn fn); + +typedef int (*smbc_mkdir_fn)(SMBCCTX *c, + const char *fname, + mode_t mode); +smbc_mkdir_fn smbc_getFunctionMkdir(SMBCCTX *c); +void smbc_setFunctionMkdir(SMBCCTX *c, smbc_mkdir_fn fn); + +typedef int (*smbc_rmdir_fn)(SMBCCTX *c, + const char *fname); +smbc_rmdir_fn smbc_getFunctionRmdir(SMBCCTX *c); +void smbc_setFunctionRmdir(SMBCCTX *c, smbc_rmdir_fn fn); + +typedef off_t (*smbc_telldir_fn)(SMBCCTX *c, + SMBCFILE *dir); +smbc_telldir_fn smbc_getFunctionTelldir(SMBCCTX *c); +void smbc_setFunctionTelldir(SMBCCTX *c, smbc_telldir_fn fn); + +typedef int (*smbc_lseekdir_fn)(SMBCCTX *c, + SMBCFILE *dir, + off_t offset); +smbc_lseekdir_fn smbc_getFunctionLseekdir(SMBCCTX *c); +void smbc_setFunctionLseekdir(SMBCCTX *c, smbc_lseekdir_fn fn); + +typedef int (*smbc_fstatdir_fn)(SMBCCTX *c, + SMBCFILE *dir, + struct stat *st); +smbc_fstatdir_fn smbc_getFunctionFstatdir(SMBCCTX *c); +void smbc_setFunctionFstatdir(SMBCCTX *c, smbc_fstatdir_fn fn); + + + +/***************************************************************** + * Callable functions applicable to both files and directories. * + * Each callable has a function signature typedef, a declaration * + * for the getter, and a declaration for the setter. * + *****************************************************************/ + +typedef int (*smbc_chmod_fn)(SMBCCTX *c, + const char *fname, + mode_t mode); +smbc_chmod_fn smbc_getFunctionChmod(SMBCCTX *c); +void smbc_setFunctionChmod(SMBCCTX *c, smbc_chmod_fn fn); + +typedef int (*smbc_utimes_fn)(SMBCCTX *c, + const char *fname, + struct timeval *tbuf); +smbc_utimes_fn smbc_getFunctionUtimes(SMBCCTX *c); +void smbc_setFunctionUtimes(SMBCCTX *c, smbc_utimes_fn fn); + +typedef int (*smbc_setxattr_fn)(SMBCCTX *context, + const char *fname, + const char *name, + const void *value, + size_t size, + int flags); +smbc_setxattr_fn smbc_getFunctionSetxattr(SMBCCTX *c); +void smbc_setFunctionSetxattr(SMBCCTX *c, smbc_setxattr_fn fn); + +typedef int (*smbc_getxattr_fn)(SMBCCTX *context, + const char *fname, + const char *name, + const void *value, + size_t size); +smbc_getxattr_fn smbc_getFunctionGetxattr(SMBCCTX *c); +void smbc_setFunctionGetxattr(SMBCCTX *c, smbc_getxattr_fn fn); + +typedef int (*smbc_removexattr_fn)(SMBCCTX *context, + const char *fname, + const char *name); +smbc_removexattr_fn smbc_getFunctionRemovexattr(SMBCCTX *c); +void smbc_setFunctionRemovexattr(SMBCCTX *c, smbc_removexattr_fn fn); + +typedef int (*smbc_listxattr_fn)(SMBCCTX *context, + const char *fname, + char *list, + size_t size); +smbc_listxattr_fn smbc_getFunctionListxattr(SMBCCTX *c); +void smbc_setFunctionListxattr(SMBCCTX *c, smbc_listxattr_fn fn); + + + +/***************************************************************** + * Callable functions for printing. * + * Each callable has a function signature typedef, a declaration * + * for the getter, and a declaration for the setter. * + *****************************************************************/ + +typedef int (*smbc_print_file_fn)(SMBCCTX *c_file, + const char *fname, + SMBCCTX *c_print, + const char *printq); +smbc_print_file_fn smbc_getFunctionPrintFile(SMBCCTX *c); +void smbc_setFunctionPrintFile(SMBCCTX *c, smbc_print_file_fn fn); + +typedef SMBCFILE * (*smbc_open_print_job_fn)(SMBCCTX *c, + const char *fname); +smbc_open_print_job_fn smbc_getFunctionOpenPrintJob(SMBCCTX *c); +void smbc_setFunctionOpenPrintJob(SMBCCTX *c, + smbc_open_print_job_fn fn); + +typedef int (*smbc_list_print_jobs_fn)(SMBCCTX *c, + const char *fname, + smbc_list_print_job_fn fn); +smbc_list_print_jobs_fn smbc_getFunctionListPrintJobs(SMBCCTX *c); +void smbc_setFunctionListPrintJobs(SMBCCTX *c, + smbc_list_print_jobs_fn fn); + +typedef int (*smbc_unlink_print_job_fn)(SMBCCTX *c, + const char *fname, + int id); +smbc_unlink_print_job_fn smbc_getFunctionUnlinkPrintJob(SMBCCTX *c); +void smbc_setFunctionUnlinkPrintJob(SMBCCTX *c, + smbc_unlink_print_job_fn fn); + + +/**@ingroup misc + * Create a new SBMCCTX (a context). + * + * Must be called before the context is passed to smbc_context_init() + * + * @return The given SMBCCTX pointer on success, NULL on error with errno set: + * - ENOMEM Out of memory + * + * @see smbc_free_context(), smbc_init_context() + * + * @note Do not forget to smbc_init_context() the returned SMBCCTX pointer ! + */ +SMBCCTX * smbc_new_context(void); + +/**@ingroup misc + * Delete a SBMCCTX (a context) acquired from smbc_new_context(). + * + * The context will be deleted if possible. + * + * @param context A pointer to a SMBCCTX obtained from smbc_new_context() + * + * @param shutdown_ctx If 1, all connections and files will be closed even if they are busy. + * + * + * @return Returns 0 on succes. Returns 1 on failure with errno set: + * - EBUSY Server connections are still used, Files are open or cache + * could not be purged + * - EBADF context == NULL + * + * @see smbc_new_context() + * + * @note It is advised to clean up all the contexts with shutdown_ctx set to 1 + * just before exit()'ing. When shutdown_ctx is 0, this function can be + * use in periodical cleanup functions for example. + */ +int smbc_free_context(SMBCCTX * context, int shutdown_ctx); + + +/**@ingroup misc + * + * @deprecated. Use smbc_setOption*() functions instead. + */ +void +smbc_option_set(SMBCCTX *context, + char *option_name, + ... /* option_value */); + +/* + * @deprecated. Use smbc_getOption*() functions instead. + */ +void * +smbc_option_get(SMBCCTX *context, + char *option_name); + +/**@ingroup misc + * Initialize a SBMCCTX (a context). + * + * Must be called before using any SMBCCTX API function + * + * @param context A pointer to a SMBCCTX obtained from smbc_new_context() + * + * @return A pointer to the given SMBCCTX on success, + * NULL on error with errno set: + * - EBADF NULL context given + * - ENOMEM Out of memory + * - ENOENT The smb.conf file would not load + * + * @see smbc_new_context() + * + * @note my_context = smbc_init_context(smbc_new_context()) + * is perfectly safe, but it might leak memory on + * smbc_context_init() failure. Avoid this. + * You'll have to call smbc_free_context() yourself + * on failure. + */ + +SMBCCTX * smbc_init_context(SMBCCTX * context); + +/**@ingroup misc + * Initialize the samba client library. + * + * Must be called before using any of the smbclient API function + * + * @param fn The function that will be called to obtaion + * authentication credentials. + * + * @param debug Allows caller to set the debug level. Can be + * changed in smb.conf file. Allows caller to set + * debugging if no smb.conf. + * + * @return 0 on success, < 0 on error with errno set: + * - ENOMEM Out of memory + * - ENOENT The smb.conf file would not load + * + */ + +int smbc_init(smbc_get_auth_data_fn fn, int debug); + +/**@ingroup misc + * Set or retrieve the compatibility library's context pointer + * + * @param context New context to use, or NULL. If a new context is provided, + * it must have allocated with smbc_new_context() and + * initialized with smbc_init_context(), followed, optionally, + * by some manual changes to some of the non-internal fields. + * + * @return The old context. + * + * @see smbc_new_context(), smbc_init_context(), smbc_init() + * + * @note This function may be called prior to smbc_init() to force + * use of the next context without any internal calls to + * smbc_new_context() or smbc_init_context(). It may also + * be called after smbc_init() has already called those two + * functions, to replace the existing context with a new one. + * Care should be taken, in this latter case, to ensure that + * the server cache and any data allocated by the + * authentication functions have been freed, if necessary. + */ + +SMBCCTX * smbc_set_context(SMBCCTX * new_context); + +/**@ingroup file + * Open a file on an SMB server. + * + * @param furl The smb url of the file to be opened. + * + * @param flags Is one of O_RDONLY, O_WRONLY or O_RDWR which + * request opening the file read-only,write-only + * or read/write. flags may also be bitwise-or'd with + * one or more of the following: + * O_CREAT - If the file does not exist it will be + * created. + * O_EXCL - When used with O_CREAT, if the file + * already exists it is an error and the open will + * fail. + * O_TRUNC - If the file already exists it will be + * truncated. + * O_APPEND The file is opened in append mode + * + * @param mode mode specifies the permissions to use if a new + * file is created. It is modified by the + * process's umask in the usual way: the permissions + * of the created file are (mode & ~umask) + * + * Not currently use, but there for future use. + * We will map this to SYSTEM, HIDDEN, etc bits + * that reverses the mapping that smbc_fstat does. + * + * @return Valid file handle, < 0 on error with errno set: + * - ENOMEM Out of memory + * - EINVAL if an invalid parameter passed, like no + * file, or smbc_init not called. + * - EEXIST pathname already exists and O_CREAT and + * O_EXCL were used. + * - EISDIR pathname refers to a directory and + * the access requested involved writing. + * - EACCES The requested access to the file is not + * allowed + * - ENODEV The requested share does not exist + * - ENOTDIR A file on the path is not a directory + * - ENOENT A directory component in pathname does + * not exist. + * + * @see smbc_creat() + * + * @note This call uses an underlying routine that may create + * a new connection to the server specified in the URL. + * If the credentials supplied in the URL, or via the + * auth_fn in the smbc_init call, fail, this call will + * try again with an empty username and password. This + * often gets mapped to the guest account on some machines. + */ + +int smbc_open(const char *furl, int flags, mode_t mode); + +/**@ingroup file + * Create a file on an SMB server. + * + * Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC + * + * @param furl The smb url of the file to be created + * + * @param mode mode specifies the permissions to use if a new + * file is created. It is modified by the + * process's umask in the usual way: the permissions + * of the created file are (mode & ~umask) + * + * NOTE, the above is not true. We are dealing with + * an SMB server, which has no concept of a umask! + * + * @return Valid file handle, < 0 on error with errno set: + * - ENOMEM Out of memory + * - EINVAL if an invalid parameter passed, like no + * file, or smbc_init not called. + * - EEXIST pathname already exists and O_CREAT and + * O_EXCL were used. + * - EISDIR pathname refers to a directory and + * the access requested involved writing. + * - EACCES The requested access to the file is not + * allowed + * - ENOENT A directory component in pathname does + * not exist. + * - ENODEV The requested share does not exist. + * @see smbc_open() + * + */ + +int smbc_creat(const char *furl, mode_t mode); + +/**@ingroup file + * Read from a file using an opened file handle. + * + * @param fd Open file handle from smbc_open() or smbc_creat() + * + * @param buf Pointer to buffer to recieve read data + * + * @param bufsize Size of buf in bytes + * + * @return Number of bytes read, < 0 on error with errno set: + * - EISDIR fd refers to a directory + * - EBADF fd is not a valid file descriptor or + * is not open for reading. + * - EINVAL fd is attached to an object which is + * unsuitable for reading, or no buffer passed or + * smbc_init not called. + * + * @see smbc_open(), smbc_write() + * + */ +ssize_t smbc_read(int fd, void *buf, size_t bufsize); + + +/**@ingroup file + * Write to a file using an opened file handle. + * + * @param fd Open file handle from smbc_open() or smbc_creat() + * + * @param buf Pointer to buffer to recieve read data + * + * @param bufsize Size of buf in bytes + * + * @return Number of bytes written, < 0 on error with errno set: + * - EISDIR fd refers to a directory. + * - EBADF fd is not a valid file descriptor or + * is not open for reading. + * - EINVAL fd is attached to an object which is + * unsuitable for reading, or no buffer passed or + * smbc_init not called. + * + * @see smbc_open(), smbc_read() + * + */ +ssize_t smbc_write(int fd, const void *buf, size_t bufsize); + + +/**@ingroup file + * Seek to a specific location in a file. + * + * @param fd Open file handle from smbc_open() or smbc_creat() + * + * @param offset Offset in bytes from whence + * + * @param whence A location in the file: + * - SEEK_SET The offset is set to offset bytes from + * the beginning of the file + * - SEEK_CUR The offset is set to current location + * plus offset bytes. + * - SEEK_END The offset is set to the size of the + * file plus offset bytes. + * + * @return Upon successful completion, lseek returns the + * resulting offset location as measured in bytes + * from the beginning of the file. Otherwise, a value + * of (off_t)-1 is returned and errno is set to + * indicate the error: + * - EBADF Fildes is not an open file descriptor. + * - EINVAL Whence is not a proper value or smbc_init + * not called. + * + * @todo Are all the whence values really supported? + * + * @todo Are errno values complete and correct? + */ +off_t smbc_lseek(int fd, off_t offset, int whence); + + +/**@ingroup file + * Close an open file handle. + * + * @param fd The file handle to close + * + * @return 0 on success, < 0 on error with errno set: + * - EBADF fd isn't a valid open file descriptor + * - EINVAL smbc_init() failed or has not been called + * + * @see smbc_open(), smbc_creat() + */ +int smbc_close(int fd); + + +/**@ingroup directory + * Unlink (delete) a file or directory. + * + * @param furl The smb url of the file to delete + * + * @return 0 on success, < 0 on error with errno set: + * - EACCES or EPERM Write access to the directory + * containing pathname is not allowed or one + * of the directories in pathname did not allow + * search (execute) permission + * - ENOENT A directory component in pathname does + * not exist + * - EINVAL NULL was passed in the file param or + * smbc_init not called. + * - EACCES You do not have access to the file + * - ENOMEM Insufficient kernel memory was available + * + * @see smbc_rmdir()s + * + * @todo Are errno values complete and correct? + */ +int smbc_unlink(const char *furl); + + +/**@ingroup directory + * Rename or move a file or directory. + * + * @param ourl The original smb url (source url) of file or + * directory to be moved + * + * @param nurl The new smb url (destination url) of the file + * or directory after the move. Currently nurl must + * be on the same share as ourl. + * + * @return 0 on success, < 0 on error with errno set: + * - EISDIR nurl is an existing directory, but ourl is + * not a directory. + * - EEXIST nurl is a non-empty directory, + * i.e., contains entries other than "." and ".." + * - EINVAL The new url contained a path prefix + * of the old, or, more generally, an attempt was + * made to make a directory a subdirectory of itself + * or smbc_init not called. + * - ENOTDIR A component used as a directory in ourl + * or nurl path is not, in fact, a directory. Or, + * ourl is a directory, and newpath exists but is not + * a directory. + * - EACCES or EPERM Write access to the directory + * containing ourl or nurl is not allowed for the + * process's effective uid, or one of the + * directories in ourl or nurl did not allow search + * (execute) permission, or ourl was a directory + * and did not allow write permission. + * - ENOENT A directory component in ourl or nurl + * does not exist. + * - EXDEV Rename across shares not supported. + * - ENOMEM Insufficient kernel memory was available. + * - EEXIST The target file, nurl, already exists. + * + * + * @todo Are we going to support copying when urls are not on the same + * share? I say no... NOTE. I agree for the moment. + * + */ +int smbc_rename(const char *ourl, const char *nurl); + + +/**@ingroup directory + * Open a directory used to obtain directory entries. + * + * @param durl The smb url of the directory to open + * + * @return Valid directory handle. < 0 on error with errno set: + * - EACCES Permission denied. + * - EINVAL A NULL file/URL was passed, or the URL would + * not parse, or was of incorrect form or smbc_init not + * called. + * - ENOENT durl does not exist, or name is an + * - ENOMEM Insufficient memory to complete the + * operation. + * - ENOTDIR name is not a directory. + * - EPERM the workgroup could not be found. + * - ENODEV the workgroup or server could not be found. + * + * @see smbc_getdents(), smbc_readdir(), smbc_closedir() + * + */ +int smbc_opendir(const char *durl); + + +/**@ingroup directory + * Close a directory handle opened by smbc_opendir(). + * + * @param dh Directory handle to close + * + * @return 0 on success, < 0 on error with errno set: + * - EBADF dh is an invalid directory handle + * + * @see smbc_opendir() + */ +int smbc_closedir(int dh); + + +/**@ingroup directory + * Get multiple directory entries. + * + * smbc_getdents() reads as many dirent structures from the an open + * directory handle into a specified memory area as will fit. + * + * @param dh Valid directory as returned by smbc_opendir() + * + * @param dirp pointer to buffer that will receive the directory + * entries. + * + * @param count The size of the dirp buffer in bytes + * + * @returns If any dirents returned, return will indicate the + * total size. If there were no more dirents available, + * 0 is returned. < 0 indicates an error. + * - EBADF Invalid directory handle + * - EINVAL Result buffer is too small or smbc_init + * not called. + * - ENOENT No such directory. + * @see , smbc_dirent, smbc_readdir(), smbc_open() + * + * @todo Are errno values complete and correct? + * + * @todo Add example code so people know how to parse buffers. + */ +int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count); + + +/**@ingroup directory + * Get a single directory entry. + * + * @param dh Valid directory as returned by smbc_opendir() + * + * @return A pointer to a smbc_dirent structure, or NULL if an + * error occurs or end-of-directory is reached: + * - EBADF Invalid directory handle + * - EINVAL smbc_init() failed or has not been called + * + * @see smbc_dirent, smbc_getdents(), smbc_open() + */ +struct smbc_dirent* smbc_readdir(unsigned int dh); + + +/**@ingroup directory + * Get the current directory offset. + * + * smbc_telldir() may be used in conjunction with smbc_readdir() and + * smbc_lseekdir(). + * + * @param dh Valid directory as returned by smbc_opendir() + * + * @return The current location in the directory stream or -1 + * if an error occur. The current location is not + * an offset. Becuase of the implementation, it is a + * handle that allows the library to find the entry + * later. + * - EBADF dh is not a valid directory handle + * - EINVAL smbc_init() failed or has not been called + * - ENOTDIR if dh is not a directory + * + * @see smbc_readdir() + * + */ +off_t smbc_telldir(int dh); + + +/**@ingroup directory + * lseek on directories. + * + * smbc_lseekdir() may be used in conjunction with smbc_readdir() and + * smbc_telldir(). (rewind by smbc_lseekdir(fd, NULL)) + * + * @param fd Valid directory as returned by smbc_opendir() + * + * @param offset The offset (as returned by smbc_telldir). Can be + * NULL, in which case we will rewind + * + * @return 0 on success, -1 on failure + * - EBADF dh is not a valid directory handle + * - ENOTDIR if dh is not a directory + * - EINVAL offset did not refer to a valid dirent or + * smbc_init not called. + * + * @see smbc_telldir() + * + * + * @todo In what does the reture and errno values mean? + */ +int smbc_lseekdir(int fd, off_t offset); + +/**@ingroup directory + * Create a directory. + * + * @param durl The url of the directory to create + * + * @param mode Specifies the permissions to use. It is modified + * by the process's umask in the usual way: the + * permissions of the created file are (mode & ~umask). + * + * @return 0 on success, < 0 on error with errno set: + * - EEXIST directory url already exists + * - EACCES The parent directory does not allow write + * permission to the process, or one of the directories + * - ENOENT A directory component in pathname does not + * exist. + * - EINVAL NULL durl passed or smbc_init not called. + * - ENOMEM Insufficient memory was available. + * + * @see smbc_rmdir() + * + */ +int smbc_mkdir(const char *durl, mode_t mode); + + +/**@ingroup directory + * Remove a directory. + * + * @param durl The smb url of the directory to remove + * + * @return 0 on success, < 0 on error with errno set: + * - EACCES or EPERM Write access to the directory + * containing pathname was not allowed. + * - EINVAL durl is NULL or smbc_init not called. + * - ENOENT A directory component in pathname does not + * exist. + * - ENOTEMPTY directory contains entries. + * - ENOMEM Insufficient kernel memory was available. + * + * @see smbc_mkdir(), smbc_unlink() + * + * @todo Are errno values complete and correct? + */ +int smbc_rmdir(const char *durl); + + +/**@ingroup attribute + * Get information about a file or directory. + * + * @param url The smb url to get information for + * + * @param st pointer to a buffer that will be filled with + * standard Unix struct stat information. + * + * @return 0 on success, < 0 on error with errno set: + * - ENOENT A component of the path file_name does not + * exist. + * - EINVAL a NULL url was passed or smbc_init not called. + * - EACCES Permission denied. + * - ENOMEM Out of memory + * - ENOTDIR The target dir, url, is not a directory. + * + * @see Unix stat() + * + */ +int smbc_stat(const char *url, struct stat *st); + + +/**@ingroup attribute + * Get file information via an file descriptor. + * + * @param fd Open file handle from smbc_open() or smbc_creat() + * + * @param st pointer to a buffer that will be filled with + * standard Unix struct stat information. + * + * @return EBADF filedes is bad. + * - EACCES Permission denied. + * - EBADF fd is not a valid file descriptor + * - EINVAL Problems occurred in the underlying routines + * or smbc_init not called. + * - ENOMEM Out of memory + * + * @see smbc_stat(), Unix stat() + * + */ +int smbc_fstat(int fd, struct stat *st); + + +/**@ingroup attribute + * Truncate a file given a file descriptor + * + * @param fd Open file handle from smbc_open() or smbc_creat() + * + * @param size size to truncate the file to + * + * @return EBADF filedes is bad. + * - EACCES Permission denied. + * - EBADF fd is not a valid file descriptor + * - EINVAL Problems occurred in the underlying routines + * or smbc_init not called. + * - ENOMEM Out of memory + * + * @see , Unix ftruncate() + * + */ +int smbc_ftruncate(int fd, off_t size); + + +/**@ingroup attribute + * Change the permissions of a file. + * + * @param url The smb url of the file or directory to change + * permissions of + * + * @param mode The permissions to set: + * - Put good explaination of permissions here! + * + * @return 0 on success, < 0 on error with errno set: + * - EPERM The effective UID does not match the owner + * of the file, and is not zero + * - ENOENT The file does not exist. + * - ENOMEM Insufficient was available. + * - ENOENT file or directory does not exist + * + * @todo Actually implement this fuction? + * + * @todo Are errno values complete and correct? + */ +int smbc_chmod(const char *url, mode_t mode); + +/** + * @ingroup attribute + * Change the last modification time on a file + * + * @param url The smb url of the file or directory to change + * the modification time of + * + * @param tbuf An array of two timeval structures which contains, + * respectively, the desired access and modification times. + * NOTE: Only the tv_sec field off each timeval structure is + * used. The tv_usec (microseconds) portion is ignored. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * - EPERM Permission was denied. + * + */ +int smbc_utimes(const char *url, struct timeval *tbuf); + +#ifdef HAVE_UTIME_H +/** + * @ingroup attribute + * Change the last modification time on a file + * + * @param url The smb url of the file or directory to change + * the modification time of + * + * @param utbuf A pointer to a utimebuf structure which contains the + * desired access and modification times. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * - ENOMEM No memory was available for internal needs + * - EPERM Permission was denied. + * + */ +int smbc_utime(const char *fname, struct utimbuf *utbuf); +#endif + +/**@ingroup attribute + * Set extended attributes for a file. This is used for modifying a file's + * security descriptor (i.e. owner, group, and access control list) + * + * @param url The smb url of the file or directory to set extended + * attributes for. + * + * @param name The name of an attribute to be changed. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter should contain a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @param value The value to be assigned to the specified attribute name. + * This buffer should contain only the attribute value if the + * name was of the "system.nt_sec_desc.<attribute_name>" + * form. If the name was of the "system.nt_sec_desc.*" form + * then a complete security descriptor, with name:value pairs + * separated by tabs, commas, or newlines (not spaces!), + * should be provided in this value buffer. A complete + * security descriptor will contain one or more entries + * selected from the following: + * + * REVISION:<revision number> + * OWNER:<sid or name> + * GROUP:<sid or name> + * ACL:<sid or name>:<type>/<flags>/<mask> + * + * The revision of the ACL specifies the internal Windows NT + * ACL revision for the security descriptor. If not specified + * it defaults to 1. Using values other than 1 may cause + * strange behaviour. + * + * The owner and group specify the owner and group sids for + * the object. If the attribute name (either '*+' with a + * complete security descriptor, or individual 'owner+' or + * 'group+' attribute names) ended with a plus sign, the + * specified name is resolved to a SID value, using the + * server on which the file or directory resides. Otherwise, + * the value should be provided in SID-printable format as + * S-1-x-y-z, and is used directly. The <sid or name> + * associated with the ACL: attribute should be provided + * similarly. + * + * @param size The number of the bytes of data in the value buffer + * + * @param flags A bit-wise OR of zero or more of the following: + * SMBC_XATTR_FLAG_CREATE - + * fail if the named attribute already exists + * SMBC_XATTR_FLAG_REPLACE - + * fail if the attribute does not already exist + * + * If neither flag is specified, the specified attributes + * will be added or replace existing attributes of the same + * name, as necessary. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * or one of the parameters is not of a correct + * form + * - ENOMEM No memory was available for internal needs + * - EEXIST If the attribute already exists and the flag + * SMBC_XATTR_FLAG_CREAT was specified + * - ENOATTR If the attribute does not exist and the flag + * SMBC_XATTR_FLAG_REPLACE was specified + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + * @note Attribute names are compared in a case-insensitive + * fashion. All of the following are equivalent, although + * the all-lower-case name is the preferred format: + * system.nt_sec_desc.owner + * SYSTEM.NT_SEC_DESC.OWNER + * sYsTeM.nt_sEc_desc.owNER + * + */ +int smbc_setxattr(const char *url, + const char *name, + const void *value, + size_t size, + int flags); + + +/**@ingroup attribute + * Set extended attributes for a file. This is used for modifying a file's + * security descriptor (i.e. owner, group, and access control list). The + * POSIX function which this maps to would act on a symbolic link rather than + * acting on what the symbolic link points to, but with no symbolic links in + * SMB file systems, this function is functionally identical to + * smbc_setxattr(). + * + * @param url The smb url of the file or directory to set extended + * attributes for. + * + * @param name The name of an attribute to be changed. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter should contain a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @param value The value to be assigned to the specified attribute name. + * This buffer should contain only the attribute value if the + * name was of the "system.nt_sec_desc.<attribute_name>" + * form. If the name was of the "system.nt_sec_desc.*" form + * then a complete security descriptor, with name:value pairs + * separated by tabs, commas, or newlines (not spaces!), + * should be provided in this value buffer. A complete + * security descriptor will contain one or more entries + * selected from the following: + * + * REVISION:<revision number> + * OWNER:<sid or name> + * GROUP:<sid or name> + * ACL:<sid or name>:<type>/<flags>/<mask> + * + * The revision of the ACL specifies the internal Windows NT + * ACL revision for the security descriptor. If not specified + * it defaults to 1. Using values other than 1 may cause + * strange behaviour. + * + * The owner and group specify the owner and group sids for + * the object. If the attribute name (either '*+' with a + * complete security descriptor, or individual 'owner+' or + * 'group+' attribute names) ended with a plus sign, the + * specified name is resolved to a SID value, using the + * server on which the file or directory resides. Otherwise, + * the value should be provided in SID-printable format as + * S-1-x-y-z, and is used directly. The <sid or name> + * associated with the ACL: attribute should be provided + * similarly. + * + * @param size The number of the bytes of data in the value buffer + * + * @param flags A bit-wise OR of zero or more of the following: + * SMBC_XATTR_FLAG_CREATE - + * fail if the named attribute already exists + * SMBC_XATTR_FLAG_REPLACE - + * fail if the attribute does not already exist + * + * If neither flag is specified, the specified attributes + * will be added or replace existing attributes of the same + * name, as necessary. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * or one of the parameters is not of a correct + * form + * - ENOMEM No memory was available for internal needs + * - EEXIST If the attribute already exists and the flag + * SMBC_XATTR_FLAG_CREAT was specified + * - ENOATTR If the attribute does not exist and the flag + * SMBC_XATTR_FLAG_REPLACE was specified + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + * @note Attribute names are compared in a case-insensitive + * fashion. All of the following are equivalent, although + * the all-lower-case name is the preferred format: + * system.nt_sec_desc.owner + * SYSTEM.NT_SEC_DESC.OWNER + * sYsTeM.nt_sEc_desc.owNER + * + */ +int smbc_lsetxattr(const char *url, + const char *name, + const void *value, + size_t size, + int flags); + + +/**@ingroup attribute + * Set extended attributes for a file. This is used for modifying a file's + * security descriptor (i.e. owner, group, and access control list) + * + * @param fd A file descriptor associated with an open file (as + * previously returned by smbc_open(), to get extended + * attributes for. + * + * @param name The name of an attribute to be changed. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter should contain a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @param value The value to be assigned to the specified attribute name. + * This buffer should contain only the attribute value if the + * name was of the "system.nt_sec_desc.<attribute_name>" + * form. If the name was of the "system.nt_sec_desc.*" form + * then a complete security descriptor, with name:value pairs + * separated by tabs, commas, or newlines (not spaces!), + * should be provided in this value buffer. A complete + * security descriptor will contain one or more entries + * selected from the following: + * + * REVISION:<revision number> + * OWNER:<sid or name> + * GROUP:<sid or name> + * ACL:<sid or name>:<type>/<flags>/<mask> + * + * The revision of the ACL specifies the internal Windows NT + * ACL revision for the security descriptor. If not specified + * it defaults to 1. Using values other than 1 may cause + * strange behaviour. + * + * The owner and group specify the owner and group sids for + * the object. If the attribute name (either '*+' with a + * complete security descriptor, or individual 'owner+' or + * 'group+' attribute names) ended with a plus sign, the + * specified name is resolved to a SID value, using the + * server on which the file or directory resides. Otherwise, + * the value should be provided in SID-printable format as + * S-1-x-y-z, and is used directly. The <sid or name> + * associated with the ACL: attribute should be provided + * similarly. + * + * @param size The number of the bytes of data in the value buffer + * + * @param flags A bit-wise OR of zero or more of the following: + * SMBC_XATTR_FLAG_CREATE - + * fail if the named attribute already exists + * SMBC_XATTR_FLAG_REPLACE - + * fail if the attribute does not already exist + * + * If neither flag is specified, the specified attributes + * will be added or replace existing attributes of the same + * name, as necessary. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * or one of the parameters is not of a correct + * form + * - ENOMEM No memory was available for internal needs + * - EEXIST If the attribute already exists and the flag + * SMBC_XATTR_FLAG_CREAT was specified + * - ENOATTR If the attribute does not exist and the flag + * SMBC_XATTR_FLAG_REPLACE was specified + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + * @note Attribute names are compared in a case-insensitive + * fashion. All of the following are equivalent, although + * the all-lower-case name is the preferred format: + * system.nt_sec_desc.owner + * SYSTEM.NT_SEC_DESC.OWNER + * sYsTeM.nt_sEc_desc.owNER + * + */ +int smbc_fsetxattr(int fd, + const char *name, + const void *value, + size_t size, + int flags); + + +/**@ingroup attribute + * Get extended attributes for a file. + * + * @param url The smb url of the file or directory to get extended + * attributes for. + * + * @param name The name of an attribute to be retrieved. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter will return a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @param value A pointer to a buffer in which the value of the specified + * attribute will be placed (unless size is zero). + * + * @param size The size of the buffer pointed to by value. This parameter + * may also be zero, in which case the size of the buffer + * required to hold the attribute value will be returned, + * but nothing will be placed into the value buffer. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * or one of the parameters is not of a correct + * form + * - ENOMEM No memory was available for internal needs + * - EEXIST If the attribute already exists and the flag + * SMBC_XATTR_FLAG_CREAT was specified + * - ENOATTR If the attribute does not exist and the flag + * SMBC_XATTR_FLAG_REPLACE was specified + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + */ +int smbc_getxattr(const char *url, + const char *name, + const void *value, + size_t size); + + +/**@ingroup attribute + * Get extended attributes for a file. The POSIX function which this maps to + * would act on a symbolic link rather than acting on what the symbolic link + * points to, but with no symbolic links in SMB file systems, this function + * is functionally identical to smbc_getxattr(). + * + * @param url The smb url of the file or directory to get extended + * attributes for. + * + * @param name The name of an attribute to be retrieved. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter will return a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @param value A pointer to a buffer in which the value of the specified + * attribute will be placed (unless size is zero). + * + * @param size The size of the buffer pointed to by value. This parameter + * may also be zero, in which case the size of the buffer + * required to hold the attribute value will be returned, + * but nothing will be placed into the value buffer. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * or one of the parameters is not of a correct + * form + * - ENOMEM No memory was available for internal needs + * - EEXIST If the attribute already exists and the flag + * SMBC_XATTR_FLAG_CREAT was specified + * - ENOATTR If the attribute does not exist and the flag + * SMBC_XATTR_FLAG_REPLACE was specified + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + */ +int smbc_lgetxattr(const char *url, + const char *name, + const void *value, + size_t size); + + +/**@ingroup attribute + * Get extended attributes for a file. + * + * @param fd A file descriptor associated with an open file (as + * previously returned by smbc_open(), to get extended + * attributes for. + * + * @param name The name of an attribute to be retrieved. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter will return a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @param value A pointer to a buffer in which the value of the specified + * attribute will be placed (unless size is zero). + * + * @param size The size of the buffer pointed to by value. This parameter + * may also be zero, in which case the size of the buffer + * required to hold the attribute value will be returned, + * but nothing will be placed into the value buffer. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * or one of the parameters is not of a correct + * form + * - ENOMEM No memory was available for internal needs + * - EEXIST If the attribute already exists and the flag + * SMBC_XATTR_FLAG_CREAT was specified + * - ENOATTR If the attribute does not exist and the flag + * SMBC_XATTR_FLAG_REPLACE was specified + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + */ +int smbc_fgetxattr(int fd, + const char *name, + const void *value, + size_t size); + + +/**@ingroup attribute + * Remove extended attributes for a file. This is used for modifying a file's + * security descriptor (i.e. owner, group, and access control list) + * + * @param url The smb url of the file or directory to remove the extended + * attributes for. + * + * @param name The name of an attribute to be removed. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter will return a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * - ENOMEM No memory was available for internal needs + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + */ +int smbc_removexattr(const char *url, + const char *name); + + +/**@ingroup attribute + * Remove extended attributes for a file. This is used for modifying a file's + * security descriptor (i.e. owner, group, and access control list) The POSIX + * function which this maps to would act on a symbolic link rather than acting + * on what the symbolic link points to, but with no symbolic links in SMB file + * systems, this function is functionally identical to smbc_removexattr(). + * + * @param url The smb url of the file or directory to remove the extended + * attributes for. + * + * @param name The name of an attribute to be removed. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter will return a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * - ENOMEM No memory was available for internal needs + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + */ +int smbc_lremovexattr(const char *url, + const char *name); + + +/**@ingroup attribute + * Remove extended attributes for a file. This is used for modifying a file's + * security descriptor (i.e. owner, group, and access control list) + * + * @param fd A file descriptor associated with an open file (as + * previously returned by smbc_open(), to get extended + * attributes for. + * + * @param name The name of an attribute to be removed. Names are of + * one of the following forms: + * + * system.nt_sec_desc.<attribute name> + * system.nt_sec_desc.* + * system.nt_sec_desc.*+ + * + * where <attribute name> is one of: + * + * revision + * owner + * owner+ + * group + * group+ + * acl:<name or sid> + * acl+:<name or sid> + * + * In the forms "system.nt_sec_desc.*" and + * "system.nt_sec_desc.*+", the asterisk and plus signs are + * literal, i.e. the string is provided exactly as shown, and + * the value parameter will return a complete security + * descriptor with name:value pairs separated by tabs, + * commas, or newlines (not spaces!). + * + * The plus sign ('+') indicates that SIDs should be mapped + * to names. Without the plus sign, SIDs are not mapped; + * rather they are simply converted to a string format. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * - ENOMEM No memory was available for internal needs + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + */ +int smbc_fremovexattr(int fd, + const char *name); + + +/**@ingroup attribute + * List the supported extended attribute names associated with a file + * + * @param url The smb url of the file or directory to list the extended + * attributes for. + * + * @param list A pointer to a buffer in which the list of attributes for + * the specified file or directory will be placed (unless + * size is zero). + * + * @param size The size of the buffer pointed to by list. This parameter + * may also be zero, in which case the size of the buffer + * required to hold all of the attribute names will be + * returned, but nothing will be placed into the list buffer. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * - ENOMEM No memory was available for internal needs + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + * @note This function always returns all attribute names supported + * by NT file systems, regardless of whether the referenced + * file system supports extended attributes (e.g. a Windows + * 2000 machine supports extended attributes if NTFS is used, + * but not if FAT is used, and Windows 98 doesn't support + * extended attributes at all. Whether this is a feature or + * a bug is yet to be decided. + */ +int smbc_listxattr(const char *url, + char *list, + size_t size); + +/**@ingroup attribute + * List the supported extended attribute names associated with a file The + * POSIX function which this maps to would act on a symbolic link rather than + * acting on what the symbolic link points to, but with no symbolic links in + * SMB file systems, this function is functionally identical to + * smbc_listxattr(). + * + * @param url The smb url of the file or directory to list the extended + * attributes for. + * + * @param list A pointer to a buffer in which the list of attributes for + * the specified file or directory will be placed (unless + * size is zero). + * + * @param size The size of the buffer pointed to by list. This parameter + * may also be zero, in which case the size of the buffer + * required to hold all of the attribute names will be + * returned, but nothing will be placed into the list buffer. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * - ENOMEM No memory was available for internal needs + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + * @note This function always returns all attribute names supported + * by NT file systems, regardless of wether the referenced + * file system supports extended attributes (e.g. a Windows + * 2000 machine supports extended attributes if NTFS is used, + * but not if FAT is used, and Windows 98 doesn't support + * extended attributes at all. Whether this is a feature or + * a bug is yet to be decided. + */ +int smbc_llistxattr(const char *url, + char *list, + size_t size); + +/**@ingroup attribute + * List the supported extended attribute names associated with a file + * + * @param fd A file descriptor associated with an open file (as + * previously returned by smbc_open(), to get extended + * attributes for. + * + * @param list A pointer to a buffer in which the list of attributes for + * the specified file or directory will be placed (unless + * size is zero). + * + * @param size The size of the buffer pointed to by list. This parameter + * may also be zero, in which case the size of the buffer + * required to hold all of the attribute names will be + * returned, but nothing will be placed into the list buffer. + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL The client library is not properly initialized + * - ENOMEM No memory was available for internal needs + * - EPERM Permission was denied. + * - ENOTSUP The referenced file system does not support + * extended attributes + * + * @note This function always returns all attribute names supported + * by NT file systems, regardless of wether the referenced + * file system supports extended attributes (e.g. a Windows + * 2000 machine supports extended attributes if NTFS is used, + * but not if FAT is used, and Windows 98 doesn't support + * extended attributes at all. Whether this is a feature or + * a bug is yet to be decided. + */ +int smbc_flistxattr(int fd, + char *list, + size_t size); + +/**@ingroup print + * Print a file given the name in fname. It would be a URL ... + * + * @param fname The URL of a file on a remote SMB server that the + * caller wants printed + * + * @param printq The URL of the print share to print the file to. + * + * @return 0 on success, < 0 on error with errno set: + * + * - EINVAL fname or printq was NULL or smbc_init not + * not called. + * and errors returned by smbc_open + * + */ +int smbc_print_file(const char *fname, const char *printq); + +/**@ingroup print + * Open a print file that can be written to by other calls. This simply + * does an smbc_open call after checking if there is a file name on the + * URI. If not, a temporary name is added ... + * + * @param fname The URL of the print share to print to? + * + * @returns A file handle for the print file if successful. + * Returns -1 if an error ocurred and errno has the values + * - EINVAL fname was NULL or smbc_init not called. + * - all errors returned by smbc_open + * + */ +int smbc_open_print_job(const char *fname); + +/**@ingroup print + * List the print jobs on a print share, for the moment, pass a callback + * + * @param purl The url of the print share to list the jobs of + * + * @param fn Callback function the receives printjob info + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL fname was NULL or smbc_init not called + * - EACCES ??? + */ +int smbc_list_print_jobs(const char *purl, smbc_list_print_job_fn fn); + +/**@ingroup print + * Delete a print job + * + * @param purl Url of the print share + * + * @param id The id of the job to delete + * + * @return 0 on success, < 0 on error with errno set: + * - EINVAL fname was NULL or smbc_init not called + * + * @todo what errno values are possible here? + */ +int smbc_unlink_print_job(const char *purl, int id); + +/**@ingroup callback + * Remove a server from the cached server list it's unused. + * + * @param context pointer to smb context + * + * @param srv pointer to server to remove + * + * @return On success, 0 is returned. 1 is returned if the server could not + * be removed. Also useable outside libsmbclient. + */ +int smbc_remove_unused_server(SMBCCTX * context, SMBCSRV * srv); + +#ifdef __cplusplus +} +#endif + +/**@ingroup directory + * Convert strings of %xx to their single character equivalent. + * + * @param dest A pointer to a buffer in which the resulting decoded + * string should be placed. This may be a pointer to the + * same buffer as src_segment. + * + * @param src A pointer to the buffer containing the URL to be decoded. + * Any %xx sequences herein are converted to their single + * character equivalent. Each 'x' must be a valid hexadecimal + * digit, or that % sequence is left undecoded. + * + * @param max_dest_len + * The size of the buffer pointed to by dest_segment. + * + * @return The number of % sequences which could not be converted + * due to lack of two following hexadecimal digits. + */ +#ifdef __cplusplus +extern "C" { +#endif +int +smbc_urldecode(char *dest, char * src, size_t max_dest_len); +#ifdef __cplusplus +} +#endif + + +/* + * Convert any characters not specifically allowed in a URL into their %xx + * equivalent. + * + * @param dest A pointer to a buffer in which the resulting encoded + * string should be placed. Unlike smbc_urldecode(), this + * must be a buffer unique from src. + * + * @param src A pointer to the buffer containing the string to be encoded. + * Any character not specifically allowed in a URL is converted + * into its hexadecimal value and encoded as %xx. + * + * @param max_dest_len + * The size of the buffer pointed to by dest_segment. + * + * @returns The remaining buffer length. + */ +#ifdef __cplusplus +extern "C" { +#endif +int +smbc_urlencode(char * dest, char * src, int max_dest_len); +#ifdef __cplusplus +} +#endif + + +/**@ingroup directory + * Return the version of the linked Samba code, and thus the version of the + * libsmbclient code. + * + * @return The version string. + */ +#ifdef __cplusplus +extern "C" { +#endif +const char * +smbc_version(void); +#ifdef __cplusplus +} +#endif + +/**@ingroup misc + * Set the users credentials globally so they can be used for DFS + * referrals. Probably best to use this function in the smbc_get_auth_data_fn + * callback. + * + * @param workgroup Workgroup of the user. + * + * @param user Username of user. + * + * @param password Password of user. + * + * @param use_kerberos Whether to use Kerberos + * + * @param signing_state One of these strings (all equivalents on same line): + * "off", "no", "false" + * "on", "yes", "true", "auto" + * "force", "required", "forced" + */ + +void +smbc_set_credentials(char *workgroup, + char *user, + char *password, + smbc_bool use_kerberos, + char *signing_state); + + +/** + * @ingroup structure + * Structure that contains a client context information + * This structure is known as SMBCCTX + * + * DO NOT DIRECTLY MANIPULATE THE CONTEXT STRUCTURE! The data in the context + * structure should all be considered private to the library. It remains here + * only for backward compatibility. + * + * See the comments herein for use of the setter and getter functions which + * should now be used for manipulating these values. New features, functions, + * etc., are not added here but rather in _internal where they are not + * directly visible to applications. This makes it much easier to maintain + * ABI compatibility. + */ +struct _SMBCCTX +{ + /** + * debug level + * + * DEPRECATED: + * Use smbc_getDebug() and smbc_setDebug() + */ + int debug DEPRECATED_SMBC_INTERFACE; + + /** + * netbios name used for making connections + * + * DEPRECATED: + * Use smbc_getNetbiosName() and smbc_setNetbiosName() + */ + char * netbios_name DEPRECATED_SMBC_INTERFACE; + + /** + * workgroup name used for making connections + * + * DEPRECATED: + * Use smbc_getWorkgroup() and smbc_setWorkgroup() + */ + char * workgroup DEPRECATED_SMBC_INTERFACE; + + /** + * username used for making connections + * + * DEPRECATED: + * Use smbc_getUser() and smbc_setUser() + */ + char * user DEPRECATED_SMBC_INTERFACE; + + /** + * timeout used for waiting on connections / response data (in + * milliseconds) + * + * DEPRECATED: + * Use smbc_getTimeout() and smbc_setTimeout() + */ + int timeout DEPRECATED_SMBC_INTERFACE; + + /** + * callable functions for files: + * For usage and return values see the SMBC_* functions + * + * DEPRECATED: + * + * Use smbc_getFunction*() and smbc_setFunction*(), e.g. + * smbc_getFunctionOpen(), smbc_setFunctionUnlink(), etc. + */ + smbc_open_fn open DEPRECATED_SMBC_INTERFACE; + smbc_creat_fn creat DEPRECATED_SMBC_INTERFACE; + smbc_read_fn read DEPRECATED_SMBC_INTERFACE; + smbc_write_fn write DEPRECATED_SMBC_INTERFACE; + smbc_unlink_fn unlink DEPRECATED_SMBC_INTERFACE; + smbc_rename_fn rename DEPRECATED_SMBC_INTERFACE; + smbc_lseek_fn lseek DEPRECATED_SMBC_INTERFACE; + smbc_stat_fn stat DEPRECATED_SMBC_INTERFACE; + smbc_fstat_fn fstat DEPRECATED_SMBC_INTERFACE; +#if 0 /* internal */ + smbc_ftruncate_fn ftruncate_fn; +#endif + smbc_close_fn close_fn DEPRECATED_SMBC_INTERFACE; + smbc_opendir_fn opendir DEPRECATED_SMBC_INTERFACE; + smbc_closedir_fn closedir DEPRECATED_SMBC_INTERFACE; + smbc_readdir_fn readdir DEPRECATED_SMBC_INTERFACE; + smbc_getdents_fn getdents DEPRECATED_SMBC_INTERFACE; + smbc_mkdir_fn mkdir DEPRECATED_SMBC_INTERFACE; + smbc_rmdir_fn rmdir DEPRECATED_SMBC_INTERFACE; + smbc_telldir_fn telldir DEPRECATED_SMBC_INTERFACE; + smbc_lseekdir_fn lseekdir DEPRECATED_SMBC_INTERFACE; + smbc_fstatdir_fn fstatdir DEPRECATED_SMBC_INTERFACE; + smbc_chmod_fn chmod DEPRECATED_SMBC_INTERFACE; + smbc_utimes_fn utimes DEPRECATED_SMBC_INTERFACE; + smbc_setxattr_fn setxattr DEPRECATED_SMBC_INTERFACE; + smbc_getxattr_fn getxattr DEPRECATED_SMBC_INTERFACE; + smbc_removexattr_fn removexattr DEPRECATED_SMBC_INTERFACE; + smbc_listxattr_fn listxattr DEPRECATED_SMBC_INTERFACE; + + /* Printing-related functions */ + smbc_print_file_fn print_file DEPRECATED_SMBC_INTERFACE; + smbc_open_print_job_fn open_print_job DEPRECATED_SMBC_INTERFACE; + smbc_list_print_jobs_fn list_print_jobs DEPRECATED_SMBC_INTERFACE; + smbc_unlink_print_job_fn unlink_print_job DEPRECATED_SMBC_INTERFACE; + + /* + ** Callbacks + * + * DEPRECATED: + * + * See the comment above each field, for the getter and setter + * functions that should now be used. + */ + struct _smbc_callbacks + { + /** + * authentication function callback: called upon auth requests + * + * DEPRECATED: + * Use smbc_getFunctionAuthData(), smbc_setFunctionAuthData() + */ + smbc_get_auth_data_fn auth_fn DEPRECATED_SMBC_INTERFACE; + + /** + * check if a server is still good + * + * DEPRECATED: + * Use smbc_getFunctionCheckServer(), + * smbc_setFunctionCheckServer() + */ + smbc_check_server_fn check_server_fn DEPRECATED_SMBC_INTERFACE; + + /** + * remove a server if unused + * + * DEPRECATED: + * Use smbc_getFunctionRemoveUnusedServer(), + * smbc_setFunctionCheckServer() + */ + smbc_remove_unused_server_fn remove_unused_server_fn DEPRECATED_SMBC_INTERFACE; + + /** Cache subsystem + * + * For an example cache system see + * samba/source/libsmb/libsmb_cache.c + * + * Cache subsystem * functions follow. + */ + + /** + * server cache addition + * + * DEPRECATED: + * Use smbc_getFunctionAddCachedServer(), + * smbc_setFunctionAddCachedServer() + */ + smbc_add_cached_srv_fn add_cached_srv_fn DEPRECATED_SMBC_INTERFACE; + + /** + * server cache lookup + * + * DEPRECATED: + * Use smbc_getFunctionGetCachedServer(), + * smbc_setFunctionGetCachedServer() + */ + smbc_get_cached_srv_fn get_cached_srv_fn DEPRECATED_SMBC_INTERFACE; + + /** + * server cache removal + * + * DEPRECATED: + * Use smbc_getFunctionRemoveCachedServer(), + * smbc_setFunctionRemoveCachedServer() + */ + smbc_remove_cached_srv_fn remove_cached_srv_fn DEPRECATED_SMBC_INTERFACE; + + /** + * server cache purging, try to remove all cached servers + * (disconnect) + * + * DEPRECATED: + * Use smbc_getFunctionPurgeCachedServers(), + * smbc_setFunctionPurgeCachedServers() + */ + smbc_purge_cached_fn purge_cached_fn DEPRECATED_SMBC_INTERFACE; + } callbacks; + + /** + * Space where the private data of the server cache used to be + * + * DEPRECATED: + * Use smbc_getServerCacheData(), smbc_setServerCacheData() + */ + void * reserved DEPRECATED_SMBC_INTERFACE; + + /* + * Very old configuration options. + * + * DEPRECATED: + * Use one of the following functions instead: + * smbc_setOptionUseKerberos() + * smbc_getOptionUseKerberos() + * smbc_setOptionFallbackAfterKerberos() + * smbc_getOptionFallbackAfterKerberos() + * smbc_setOptionNoAutoAnonymousLogin() + * smbc_getOptionNoAutoAnonymousLogin() + */ + int flags DEPRECATED_SMBC_INTERFACE; + + /** + * user options selections that apply to this session + * + * NEW OPTIONS ARE NOT ADDED HERE! + * + * DEPRECATED: + * To set and retrieve options, use the smbc_setOption*() and + * smbc_getOption*() functions. + */ + struct _smbc_options { + int browse_max_lmb_count DEPRECATED_SMBC_INTERFACE; + int urlencode_readdir_entries DEPRECATED_SMBC_INTERFACE; + int one_share_per_server DEPRECATED_SMBC_INTERFACE; + } options DEPRECATED_SMBC_INTERFACE; + + /** INTERNAL DATA + * do _NOT_ touch this from your program ! + */ + struct SMBC_internal_data * internal; +}; + + +#endif /* SMBCLIENT_H_INCLUDED */ diff --git a/source3/include/local.h b/source3/include/local.h new file mode 100644 index 0000000000..c125ded371 --- /dev/null +++ b/source3/include/local.h @@ -0,0 +1,256 @@ +/* Copyright (C) 1995-1998 Samba-Team */ +/* Copyright (C) 1998 John H Terpstra <jht@aquasoft.com.au> */ + +/* local definitions for file server */ +#ifndef _LOCAL_H +#define _LOCAL_H + +/* The default workgroup - usually overridden in smb.conf */ +#ifndef WORKGROUP +#define WORKGROUP "WORKGROUP" +#endif + +/* the maximum debug level to compile into the code. This assumes a good + optimising compiler that can remove unused code + for embedded or low-memory systems set this to a value like 2 to get + only important messages. This gives *much* smaller binaries +*/ +#ifndef MAX_DEBUG_LEVEL +#define MAX_DEBUG_LEVEL 1000 +#endif + +/* This defines the section name in the configuration file that will contain */ +/* global parameters - that is, parameters relating to the whole server, not */ +/* just services. This name is then reserved, and may not be used as a */ +/* a service name. It will default to "global" if not defined here. */ +#define GLOBAL_NAME "global" +#define GLOBAL_NAME2 "globals" + +/* This defines the section name in the configuration file that will + refer to the special "homes" service */ +#define HOMES_NAME "homes" + +/* This defines the section name in the configuration file that will + refer to the special "printers" service */ +#define PRINTERS_NAME "printers" + +/* Yves Gaige <yvesg@hptnodur.grenoble.hp.com> requested this set this */ +/* to a maximum of 8 if old smb clients break because of long printer names. */ +#define MAXPRINTERLEN 15 + +/* max number of directories open at once */ +/* note that with the new directory code this no longer requires a + file handle per directory, but large numbers do use more memory */ +#define MAX_OPEN_DIRECTORIES 256 + +/* max number of directory handles */ +/* As this now uses the bitmap code this can be + quite large. */ +#define MAX_DIRECTORY_HANDLES 2048 + +/* maximum number of file caches per smbd */ +#define MAX_WRITE_CACHES 10 + +/* define what facility to use for syslog */ +#ifndef SYSLOG_FACILITY +#define SYSLOG_FACILITY LOG_DAEMON +#endif + +/* + * Default number of maximum open files per smbd. This is + * also limited by the maximum available file descriptors + * per process and can also be set in smb.conf as "max open files" + * in the [global] section. + */ + +#ifndef MAX_OPEN_FILES +#define MAX_OPEN_FILES 10000 +#endif + +#define WORDMAX 0xFFFF + +/* the maximum password length before we declare a likely attack */ +#define MAX_PASS_LEN 200 + +/* separators for lists */ +#define LIST_SEP " \t,;\n\r" + +/* wchar separators for lists */ +#define LIST_SEP_W wchar_list_sep + +/* this is where browse lists are kept in the lock dir */ +#define SERVER_LIST "browse.dat" + +/* shall filenames with illegal chars in them get mangled in long + filename listings? */ +#define MANGLE_LONG_FILENAMES + +/* define this if you want to stop spoofing with .. and soft links + NOTE: This also slows down the server considerably */ +#define REDUCE_PATHS + +/* the size of the directory cache */ +#define DIRCACHESIZE 20 + +/* what default type of filesystem do we want this to show up as in a + NT file manager window? */ +#define FSTYPE_STRING "NTFS" + +/* the default guest account - normally set in the Makefile or smb.conf */ +#ifndef GUEST_ACCOUNT +#define GUEST_ACCOUNT "nobody" +#endif + +/* user to test password server with as invalid in security=server mode. */ +#ifndef INVALID_USER_PREFIX +#define INVALID_USER_PREFIX "sambatest" +#endif + +/* the default pager to use for the client "more" command. Users can + override this with the PAGER environment variable */ +#ifndef PAGER +#define PAGER "more" +#endif + +/* the size of the uid cache used to reduce valid user checks */ +#define VUID_CACHE_SIZE 32 + +/* the following control timings of various actions. Don't change + them unless you know what you are doing. These are all in seconds */ +#define DEFAULT_SMBD_TIMEOUT (60*60*24*7) +#define SMBD_RELOAD_CHECK (180) +#define IDLE_CLOSED_TIMEOUT (60) +#define DPTR_IDLE_TIMEOUT (120) +#define SMBD_SELECT_TIMEOUT (60) +#define NMBD_SELECT_LOOP (10) +#define BROWSE_INTERVAL (60) +#define REGISTRATION_INTERVAL (10*60) +#define NMBD_INETD_TIMEOUT (120) +#define NMBD_MAX_TTL (24*60*60) +#define LPQ_LOCK_TIMEOUT (5) +#define NMBD_INTERFACES_RELOAD (120) +#define NMBD_UNEXPECTED_TIMEOUT (15) + +/* the following are in milliseconds */ +#define LOCK_RETRY_TIMEOUT (100) + +/* do you want to dump core (carefully!) when an internal error is + encountered? Samba will be careful to make the core file only + accessible to root */ +#define DUMP_CORE 1 + +/* shall we support browse requests via a FIFO to nmbd? */ +#define ENABLE_FIFO 1 + +/* how long (in miliseconds) to wait for a socket connect to happen */ +#define LONG_CONNECT_TIMEOUT 30000 +#define SHORT_CONNECT_TIMEOUT 5000 + +/* the default netbios keepalive timeout */ +#define DEFAULT_KEEPALIVE 300 + +/* the directory to sit in when idle */ +/* #define IDLE_DIR "/" */ + +/* Timout (in seconds) to wait for an oplock break + message to return from the client. */ + +#define OPLOCK_BREAK_TIMEOUT 30 + +/* Timout (in seconds) to add to the oplock break timeout + to wait for the smbd to smbd message to return. */ + +#define OPLOCK_BREAK_TIMEOUT_FUDGEFACTOR 2 + +/* the read preciction code has been disabled until some problems with + it are worked out */ +#define USE_READ_PREDICTION 0 + +/* + * Default passwd chat script. + */ + +#define DEFAULT_PASSWD_CHAT "*new*password* %n\\n *new*password* %n\\n *changed*" + +/* Minimum length of allowed password when changing UNIX password. */ +#define MINPASSWDLENGTH 5 + +/* maximum ID number used for session control. This cannot be larger + than 62*62 for the current code */ +#define MAX_SESSION_ID 3000 + +/* For the benifit of PAM and the 'session exec' scripts, we fake up a terminal + name. This can be in one of two forms: The first for systems not using + utmp (and therefore not constrained as to length or the need for a number + < 3000 or so) and the second for systems with this 'well behaved terminal + like name' constraint. +*/ + +#ifndef SESSION_TEMPLATE +/* Paramaters are 'pid' and 'vuid' */ +#define SESSION_TEMPLATE "smb/%lu/%d" +#endif + +#ifndef SESSION_UTMP_TEMPLATE +#define SESSION_UTMP_TEMPLATE "smb/%d" +#endif + +/* the maximum age in seconds of a password. Should be a lp_ parameter */ +#define MAX_PASSWORD_AGE (21*24*60*60) + +/* Default allocation roundup. */ +#define SMB_ROUNDUP_ALLOCATION_SIZE 0x100000 + +/* shall we deny oplocks to clients that get timeouts? */ +#define FASCIST_OPLOCK_BACKOFF 1 + +/* this enables the "rabbit pellet" fix for SMBwritebraw */ +#define RABBIT_PELLET_FIX 1 + +/* Max number of jobs per print queue. */ +#define PRINT_MAX_JOBID 10000 + +/* Max number of open RPC pipes. */ +#define MAX_OPEN_PIPES 2048 + +/* Tuning for server auth mutex. */ +#define CLI_AUTH_TIMEOUT 5000 /* In milli-seconds. */ +#define NUM_CLI_AUTH_CONNECT_RETRIES 3 +/* Number in seconds to wait for the mutex. This must be less than 30 seconds. */ +#define SERVER_MUTEX_WAIT_TIME ( ((NUM_CLI_AUTH_CONNECT_RETRIES) * ((CLI_AUTH_TIMEOUT)/1000)) + 5) +/* Number in seconds for winbindd to wait for the mutex. Make this 2 * smbd wait time. */ +#define WINBIND_SERVER_MUTEX_WAIT_TIME (( ((NUM_CLI_AUTH_CONNECT_RETRIES) * ((CLI_AUTH_TIMEOUT)/1000)) + 5)*2) + +/* Max number of simultaneous winbindd socket connections. */ +#define WINBINDD_MAX_SIMULTANEOUS_CLIENTS 200 + +/* Buffer size to use when printing backtraces */ +#define BACKTRACE_STACK_SIZE 64 + +/* size of listen() backlog in smbd */ +#define SMBD_LISTEN_BACKLOG 50 + +/* Number of microseconds to wait before a sharing violation. */ +#define SHARING_VIOLATION_USEC_WAIT 950000 + +/* Number of microseconds to wait before a updating the write time (2 secs). */ +#define WRITE_TIME_UPDATE_USEC_DELAY 2000000 + +#define MAX_LDAP_REPLICATION_SLEEP_TIME 5000 /* In milliseconds. */ + +/* tdb hash size for the open database. */ +#define SMB_OPEN_DATABASE_TDB_HASH_SIZE 10007 + +/* Characters we disallow in sharenames. */ +#define INVALID_SHARENAME_CHARS "%<>*?|/\\+=;:\"," + +/* Seconds between connection attempts to a remote server. */ +#define FAILED_CONNECTION_CACHE_TIMEOUT 30 + +/* Default hash size for the winbindd cache. */ +#define WINBINDD_CACHE_TDB_DEFAULT_HASH_SIZE 5000 + +/* Windows minimum lock resolution timeout in ms */ +#define WINDOWS_MINIMUM_LOCK_TIMEOUT_MS 200 + +#endif diff --git a/source3/include/locking.h b/source3/include/locking.h new file mode 100644 index 0000000000..b2b7236721 --- /dev/null +++ b/source3/include/locking.h @@ -0,0 +1,78 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup, plus a whole lot more. + + Copyright (C) Jeremy Allison 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _LOCKING_H +#define _LOCKING_H + +/* passed to br lock code - the UNLOCK_LOCK should never be stored into the tdb + and is used in calculating POSIX unlock ranges only. We differentiate between + PENDING read and write locks to allow posix lock downgrades to trigger a lock + re-evaluation. */ + +enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK, UNLOCK_LOCK}; +enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1}; + +#define IS_PENDING_LOCK(type) ((type) == PENDING_READ_LOCK || (type) == PENDING_WRITE_LOCK) + +/* This contains elements that differentiate locks. The smbpid is a + client supplied pid, and is essentially the locking context for + this client */ + +struct lock_context { + uint32 smbpid; + uint16 tid; + struct server_id pid; +}; + +struct files_struct; + +struct file_id { + /* we don't use SMB_DEV_T and SMB_INO_T as we want a fixed size here, + and we may be using file system specific code to fill in something + other than a dev_t for the device */ + uint64_t devid; + uint64_t inode; +}; + +struct byte_range_lock { + struct files_struct *fsp; + unsigned int num_locks; + bool modified; + bool read_only; + struct file_id key; + struct lock_struct *lock_data; + struct db_record *record; +}; + +/* Internal structure in brlock.tdb. + The data in brlock records is an unsorted linear array of these + records. It is unnecessary to store the count as tdb provides the + size of the record */ + +struct lock_struct { + struct lock_context context; + br_off start; + br_off size; + uint16 fnum; + enum brl_type lock_type; + enum brl_flavour lock_flav; +}; + +#endif /* _LOCKING_H_ */ diff --git a/source3/include/mangle.h b/source3/include/mangle.h new file mode 100644 index 0000000000..c07b852453 --- /dev/null +++ b/source3/include/mangle.h @@ -0,0 +1,23 @@ +#ifndef _MANGLE_H_ +#define _MANGLE_H_ +/* + header for 8.3 name mangling interface +*/ + +struct mangle_fns { + void (*reset)(void); + bool (*is_mangled)(const char *s, const struct share_params *p); + bool (*must_mangle)(const char *s, const struct share_params *p); + bool (*is_8_3)(const char *fname, bool check_case, bool allow_wildcards, + const struct share_params *p); + bool (*lookup_name_from_8_3)(TALLOC_CTX *ctx, + const char *in, + char **out, /* talloced on the given context. */ + const struct share_params *p); + bool (*name_to_8_3)(const char *in, + char out[13], + bool cache83, + int default_case, + const struct share_params *p); +}; +#endif /* _MANGLE_H_ */ diff --git a/source3/include/mapping.h b/source3/include/mapping.h new file mode 100644 index 0000000000..75459fcebd --- /dev/null +++ b/source3/include/mapping.h @@ -0,0 +1,32 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-2000, + * Copyright (C) Jean François Micouleau 1998-2001. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#define ENUM_ONLY_MAPPED True +#define ENUM_ALL_MAPPED False + +typedef struct _GROUP_MAP { + struct pdb_methods *methods; + gid_t gid; + DOM_SID sid; + enum lsa_SidType sid_name_use; + fstring nt_name; + fstring comment; +} GROUP_MAP; + diff --git a/source3/include/md5.h b/source3/include/md5.h new file mode 100644 index 0000000000..e4cd08ed5e --- /dev/null +++ b/source3/include/md5.h @@ -0,0 +1,19 @@ +#ifndef MD5_H +#define MD5_H +#ifndef HEADER_MD5_H +/* Try to avoid clashes with OpenSSL */ +#define HEADER_MD5_H +#endif + +struct MD5Context { + uint32 buf[4]; + uint32 bits[2]; + unsigned char in[64]; +}; + +void MD5Init(struct MD5Context *context); +void MD5Update(struct MD5Context *context, unsigned char const *buf, + unsigned len); +void MD5Final(unsigned char digest[16], struct MD5Context *context); + +#endif /* !MD5_H */ diff --git a/source3/include/memcache.h b/source3/include/memcache.h new file mode 100644 index 0000000000..0a596b91a5 --- /dev/null +++ b/source3/include/memcache.h @@ -0,0 +1,115 @@ +/* + Unix SMB/CIFS implementation. + In-memory cache + Copyright (C) Volker Lendecke 2007-2008 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __MEMCACHE_H__ +#define __MEMCACHE_H__ + +#include "includes.h" + +struct memcache; + +/* + * A memcache can store different subkeys with overlapping keys, the + * memcache_number becomes part of the key. Feel free to add caches of your + * own here. + * + * If you add talloc type caches, also note this in the switch statement in + * memcache_is_talloc(). + */ + +enum memcache_number { + STAT_CACHE, + UID_SID_CACHE, + SID_UID_CACHE, + GID_SID_CACHE, + SID_GID_CACHE, + GETWD_CACHE, + GETPWNAM_CACHE, /* talloc */ + MANGLE_HASH2_CACHE, + PDB_GETPWSID_CACHE, /* talloc */ + SINGLETON_CACHE_TALLOC, /* talloc */ + SINGLETON_CACHE +}; + +/* + * Create a memcache structure. max_size is in bytes, if you set it 0 it will + * not forget anything. + */ + +struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size); + +/* + * If you set this global memcache, use it as the default cache when NULL is + * passed to the memcache functions below. This is a workaround for many + * situations where passing the cache everywhere would be a big hassle. + */ + +void memcache_set_global(struct memcache *cache); + +/* + * Add a data blob to the cache + */ + +void memcache_add(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB value); + +/* + * Add a talloc object to the cache. The difference to memcache_add() is that + * when the objects is to be discared, talloc_free is called for it. Also + * talloc_move() ownership of the object to the cache. + * + * Please note that the current implementation has a fixed relationship + * between what cache subtypes store talloc objects and which ones store plain + * blobs. We can fix this, but for now we don't have a mixed use of blobs vs + * talloc objects in the cache types. + */ + +void memcache_add_talloc(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, void *ptr); + +/* + * Delete an object from the cache + */ + +void memcache_delete(struct memcache *cache, enum memcache_number n, + DATA_BLOB key); + +/* + * Look up an object from the cache. Memory still belongs to the cache, so + * make a copy of it if needed. + */ + +bool memcache_lookup(struct memcache *cache, enum memcache_number n, + DATA_BLOB key, DATA_BLOB *value); + +/* + * Look up an object from the cache. Memory still belongs to the cache, so + * make a copy of it if needed. + */ + +void *memcache_lookup_talloc(struct memcache *cache, enum memcache_number n, + DATA_BLOB key); + +/* + * Flush a complete cache subset. + */ + +void memcache_flush(struct memcache *cache, enum memcache_number n); + +#endif diff --git a/source3/include/messages.h b/source3/include/messages.h new file mode 100644 index 0000000000..db805a2093 --- /dev/null +++ b/source3/include/messages.h @@ -0,0 +1,153 @@ +/* + Unix SMB/CIFS implementation. + messages.c header + Copyright (C) Andrew Tridgell 2000 + Copyright (C) 2001, 2002 by Martin Pool + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _MESSAGES_H_ +#define _MESSAGES_H_ + +/* change the message version with any incompatible changes in the protocol */ +#define MESSAGE_VERSION 2 + +/* + * Special flags passed to message_send. Allocated from the top, lets see when + * it collides with the message types in the lower 16 bits :-) + */ + +/* + * Under high load, this message can be dropped. Use for notify-style + * messages that are not critical for correct operation. + */ +#define MSG_FLAG_LOWPRIORITY 0x80000000 + + +/* Flags to classify messages - used in message_send_all() */ +/* Sender will filter by flag. */ + +#define FLAG_MSG_GENERAL 0x0001 +#define FLAG_MSG_SMBD 0x0002 +#define FLAG_MSG_NMBD 0x0004 +#define FLAG_MSG_PRINT_NOTIFY 0x0008 +#define FLAG_MSG_PRINT_GENERAL 0x0010 +/* dbwrap messages 4001-4999 */ +#define FLAG_MSG_DBWRAP 0x0020 + + +/* + * Virtual Node Numbers are identifying a node within a cluster. Ctdbd sets + * this, we retrieve our vnn from it. + */ + +#define NONCLUSTER_VNN (0xFFFFFFFF) + +/* + * ctdb gives us 64-bit server ids for messaging_send. This is done to avoid + * pid clashes and to be able to register for special messages like "all + * smbds". + * + * Normal individual server id's have the upper 32 bits to 0, I picked "1" for + * Samba, other subsystems might use something else. + */ + +#define MSG_SRVID_SAMBA 0x0000000100000000LL + + +struct server_id { + pid_t pid; +#ifdef CLUSTER_SUPPORT + uint32 vnn; +#endif +}; + +#ifdef CLUSTER_SUPPORT +#define MSG_BROADCAST_PID_STR "0:0" +#else +#define MSG_BROADCAST_PID_STR "0" +#endif + +struct messaging_context; +struct messaging_rec; +struct data_blob; + +/* + * struct messaging_context belongs to messages.c, but because we still have + * messaging_dispatch, we need it here. Once we get rid of signals for + * notifying processes, this will go. + */ + +struct messaging_context { + struct server_id id; + struct event_context *event_ctx; + struct messaging_callback *callbacks; + + struct messaging_backend *local; + struct messaging_backend *remote; +}; + +struct messaging_backend { + NTSTATUS (*send_fn)(struct messaging_context *msg_ctx, + struct server_id pid, int msg_type, + const struct data_blob *data, + struct messaging_backend *backend); + void *private_data; +}; + +NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx, + TALLOC_CTX *mem_ctx, + struct messaging_backend **presult); +void message_dispatch(struct messaging_context *msg_ctx); + +NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx, + TALLOC_CTX *mem_ctx, + struct messaging_backend **presult); +struct ctdbd_connection *messaging_ctdbd_connection(void); + +bool message_send_all(struct messaging_context *msg_ctx, + int msg_type, + const void *buf, size_t len, + int *n_sent); +struct event_context *messaging_event_context(struct messaging_context *msg_ctx); +struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, + struct server_id server_id, + struct event_context *ev); + +/* + * re-init after a fork + */ +NTSTATUS messaging_reinit(struct messaging_context *msg_ctx); + +NTSTATUS messaging_register(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + void (*fn)(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + struct data_blob *data)); +void messaging_deregister(struct messaging_context *ctx, uint32_t msg_type, + void *private_data); +NTSTATUS messaging_send(struct messaging_context *msg_ctx, + struct server_id server, + uint32_t msg_type, const struct data_blob *data); +NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx, + struct server_id server, uint32_t msg_type, + const uint8 *buf, size_t len); +void messaging_dispatch_rec(struct messaging_context *msg_ctx, + struct messaging_rec *rec); + +#endif diff --git a/source3/include/module.h b/source3/include/module.h new file mode 100644 index 0000000000..20dbaba6b4 --- /dev/null +++ b/source3/include/module.h @@ -0,0 +1,35 @@ +/* + Unix SMB/CIFS implementation. + Handling of idle/exit events + Copyright (C) Stefan (metze) Metzmacher 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _MODULE_H +#define _MODULE_H + +/* Module support */ +typedef NTSTATUS (init_module_function) (void); + + +typedef int smb_event_id_t; +#define SMB_EVENT_ID_INVALID (-1) + +#define SMB_IDLE_EVENT_DEFAULT_INTERVAL 180 +#define SMB_IDLE_EVENT_MIN_INTERVAL 30 + +typedef void (smb_idle_event_fn)(void **data,time_t *interval,time_t now); + +#endif /* _MODULE_H */ diff --git a/source3/include/msdfs.h b/source3/include/msdfs.h new file mode 100644 index 0000000000..4551325843 --- /dev/null +++ b/source3/include/msdfs.h @@ -0,0 +1,75 @@ +/* + Unix SMB/Netbios implementation. + Version 3.0 + MSDfs services for Samba + Copyright (C) Shirish Kalele 2000 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#ifndef _MSDFS_H +#define _MSDFS_H + +#define REFERRAL_TTL 600 + +/* Flags used in trans2 Get Referral reply */ +#define DFSREF_REFERRAL_SERVER 0x1 +#define DFSREF_STORAGE_SERVER 0x2 + +/* Referral sizes */ +#define VERSION2_REFERRAL_SIZE 0x16 +#define VERSION3_REFERRAL_SIZE 0x22 +#define REFERRAL_HEADER_SIZE 0x08 + +/* Maximum number of referrals for each Dfs volume */ +#define MAX_REFERRAL_COUNT 256 +#define MAX_MSDFS_JUNCTIONS 256 + +typedef struct _client_referral { + uint32 proximity; + uint32 ttl; + char *dfspath; +} CLIENT_DFS_REFERRAL; + +struct referral { + char *alternate_path; /* contains the path referred */ + uint32 proximity; + uint32 ttl; /* how long should client cache referral */ +}; + +struct junction_map { + char *service_name; + char *volume_name; + const char *comment; + int referral_count; + struct referral* referral_list; +}; + +struct dfs_path { + char *hostname; + char *servicename; + char *reqpath; + bool posix_path; +}; + +#define init_dfsroot(conn, inbuf, outbuf) \ +{ if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) { \ + DEBUG(2,("Serving %s as a Dfs root\n", \ + lp_servicename(SNUM(conn)) )); \ + SSVAL(outbuf, smb_vwv2, SMB_SHARE_IN_DFS \ + | SVAL(outbuf, smb_vwv2)); \ +} } + +#endif /* _MSDFS_H */ diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h new file mode 100644 index 0000000000..4377e3330a --- /dev/null +++ b/source3/include/nameserv.h @@ -0,0 +1,628 @@ +#ifndef _NAMESERV_H_ +#define _NAMESERV_H_ +/* + Unix SMB/CIFS implementation. + NBT netbios header - version 2 + Copyright (C) Andrew Tridgell 1994-1998 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#define INFO_VERSION "INFO/version" +#define INFO_COUNT "INFO/num_entries" +#define INFO_ID_HIGH "INFO/id_high" +#define INFO_ID_LOW "INFO/id_low" +#define ENTRY_PREFIX "ENTRY/" + +#define PERMANENT_TTL 0 + +/* NTAS uses 2, NT uses 1, WfWg uses 0 */ +#define MAINTAIN_LIST 2 +#define ELECTION_VERSION 1 + +#define MAX_DGRAM_SIZE (576) /* tcp/ip datagram limit is 576 bytes */ +#define MIN_DGRAM_SIZE 12 + +/********************************************************* + Types of reply packet. +**********************************************************/ + +enum netbios_reply_type_code { NMB_QUERY, NMB_STATUS, NMB_REG, NMB_REG_REFRESH, + NMB_REL, NMB_WAIT_ACK, NMB_MULTIHOMED_REG, + WINS_REG, WINS_QUERY }; + +/* From rfc1002, 4.2.1.2 */ +/* Question types. */ +#define QUESTION_TYPE_NB_QUERY 0x20 +#define QUESTION_TYPE_NB_STATUS 0x21 + +/* Question class */ +#define QUESTION_CLASS_IN 0x1 + +/* Opcode definitions */ +#define NMB_NAME_QUERY_OPCODE 0x0 +#define NMB_NAME_REG_OPCODE 0x05 /* see rfc1002.txt 4.2.2,3,5,6,7,8 */ +#define NMB_NAME_RELEASE_OPCODE 0x06 /* see rfc1002.txt 4.2.9,10,11 */ +#define NMB_WACK_OPCODE 0x07 /* see rfc1002.txt 4.2.16 */ +/* Ambiguity in rfc1002 about which of these is correct. */ +/* WinNT uses 8 by default but can be made to use 9. */ +#define NMB_NAME_REFRESH_OPCODE_8 0x08 /* see rfc1002.txt 4.2.4 */ +#define NMB_NAME_REFRESH_OPCODE_9 0x09 /* see rfc1002.txt 4.2.4 */ +#define NMB_NAME_MULTIHOMED_REG_OPCODE 0x0F /* Invented by Microsoft. */ + +/* XXXX what about all the other types?? 0x1, 0x2, 0x3, 0x4, 0x8? */ + +/* Resource record types. rfc1002 4.2.1.3 */ +#define RR_TYPE_A 0x1 +#define RR_TYPE_NS 0x2 +#define RR_TYPE_NULL 0xA +#define RR_TYPE_NB 0x20 +#define RR_TYPE_NBSTAT 0x21 + +/* Resource record class. */ +#define RR_CLASS_IN 0x1 + +/* NetBIOS flags */ +#define NB_GROUP 0x80 +#define NB_PERM 0x02 +#define NB_ACTIVE 0x04 +#define NB_CONFL 0x08 +#define NB_DEREG 0x10 +#define NB_BFLAG 0x00 /* Broadcast node type. */ +#define NB_PFLAG 0x20 /* Point-to-point node type. */ +#define NB_MFLAG 0x40 /* Mixed bcast & p-p node type. */ +#define NB_HFLAG 0x60 /* Microsoft 'hybrid' node type. */ +#define NB_NODETYPEMASK 0x60 +/* Mask applied to outgoing NetBIOS flags. */ +#define NB_FLGMSK 0xE0 + +/* The wins flags. Looks like the nbflags ! */ +#define WINS_UNIQUE 0x00 /* Unique record */ +#define WINS_NGROUP 0x01 /* Normal Group eg: 1B */ +#define WINS_SGROUP 0x02 /* Special Group eg: 1C */ +#define WINS_MHOMED 0x03 /* MultiHomed */ + +#define WINS_ACTIVE 0x00 /* active record */ +#define WINS_RELEASED 0x04 /* released record */ +#define WINS_TOMBSTONED 0x08 /* tombstoned record */ +#define WINS_DELETED 0x0C /* deleted record */ + +#define WINS_STATE_MASK 0x0C + +#define WINS_LOCAL 0x00 /* local record */ +#define WINS_REMOTE 0x10 /* remote record */ + +#define WINS_BNODE 0x00 /* Broadcast node */ +#define WINS_PNODE 0x20 /* PtP node */ +#define WINS_MNODE 0x40 /* Mixed node */ +#define WINS_HNODE 0x60 /* Hybrid node */ + +#define WINS_NONSTATIC 0x00 /* dynamic record */ +#define WINS_STATIC 0x80 /* static record */ + +#define WINS_STATE_ACTIVE(p) (((p)->data.wins_flags & WINS_STATE_MASK) == WINS_ACTIVE) + + +/* NetBIOS flag identifier. */ +#define NAME_GROUP(p) ((p)->data.nb_flags & NB_GROUP) +#define NAME_BFLAG(p) (((p)->data.nb_flags & NB_NODETYPEMASK) == NB_BFLAG) +#define NAME_PFLAG(p) (((p)->data.nb_flags & NB_NODETYPEMASK) == NB_PFLAG) +#define NAME_MFLAG(p) (((p)->data.nb_flags & NB_NODETYPEMASK) == NB_MFLAG) +#define NAME_HFLAG(p) (((p)->data.nb_flags & NB_NODETYPEMASK) == NB_HFLAG) + +/* Samba name state for a name in a namelist. */ +#define NAME_IS_ACTIVE(p) ((p)->data.nb_flags & NB_ACTIVE) +#define NAME_IN_CONFLICT(p) ((p)->data.nb_flags & NB_CONFL) +#define NAME_IS_DEREGISTERING(p) ((p)->data.nb_flags & NB_DEREG) + +/* Error codes for NetBIOS requests. */ +#define FMT_ERR 0x1 /* Packet format error. */ +#define SRV_ERR 0x2 /* Internal server error. */ +#define NAM_ERR 0x3 /* Name does not exist. */ +#define IMP_ERR 0x4 /* Request not implemented. */ +#define RFS_ERR 0x5 /* Request refused. */ +#define ACT_ERR 0x6 /* Active error - name owned by another host. */ +#define CFT_ERR 0x7 /* Name in conflict error. */ + +#define REFRESH_TIME (15*60) +#define NAME_POLL_REFRESH_TIME (5*60) +#define NAME_POLL_INTERVAL 15 + +/* Workgroup state identifiers. */ +#define AM_POTENTIAL_MASTER_BROWSER(work) ((work)->mst_state == MST_POTENTIAL) +#define AM_LOCAL_MASTER_BROWSER(work) ((work)->mst_state == MST_BROWSER) +#define AM_DOMAIN_MASTER_BROWSER(work) ((work)->dom_state == DOMAIN_MST) +#define AM_DOMAIN_MEMBER(work) ((work)->log_state == LOGON_SRV) + +/* Microsoft browser NetBIOS name. */ +#define MSBROWSE "\001\002__MSBROWSE__\002" + +/* Mail slots. */ +#define BROWSE_MAILSLOT "\\MAILSLOT\\BROWSE" +#define NET_LOGON_MAILSLOT "\\MAILSLOT\\NET\\NETLOGON" +#define NT_LOGON_MAILSLOT "\\MAILSLOT\\NET\\NTLOGON" +#define LANMAN_MAILSLOT "\\MAILSLOT\\LANMAN" + +/* Samba definitions for find_name_on_subnet(). */ +#define FIND_ANY_NAME 0 +#define FIND_SELF_NAME 1 + +/* + * The different name types that can be in namelists. + * + * SELF_NAME should only be on the broadcast and unicast subnets. + * LMHOSTS_NAME should only be in the remote_broadcast_subnet. + * REGISTER_NAME, DNS_NAME, DNSFAIL_NAME should only be in the wins_server_subnet. + * WINS_PROXY_NAME should only be on the broadcast subnets. + * PERMANENT_NAME can be on all subnets except remote_broadcast_subnet. + * + */ + +enum name_source {LMHOSTS_NAME, REGISTER_NAME, SELF_NAME, DNS_NAME, + DNSFAIL_NAME, PERMANENT_NAME, WINS_PROXY_NAME}; +enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3}; +enum packet_type {NMB_PACKET, DGRAM_PACKET}; + +enum master_state { + MST_NONE, + MST_POTENTIAL, + MST_BACKUP, + MST_MSB, + MST_BROWSER, + MST_UNBECOMING_MASTER +}; + +enum domain_state { + DOMAIN_NONE, + DOMAIN_WAIT, + DOMAIN_MST +}; + +enum logon_state { + LOGON_NONE, + LOGON_WAIT, + LOGON_SRV +}; + +struct subnet_record; + +struct nmb_data { + uint16 nb_flags; /* Netbios flags. */ + int num_ips; /* Number of ip entries. */ + struct in_addr *ip; /* The ip list for this name. */ + + enum name_source source; /* Where the name came from. */ + + time_t death_time; /* The time the record must be removed (do not remove if 0). */ + time_t refresh_time; /* The time the record should be refreshed. */ + + SMB_BIG_UINT id; /* unique id */ + struct in_addr wins_ip; /* the adress of the wins server this record comes from */ + + int wins_flags; /* similar to the netbios flags but different ! */ +}; + +/* This structure represents an entry in a local netbios name list. */ +struct name_record { + struct name_record *prev, *next; + struct subnet_record *subnet; + struct nmb_name name; /* The netbios name. */ + struct nmb_data data; /* The netbios data. */ +}; + +/* Browser cache for synchronising browse lists. */ +struct browse_cache_record { + struct browse_cache_record *prev, *next; + unstring lmb_name; + unstring work_group; + struct in_addr ip; + time_t sync_time; + time_t death_time; /* The time the record must be removed. */ +}; + +/* This is used to hold the list of servers in my domain, and is + contained within lists of domains. */ + +struct server_record { + struct server_record *next; + struct server_record *prev; + + struct subnet_record *subnet; + + struct server_info_struct serv; + time_t death_time; +}; + +/* A workgroup structure. It contains a list of servers. */ +struct work_record { + struct work_record *next; + struct work_record *prev; + + struct subnet_record *subnet; + + struct server_record *serverlist; + + /* Stage of development from non-local-master up to local-master browser. */ + enum master_state mst_state; + + /* Stage of development from non-domain-master to domain-master browser. */ + enum domain_state dom_state; + + /* Stage of development from non-logon-server to logon server. */ + enum logon_state log_state; + + /* Work group info. */ + unstring work_group; + int token; /* Used when communicating with backup browsers. */ + unstring local_master_browser_name; /* Current local master browser. */ + + /* Announce info. */ + time_t lastannounce_time; + int announce_interval; + bool needannounce; + + /* Timeout time for this workgroup. 0 means permanent. */ + time_t death_time; + + /* Election info */ + bool RunningElection; + bool needelection; + int ElectionCount; + uint32 ElectionCriterion; + + /* Domain master browser info. Used for efficient syncs. */ + struct nmb_name dmb_name; + struct in_addr dmb_addr; +}; + +/* typedefs needed to define copy & free functions for userdata. */ +struct userdata_struct; + +typedef struct userdata_struct * (*userdata_copy_fn)(struct userdata_struct *); +typedef void (*userdata_free_fn)(struct userdata_struct *); + +/* Structure to define any userdata passed around. */ + +struct userdata_struct { + userdata_copy_fn copy_fn; + userdata_free_fn free_fn; + unsigned int userdata_len; + char data[16]; /* 16 is to ensure alignment/padding on all systems */ +}; + +struct response_record; +struct packet_struct; +struct res_rec; + +/* typedef to define the function called when this response packet comes in. */ +typedef void (*response_function)(struct subnet_record *, struct response_record *, + struct packet_struct *); + +/* typedef to define the function called when this response record times out. */ +typedef void (*timeout_response_function)(struct subnet_record *, + struct response_record *); + +/* typedef to define the function called when the request that caused this + response record to be created is successful. */ +typedef void (*success_function)(struct subnet_record *, struct userdata_struct *, ...); + +/* typedef to define the function called when the request that caused this + response record to be created is unsuccessful. */ +typedef void (*fail_function)(struct subnet_record *, struct response_record *, ...); + +/* List of typedefs for success and fail functions of the different query + types. Used to catch any compile time prototype errors. */ + +typedef void (*register_name_success_function)( struct subnet_record *, + struct userdata_struct *, + struct nmb_name *, + uint16, + int, + struct in_addr); +typedef void (*register_name_fail_function)( struct subnet_record *, + struct response_record *, + struct nmb_name *); + +typedef void (*release_name_success_function)( struct subnet_record *, + struct userdata_struct *, + struct nmb_name *, + struct in_addr); +typedef void (*release_name_fail_function)( struct subnet_record *, + struct response_record *, + struct nmb_name *); + +typedef void (*refresh_name_success_function)( struct subnet_record *, + struct userdata_struct *, + struct nmb_name *, + uint16, + int, + struct in_addr); +typedef void (*refresh_name_fail_function)( struct subnet_record *, + struct response_record *, + struct nmb_name *); + +typedef void (*query_name_success_function)( struct subnet_record *, + struct userdata_struct *, + struct nmb_name *, + struct in_addr, + struct res_rec *answers); + +typedef void (*query_name_fail_function)( struct subnet_record *, + struct response_record *, + struct nmb_name *, + int); + +typedef void (*node_status_success_function)( struct subnet_record *, + struct userdata_struct *, + struct res_rec *, + struct in_addr); +typedef void (*node_status_fail_function)( struct subnet_record *, + struct response_record *); + +/* Initiated name queries are recorded in this list to track any responses. */ + +struct response_record { + struct response_record *next; + struct response_record *prev; + + uint16 response_id; + + /* Callbacks for packets received or not. */ + response_function resp_fn; + timeout_response_function timeout_fn; + + /* Callbacks for the request succeeding or not. */ + success_function success_fn; + fail_function fail_fn; + + struct packet_struct *packet; + + struct userdata_struct *userdata; + + int num_msgs; + + time_t repeat_time; + time_t repeat_interval; + int repeat_count; + + /* Recursion protection. */ + bool in_expiration_processing; +}; + +/* A subnet structure. It contains a list of workgroups and netbios names. */ + +/* + B nodes will have their own, totally separate subnet record, with their + own netbios name set. These do NOT interact with other subnet records' + netbios names. +*/ + +enum subnet_type { + NORMAL_SUBNET = 0, /* Subnet listed in interfaces list. */ + UNICAST_SUBNET = 1, /* Subnet for unicast packets. */ + REMOTE_BROADCAST_SUBNET = 2, /* Subnet for remote broadcasts. */ + WINS_SERVER_SUBNET = 3 /* Only created if we are a WINS server. */ +}; + +struct subnet_record { + struct subnet_record *next; + struct subnet_record *prev; + + char *subnet_name; /* For Debug identification. */ + enum subnet_type type; /* To catagorize the subnet. */ + + struct work_record *workgrouplist; /* List of workgroups. */ + struct name_record *namelist; /* List of netbios names. */ + struct response_record *responselist; /* List of responses expected. */ + + bool namelist_changed; + bool work_changed; + + struct in_addr bcast_ip; + struct in_addr mask_ip; + struct in_addr myip; + int nmb_sock; /* socket to listen for unicast 137. */ + int dgram_sock; /* socket to listen for unicast 138. */ +}; + +/* A resource record. */ +struct res_rec { + struct nmb_name rr_name; + int rr_type; + int rr_class; + int ttl; + int rdlength; + char rdata[MAX_DGRAM_SIZE]; +}; + +/* Define these so we can pass info back to caller of name_query */ +#define NM_FLAGS_RS 0x80 /* Response. Cheat */ +#define NM_FLAGS_AA 0x40 /* Authoritative */ +#define NM_FLAGS_TC 0x20 /* Truncated */ +#define NM_FLAGS_RD 0x10 /* Recursion Desired */ +#define NM_FLAGS_RA 0x08 /* Recursion Available */ +#define NM_FLAGS_B 0x01 /* Broadcast */ + +/* An nmb packet. */ +struct nmb_packet { + struct { + int name_trn_id; + int opcode; + bool response; + struct { + bool bcast; + bool recursion_available; + bool recursion_desired; + bool trunc; + bool authoritative; + } nm_flags; + int rcode; + int qdcount; + int ancount; + int nscount; + int arcount; + } header; + + struct { + struct nmb_name question_name; + int question_type; + int question_class; + } question; + + struct res_rec *answers; + struct res_rec *nsrecs; + struct res_rec *additional; +}; + +/* msg_type field options - from rfc1002. */ + +#define DGRAM_UNIQUE 0x10 +#define DGRAM_GROUP 0x11 +#define DGRAM_BROADCAST 0x12 +/* defined in IDL +#define DGRAM_ERROR 0x13 +*/ +#define DGRAM_QUERY_REQUEST 0x14 +#define DGRAM_POSITIVE_QUERY_RESPONSE 0x15 +#define DGRAM_NEGATIVE_QUERT_RESPONSE 0x16 + +/* A datagram - this normally contains SMB data in the data[] array. */ + +struct dgram_packet { + struct { + int msg_type; + struct { + enum node_type node_type; + bool first; + bool more; + } flags; + int dgm_id; + struct in_addr source_ip; + int source_port; + int dgm_length; + int packet_offset; + } header; + struct nmb_name source_name; + struct nmb_name dest_name; + int datasize; + char data[MAX_DGRAM_SIZE]; +}; + +/* Define a structure used to queue packets. This will be a linked + list of nmb packets. */ + +struct packet_struct +{ + struct packet_struct *next; + struct packet_struct *prev; + bool locked; + struct in_addr ip; + int port; + int fd; + time_t timestamp; + enum packet_type packet_type; + union { + struct nmb_packet nmb; + struct dgram_packet dgram; + } packet; +}; + +/* NETLOGON opcodes */ + +#define QUERYFORPDC 7 /* Query for PDC. */ +#define SAM_UAS_CHANGE 10 /* Announce change to UAS or SAM. */ +#define QUERYFORPDC_R 12 /* Response to Query for PDC. */ +#define SAMLOGON 18 +#define SAMLOGON_R 19 +#define SAMLOGON_UNK_R 21 +#define SAMLOGON_AD_UNK_R 23 +#define SAMLOGON_AD_R 25 + +/* Ids for netbios packet types. */ + +#define ANN_HostAnnouncement 1 +#define ANN_AnnouncementRequest 2 +#define ANN_Election 8 +#define ANN_GetBackupListReq 9 +#define ANN_GetBackupListResp 10 +#define ANN_BecomeBackup 11 +#define ANN_DomainAnnouncement 12 +#define ANN_MasterAnnouncement 13 +#define ANN_ResetBrowserState 14 +#define ANN_LocalMasterAnnouncement 15 + + +/* Broadcast packet announcement intervals, in minutes. */ + +/* Attempt to add domain logon and domain master names. */ +#define CHECK_TIME_ADD_DOM_NAMES 5 + +/* Search for master browsers of workgroups samba knows about, + except default. */ +#define CHECK_TIME_MST_BROWSE 5 + +/* Request backup browser announcements from other servers. */ +#define CHECK_TIME_ANNOUNCE_BACKUP 15 + +/* Request host announcements from other servers: min and max of interval. */ +#define CHECK_TIME_MIN_HOST_ANNCE 3 +#define CHECK_TIME_MAX_HOST_ANNCE 12 + +/* Announce as master to WINS server and any Primary Domain Controllers. */ +#define CHECK_TIME_MST_ANNOUNCE 15 + +/* Time between syncs from domain master browser to local master browsers. */ +#define CHECK_TIME_DMB_TO_LMB_SYNC 15 + +/* Do all remote announcements this often. */ +#define REMOTE_ANNOUNCE_INTERVAL 180 + +/* what is the maximum period between name refreshes. Note that this only + affects non-permanent self names (in seconds) */ +#define MAX_REFRESH_TIME (60*20) + +/* The Extinction interval: 4 days, time a node will stay in released state */ +#define EXTINCTION_INTERVAL (4*24*60*60) + +/* The Extinction time-out: 1 day, time a node will stay in deleted state */ +#define EXTINCTION_TIMEOUT (24*60*60) + +/* Macro's to enumerate subnets either with or without + the UNICAST subnet. */ + +extern struct subnet_record *subnetlist; +extern struct subnet_record *unicast_subnet; +extern struct subnet_record *wins_server_subnet; +extern struct subnet_record *remote_broadcast_subnet; + +#define FIRST_SUBNET subnetlist +#define NEXT_SUBNET_EXCLUDING_UNICAST(x) ((x)->next) +#define NEXT_SUBNET_INCLUDING_UNICAST(x) (get_next_subnet_maybe_unicast((x))) + +/* wins replication record used between nmbd and wrepld */ +typedef struct _WINS_RECORD { + char name[17]; + char type; + int nb_flags; + int wins_flags; + SMB_BIG_UINT id; + int num_ips; + struct in_addr ip[25]; + struct in_addr wins_ip; +} WINS_RECORD; + +/* To be removed. */ +enum state_type { TEST }; +#endif /* _NAMESERV_H_ */ diff --git a/source3/include/ndr.h b/source3/include/ndr.h new file mode 100644 index 0000000000..a416866ef2 --- /dev/null +++ b/source3/include/ndr.h @@ -0,0 +1 @@ +/* dummy file to deal with pidl autogenerated ndr files */ diff --git a/source3/include/nss_info.h b/source3/include/nss_info.h new file mode 100644 index 0000000000..1ff9ebcd55 --- /dev/null +++ b/source3/include/nss_info.h @@ -0,0 +1,90 @@ +/* + Unix SMB/CIFS implementation. + Idmap NSS headers + + Copyright (C) Gerald Carter 2006 + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _IDMAP_NSS_H +#define _IDMAP_NSS_H + +#ifndef HAVE_LDAP +# ifndef LDAPMessage +# define LDAPMessage void +# endif +#endif + +/* The interface version specifier */ + +#define SMB_NSS_INFO_INTERFACE_VERSION 1 + +/* List of available backends. All backends must + register themselves */ + +struct nss_function_entry { + struct nss_function_entry *prev, *next; + + const char *name; + struct nss_info_methods *methods; +}; + +/* List of configured domains. Each domain points + back to its configured backend. */ + +struct nss_domain_entry { + struct nss_domain_entry *prev, *next; + + const char *domain; + + NTSTATUS init_status; + struct nss_function_entry *backend; + + /* hold state on a per domain basis */ + + void *state; +}; + +/* API */ + +struct nss_info_methods { + NTSTATUS (*init)( struct nss_domain_entry *e ); + NTSTATUS (*get_nss_info)( struct nss_domain_entry *e, + const DOM_SID *sid, + TALLOC_CTX *ctx, + ADS_STRUCT *ads, LDAPMessage *msg, + char **homedir, char **shell, char **gecos, gid_t *p_gid); + NTSTATUS (*close_fn)( void ); +}; + + +/* The following definitions come from nsswitch/nss_info.c */ + +NTSTATUS smb_register_idmap_nss(int version, + const char *name, + struct nss_info_methods *methods); + +NTSTATUS nss_init( const char **nss_list ); + +NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid, + TALLOC_CTX *ctx, + ADS_STRUCT *ads, LDAPMessage *msg, + char **homedir, char **shell, char **gecos, + gid_t *p_gid); + +NTSTATUS nss_close( const char *parameters ); + +#endif /* _IDMAP_NSS_H_ */ + diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h new file mode 100644 index 0000000000..479404d6fd --- /dev/null +++ b/source3/include/nt_printing.h @@ -0,0 +1,485 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-2000, + Copyright (C) Jean Francois Micouleau 1998-2000. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef NT_PRINTING_H_ +#define NT_PRINTING_H_ + +#define ORIENTATION 0x00000001L +#define PAPERSIZE 0x00000002L +#define PAPERLENGTH 0x00000004L +#define PAPERWIDTH 0x00000008L +#define SCALE 0x00000010L +#define COPIES 0x00000100L +#define DEFAULTSOURCE 0x00000200L +#define PRINTQUALITY 0x00000400L +#define COLOR 0x00000800L +#define DUPLEX 0x00001000L +#define YRESOLUTION 0x00002000L +#define TTOPTION 0x00004000L +#define COLLATE 0x00008000L +#define FORMNAME 0x00010000L +#define LOGPIXELS 0x00020000L +#define BITSPERPEL 0x00040000L +#define PELSWIDTH 0x00080000L +#define PELSHEIGHT 0x00100000L +#define DISPLAYFLAGS 0x00200000L +#define DISPLAYFREQUENCY 0x00400000L +#define PANNINGWIDTH 0x00800000L +#define PANNINGHEIGHT 0x01000000L + +#define ORIENT_PORTRAIT 1 +#define ORIENT_LANDSCAPE 2 + +#define PAPER_FIRST PAPER_LETTER +#define PAPER_LETTER 1 /* Letter 8 1/2 x 11 in */ +#define PAPER_LETTERSMALL 2 /* Letter Small 8 1/2 x 11 in */ +#define PAPER_TABLOID 3 /* Tabloid 11 x 17 in */ +#define PAPER_LEDGER 4 /* Ledger 17 x 11 in */ +#define PAPER_LEGAL 5 /* Legal 8 1/2 x 14 in */ +#define PAPER_STATEMENT 6 /* Statement 5 1/2 x 8 1/2 in */ +#define PAPER_EXECUTIVE 7 /* Executive 7 1/4 x 10 1/2 in */ +#define PAPER_A3 8 /* A3 297 x 420 mm */ +#define PAPER_A4 9 /* A4 210 x 297 mm */ +#define PAPER_A4SMALL 10 /* A4 Small 210 x 297 mm */ +#define PAPER_A5 11 /* A5 148 x 210 mm */ +#define PAPER_B4 12 /* B4 (JIS) 250 x 354 */ +#define PAPER_B5 13 /* B5 (JIS) 182 x 257 mm */ +#define PAPER_FOLIO 14 /* Folio 8 1/2 x 13 in */ +#define PAPER_QUARTO 15 /* Quarto 215 x 275 mm */ +#define PAPER_10X14 16 /* 10x14 in */ +#define PAPER_11X17 17 /* 11x17 in */ +#define PAPER_NOTE 18 /* Note 8 1/2 x 11 in */ +#define PAPER_ENV_9 19 /* Envelope #9 3 7/8 x 8 7/8 */ +#define PAPER_ENV_10 20 /* Envelope #10 4 1/8 x 9 1/2 */ +#define PAPER_ENV_11 21 /* Envelope #11 4 1/2 x 10 3/8 */ +#define PAPER_ENV_12 22 /* Envelope #12 4 \276 x 11 */ +#define PAPER_ENV_14 23 /* Envelope #14 5 x 11 1/2 */ +#define PAPER_CSHEET 24 /* C size sheet */ +#define PAPER_DSHEET 25 /* D size sheet */ +#define PAPER_ESHEET 26 /* E size sheet */ +#define PAPER_ENV_DL 27 /* Envelope DL 110 x 220mm */ +#define PAPER_ENV_C5 28 /* Envelope C5 162 x 229 mm */ +#define PAPER_ENV_C3 29 /* Envelope C3 324 x 458 mm */ +#define PAPER_ENV_C4 30 /* Envelope C4 229 x 324 mm */ +#define PAPER_ENV_C6 31 /* Envelope C6 114 x 162 mm */ +#define PAPER_ENV_C65 32 /* Envelope C65 114 x 229 mm */ +#define PAPER_ENV_B4 33 /* Envelope B4 250 x 353 mm */ +#define PAPER_ENV_B5 34 /* Envelope B5 176 x 250 mm */ +#define PAPER_ENV_B6 35 /* Envelope B6 176 x 125 mm */ +#define PAPER_ENV_ITALY 36 /* Envelope 110 x 230 mm */ +#define PAPER_ENV_MONARCH 37 /* Envelope Monarch 3.875 x 7.5 in */ +#define PAPER_ENV_PERSONAL 38 /* 6 3/4 Envelope 3 5/8 x 6 1/2 in */ +#define PAPER_FANFOLD_US 39 /* US Std Fanfold 14 7/8 x 11 in */ +#define PAPER_FANFOLD_STD_GERMAN 40 /* German Std Fanfold 8 1/2 x 12 in */ +#define PAPER_FANFOLD_LGL_GERMAN 41 /* German Legal Fanfold 8 1/2 x 13 in */ + +#define PAPER_LAST PAPER_FANFOLD_LGL_GERMAN +#define PAPER_USER 256 + +#define BIN_FIRST BIN_UPPER +#define BIN_UPPER 1 +#define BIN_ONLYONE 1 +#define BIN_LOWER 2 +#define BIN_MIDDLE 3 +#define BIN_MANUAL 4 +#define BIN_ENVELOPE 5 +#define BIN_ENVMANUAL 6 +#define BIN_AUTO 7 +#define BIN_TRACTOR 8 +#define BIN_SMALLFMT 9 +#define BIN_LARGEFMT 10 +#define BIN_LARGECAPACITY 11 +#define BIN_CASSETTE 14 +#define BIN_FORMSOURCE 15 +#define BIN_LAST BIN_FORMSOURCE + +#define BIN_USER 256 /* device specific bins start here */ + +#define RES_DRAFT (-1) +#define RES_LOW (-2) +#define RES_MEDIUM (-3) +#define RES_HIGH (-4) + +#define COLOR_MONOCHROME 1 +#define COLOR_COLOR 2 + +#define DUP_SIMPLEX 1 +#define DUP_VERTICAL 2 +#define DUP_HORIZONTAL 3 + +#define TT_BITMAP 1 /* print TT fonts as graphics */ +#define TT_DOWNLOAD 2 /* download TT fonts as soft fonts */ +#define TT_SUBDEV 3 /* substitute device fonts for TT fonts */ + +#define COLLATE_FALSE 0 +#define COLLATE_TRUE 1 + +typedef struct nt_printer_driver_info_level_3 +{ + uint32 cversion; + + fstring name; + fstring environment; + fstring driverpath; + fstring datafile; + fstring configfile; + fstring helpfile; + fstring monitorname; + fstring defaultdatatype; + fstring *dependentfiles; +} NT_PRINTER_DRIVER_INFO_LEVEL_3; + +/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */ +typedef struct { + uint32 version; + fstring name; + fstring environment; + fstring driverpath; + fstring datafile; + fstring configfile; + fstring helpfile; + fstring monitorname; + fstring defaultdatatype; + fstring mfgname; + fstring oemurl; + fstring hardwareid; + fstring provider; + fstring *dependentfiles; + fstring *previousnames; +} NT_PRINTER_DRIVER_INFO_LEVEL_6; + + +typedef struct nt_printer_driver_info_level +{ + NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3; + NT_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; +} NT_PRINTER_DRIVER_INFO_LEVEL; + +/* predefined registry key names for printer data */ + +#define SPOOL_PRINTERDATA_KEY "PrinterDriverData" +#define SPOOL_DSSPOOLER_KEY "DsSpooler" +#define SPOOL_DSDRIVER_KEY "DsDriver" +#define SPOOL_DSUSER_KEY "DsUser" +#define SPOOL_PNPDATA_KEY "PnPData" +#define SPOOL_OID_KEY "OID" + +/* predefined value names for printer data */ +#define SPOOL_REG_ASSETNUMBER "assetNumber" +#define SPOOL_REG_BYTESPERMINUTE "bytesPerMinute" +#define SPOOL_REG_DEFAULTPRIORITY "defaultPriority" +#define SPOOL_REG_DESCRIPTION "description" +#define SPOOL_REG_DRIVERNAME "driverName" +#define SPOOL_REG_DRIVERVERSION "driverVersion" +#define SPOOL_REG_FLAGS "flags" +#define SPOOL_REG_LOCATION "location" +#define SPOOL_REG_OPERATINGSYSTEM "operatingSystem" +#define SPOOL_REG_OPERATINGSYSTEMHOTFIX "operatingSystemHotfix" +#define SPOOL_REG_OPERATINGSYSTEMSERVICEPACK "operatingSystemServicePack" +#define SPOOL_REG_OPERATINGSYSTEMVERSION "operatingSystemVersion" +#define SPOOL_REG_PORTNAME "portName" +#define SPOOL_REG_PRINTATTRIBUTES "printAttributes" +#define SPOOL_REG_PRINTBINNAMES "printBinNames" +#define SPOOL_REG_PRINTCOLLATE "printCollate" +#define SPOOL_REG_PRINTCOLOR "printColor" +#define SPOOL_REG_PRINTDUPLEXSUPPORTED "printDuplexSupported" +#define SPOOL_REG_PRINTENDTIME "printEndTime" +#define SPOOL_REG_PRINTERNAME "printerName" +#define SPOOL_REG_PRINTFORMNAME "printFormName" +#define SPOOL_REG_PRINTKEEPPRINTEDJOBS "printKeepPrintedJobs" +#define SPOOL_REG_PRINTLANGUAGE "printLanguage" +#define SPOOL_REG_PRINTMACADDRESS "printMACAddress" +#define SPOOL_REG_PRINTMAXCOPIES "printMaxCopies" +#define SPOOL_REG_PRINTMAXRESOLUTIONSUPPORTED "printMaxResolutionSupported" +#define SPOOL_REG_PRINTMAXXEXTENT "printMaxXExtent" +#define SPOOL_REG_PRINTMAXYEXTENT "printMaxYExtent" +#define SPOOL_REG_PRINTMEDIAREADY "printMediaReady" +#define SPOOL_REG_PRINTMEDIASUPPORTED "printMediaSupported" +#define SPOOL_REG_PRINTMEMORY "printMemory" +#define SPOOL_REG_PRINTMINXEXTENT "printMinXExtent" +#define SPOOL_REG_PRINTMINYEXTENT "printMinYExtent" +#define SPOOL_REG_PRINTNETWORKADDRESS "printNetworkAddress" +#define SPOOL_REG_PRINTNOTIFY "printNotify" +#define SPOOL_REG_PRINTNUMBERUP "printNumberUp" +#define SPOOL_REG_PRINTORIENTATIONSSUPPORTED "printOrientationsSupported" +#define SPOOL_REG_PRINTOWNER "printOwner" +#define SPOOL_REG_PRINTPAGESPERMINUTE "printPagesPerMinute" +#define SPOOL_REG_PRINTRATE "printRate" +#define SPOOL_REG_PRINTRATEUNIT "printRateUnit" +#define SPOOL_REG_PRINTSEPARATORFILE "printSeparatorFile" +#define SPOOL_REG_PRINTSHARENAME "printShareName" +#define SPOOL_REG_PRINTSPOOLING "printSpooling" +#define SPOOL_REGVAL_PRINTWHILESPOOLING "PrintWhileSpooling" +#define SPOOL_REGVAL_PRINTAFTERSPOOLED "PrintAfterSpooled" +#define SPOOL_REGVAL_PRINTDIRECT "PrintDirect" +#define SPOOL_REG_PRINTSTAPLINGSUPPORTED "printStaplingSupported" +#define SPOOL_REG_PRINTSTARTTIME "printStartTime" +#define SPOOL_REG_PRINTSTATUS "printStatus" +#define SPOOL_REG_PRIORITY "priority" +#define SPOOL_REG_SERVERNAME "serverName" +#define SPOOL_REG_SHORTSERVERNAME "shortServerName" +#define SPOOL_REG_UNCNAME "uNCName" +#define SPOOL_REG_URL "url" +#define SPOOL_REG_VERSIONNUMBER "versionNumber" + +/* container for a single registry key */ + +typedef struct { + char *name; + REGVAL_CTR *values; +} NT_PRINTER_KEY; + +/* container for all printer data */ + +typedef struct { + int num_keys; + NT_PRINTER_KEY *keys; +} NT_PRINTER_DATA; + +#define MAXDEVICENAME 32 + +typedef struct ntdevicemode +{ + fstring devicename; + fstring formname; + + uint16 specversion; + uint16 driverversion; + uint16 size; + uint16 driverextra; + uint16 orientation; + uint16 papersize; + uint16 paperlength; + uint16 paperwidth; + uint16 scale; + uint16 copies; + uint16 defaultsource; + uint16 printquality; + uint16 color; + uint16 duplex; + uint16 yresolution; + uint16 ttoption; + uint16 collate; + uint16 logpixels; + + uint32 fields; + uint32 bitsperpel; + uint32 pelswidth; + uint32 pelsheight; + uint32 displayflags; + uint32 displayfrequency; + uint32 icmmethod; + uint32 icmintent; + uint32 mediatype; + uint32 dithertype; + uint32 reserved1; + uint32 reserved2; + uint32 panningwidth; + uint32 panningheight; + uint8 *nt_dev_private; +} NT_DEVICEMODE; + +typedef struct nt_printer_info_level_2 +{ + uint32 attributes; + uint32 priority; + uint32 default_priority; + uint32 starttime; + uint32 untiltime; + uint32 status; + uint32 cjobs; + uint32 averageppm; + fstring servername; + fstring printername; + fstring sharename; + fstring portname; + fstring drivername; + char comment[1024]; + fstring location; + NT_DEVICEMODE *devmode; + fstring sepfile; + fstring printprocessor; + fstring datatype; + fstring parameters; + NT_PRINTER_DATA *data; + SEC_DESC_BUF *secdesc_buf; + uint32 changeid; + uint32 c_setprinter; + uint32 setuptime; +} NT_PRINTER_INFO_LEVEL_2; + +typedef struct nt_printer_info_level +{ + NT_PRINTER_INFO_LEVEL_2 *info_2; +} NT_PRINTER_INFO_LEVEL; + +typedef struct +{ + fstring name; + uint32 flag; + uint32 width; + uint32 length; + uint32 left; + uint32 top; + uint32 right; + uint32 bottom; +} nt_forms_struct; + +#ifndef SAMBA_PRINTER_PORT_NAME +#define SAMBA_PRINTER_PORT_NAME "Samba Printer Port" +#endif + + +/* + * Structures for the XcvDataPort() calls + */ + +#define PORT_PROTOCOL_DIRECT 1 +#define PORT_PROTOCOL_LPR 2 + +typedef struct { + fstring name; + uint32 version; + uint32 protocol; + fstring hostaddr; + fstring snmpcommunity; + fstring queue; + uint32 dblspool; + fstring ipaddr; + uint32 port; + bool enable_snmp; + uint32 snmp_index; +} NT_PORT_DATA_1; + +/* DOS header format */ +#define DOS_HEADER_SIZE 64 +#define DOS_HEADER_MAGIC_OFFSET 0 +#define DOS_HEADER_MAGIC 0x5A4D +#define DOS_HEADER_LFANEW_OFFSET 60 + +/* New Executable format (Win or OS/2 1.x segmented) */ +#define NE_HEADER_SIZE 64 +#define NE_HEADER_SIGNATURE_OFFSET 0 +#define NE_HEADER_SIGNATURE 0x454E +#define NE_HEADER_TARGET_OS_OFFSET 54 +#define NE_HEADER_TARGOS_WIN 0x02 +#define NE_HEADER_MINOR_VER_OFFSET 62 +#define NE_HEADER_MAJOR_VER_OFFSET 63 + +/* Portable Executable format */ +#define PE_HEADER_SIZE 24 +#define PE_HEADER_SIGNATURE_OFFSET 0 +#define PE_HEADER_SIGNATURE 0x00004550 +#define PE_HEADER_MACHINE_OFFSET 4 +#define PE_HEADER_MACHINE_I386 0x14c +#define PE_HEADER_NUMBER_OF_SECTIONS 6 +#define PE_HEADER_OPTIONAL_HEADER_SIZE 20 +#define PE_HEADER_SECT_HEADER_SIZE 40 +#define PE_HEADER_SECT_NAME_OFFSET 0 +#define PE_HEADER_SECT_SIZE_DATA_OFFSET 16 +#define PE_HEADER_SECT_PTR_DATA_OFFSET 20 + +/* Microsoft file version format */ +#define VS_SIGNATURE "VS_VERSION_INFO" +#define VS_MAGIC_VALUE 0xfeef04bd +#define VS_MAJOR_OFFSET 8 +#define VS_MINOR_OFFSET 12 +#define VS_VERSION_INFO_UNICODE_SIZE (sizeof(VS_SIGNATURE)*2+4+VS_MINOR_OFFSET+4) /* not true size! */ +#define VS_VERSION_INFO_SIZE (sizeof(VS_SIGNATURE)+4+VS_MINOR_OFFSET+4) /* not true size! */ +#define VS_NE_BUF_SIZE 4096 /* Must be > 2*VS_VERSION_INFO_SIZE */ + +/* Notify spoolss clients that something has changed. The + notification data is either stored in two uint32 values or a + variable length array. */ + +#define SPOOLSS_NOTIFY_MSG_UNIX_JOBID 0x0001 /* Job id is unix */ + +typedef struct spoolss_notify_msg { + fstring printer; /* Name of printer notified */ + uint32 type; /* Printer or job notify */ + uint32 field; /* Notify field changed */ + uint32 id; /* Job id */ + uint32 len; /* Length of data, 0 for two uint32 value */ + uint32 flags; + union { + uint32 value[2]; + char *data; + } notify; +} SPOOLSS_NOTIFY_MSG; + +typedef struct { + fstring printername; + uint32 num_msgs; + SPOOLSS_NOTIFY_MSG *msgs; +} SPOOLSS_NOTIFY_MSG_GROUP; + +typedef struct { + TALLOC_CTX *ctx; + uint32 num_groups; + SPOOLSS_NOTIFY_MSG_GROUP *msg_groups; +} SPOOLSS_NOTIFY_MSG_CTR; + +#define SPLHND_PRINTER 1 +#define SPLHND_SERVER 2 +#define SPLHND_PORTMON_TCP 3 +#define SPLHND_PORTMON_LOCAL 4 + +/* structure to store the printer handles */ +/* and a reference to what it's pointing to */ +/* and the notify info asked about */ +/* that's the central struct */ +typedef struct _Printer{ + struct _Printer *prev, *next; + bool document_started; + bool page_started; + uint32 jobid; /* jobid in printing backend */ + int printer_type; + TALLOC_CTX *ctx; + fstring servername; + fstring sharename; + uint32 type; + uint32 access_granted; + struct { + uint32 flags; + uint32 options; + fstring localmachine; + uint32 printerlocal; + SPOOL_NOTIFY_OPTION *option; + POLICY_HND client_hnd; + bool client_connected; + uint32 change; + /* are we in a FindNextPrinterChangeNotify() call? */ + bool fnpcn; + } notify; + struct { + fstring machine; + fstring user; + } client; + + /* devmode sent in the OpenPrinter() call */ + NT_DEVICEMODE *nt_devmode; + + /* cache the printer info */ + NT_PRINTER_INFO_LEVEL *printer_info; + +} Printer_entry; + +#endif /* NT_PRINTING_H_ */ diff --git a/source3/include/nt_status.h b/source3/include/nt_status.h new file mode 100644 index 0000000000..30174e4b51 --- /dev/null +++ b/source3/include/nt_status.h @@ -0,0 +1,115 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup, plus a whole lot more. + + Copyright (C) Andrew Tridgell 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _NT_STATUS_H +#define _NT_STATUS_H + +/* The Splint code analysis tool doesn't like immediate structures. */ + +#ifdef _SPLINT_ /* http://www.splint.org */ +#undef HAVE_IMMEDIATE_STRUCTURES +#endif + +/* The following rather strange looking definitions of NTSTATUS and WERROR + are there in order to catch common coding errors where different error types + are mixed up. This is especially important as we slowly convert Samba + from using bool for internal functions. +*/ + +#if defined(HAVE_IMMEDIATE_STRUCTURES) +typedef struct {uint32 v;} NTSTATUS; +#define NT_STATUS(x) ((NTSTATUS) { x }) +#define NT_STATUS_V(x) ((x).v) +#else +typedef uint32 NTSTATUS; +#define NT_STATUS(x) (x) +#define NT_STATUS_V(x) (x) +#endif + +#if defined(HAVE_IMMEDIATE_STRUCTURES) +typedef struct {uint32 w;} WERROR; +#define W_ERROR(x) ((WERROR) { x }) +#define W_ERROR_V(x) ((x).w) +#else +typedef uint32 WERROR; +#define W_ERROR(x) (x) +#define W_ERROR_V(x) (x) +#endif + +#define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0) +#define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000) +#define NT_STATUS_EQUAL(x,y) (NT_STATUS_V(x) == NT_STATUS_V(y)) +#define W_ERROR_IS_OK(x) (W_ERROR_V(x) == 0) +#define W_ERROR_EQUAL(x,y) (W_ERROR_V(x) == W_ERROR_V(y)) + +#define NT_STATUS_HAVE_NO_MEMORY(x) do { \ + if (!(x)) {\ + return NT_STATUS_NO_MEMORY;\ + }\ +} while (0) + +#define NT_STATUS_NOT_OK_RETURN(x) do { \ + if (!NT_STATUS_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +#define W_ERROR_HAVE_NO_MEMORY(x) do { \ + if (!(x)) {\ + return WERR_NOMEM;\ + }\ +} while (0) + +#define W_ERROR_NOT_OK_RETURN(x) do { \ + if (!W_ERROR_IS_OK(x)) {\ + return x;\ + }\ +} while (0) + +/* The top byte in an NTSTATUS code is used as a type field. + * Windows only uses value 0xC0 as an indicator for an NT error + * and 0x00 for success. + * So we can use the type field to store other types of error codes + * inside the three lower bytes. + * NB: The system error codes (errno) are not integrated via a type of + * their own but are mapped to genuine NT error codes via + * map_nt_error_from_unix() */ + +#define NT_STATUS_TYPE(status) ((NT_STATUS_V(status) & 0xFF000000) >> 24) + +#define NT_STATUS_TYPE_DOS 0xF1 +#define NT_STATUS_TYPE_LDAP 0xF2 + +/* this defines special NTSTATUS codes to represent DOS errors. I + have chosen this macro to produce status codes in the invalid + NTSTATUS range */ +#define NT_STATUS_DOS_MASK (NT_STATUS_TYPE_DOS << 24) +#define NT_STATUS_DOS(class, code) NT_STATUS(NT_STATUS_DOS_MASK | ((class)<<16) | code) +#define NT_STATUS_IS_DOS(status) ((NT_STATUS_V(status) & 0xFF000000) == NT_STATUS_DOS_MASK) +#define NT_STATUS_DOS_CLASS(status) ((NT_STATUS_V(status) >> 16) & 0xFF) +#define NT_STATUS_DOS_CODE(status) (NT_STATUS_V(status) & 0xFFFF) + +/* define ldap error codes as NTSTATUS codes */ +#define NT_STATUS_LDAP_MASK (NT_STATUS_TYPE_LDAP << 24) +#define NT_STATUS_LDAP(code) NT_STATUS(NT_STATUS_LDAP_MASK | code) +#define NT_STATUS_IS_LDAP(status) ((NT_STATUS_V(status) & 0xFF000000) == NT_STATUS_LDAP_MASK) +#define NT_STATUS_LDAP_CODE(status) (NT_STATUS_V(status) & ~0xFF000000) + +#endif diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h new file mode 100644 index 0000000000..de0a313609 --- /dev/null +++ b/source3/include/ntdomain.h @@ -0,0 +1,376 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + Copyright (C) Jeremy Allison 2000-2004 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _NT_DOMAIN_H /* _NT_DOMAIN_H */ +#define _NT_DOMAIN_H + +/* + * A bunch of stuff that was put into smb.h + * in the NTDOM branch - it didn't belong there. + */ + +typedef struct _prs_struct { + bool io; /* parsing in or out of data stream */ + /* + * If the (incoming) data is big-endian. On output we are + * always little-endian. + */ + bool bigendian_data; + uint8 align; /* data alignment */ + bool is_dynamic; /* Do we own this memory or not ? */ + uint32 data_offset; /* Current working offset into data. */ + uint32 buffer_size; /* Current allocated size of the buffer. */ + uint32 grow_size; /* size requested via prs_grow() calls */ + char *data_p; /* The buffer itself. */ + TALLOC_CTX *mem_ctx; /* When unmarshalling, use this.... */ + const char *sess_key; /* If we have to do encrypt/decrypt on the fly. */ +} prs_struct; + +/* + * Defines for io member of prs_struct. + */ + +#define MARSHALL 0 +#define UNMARSHALL 1 + +#define MARSHALLING(ps) (!(ps)->io) +#define UNMARSHALLING(ps) ((ps)->io) + +#define RPC_BIG_ENDIAN 1 +#define RPC_LITTLE_ENDIAN 0 + +#define RPC_PARSE_ALIGN 4 + +typedef struct _output_data { + /* + * Raw RPC output data. This does not include RPC headers or footers. + */ + prs_struct rdata; + + /* The amount of data sent from the current rdata struct. */ + uint32 data_sent_length; + + /* + * The current PDU being returned. This inclues + * headers, data and authentication footer. + */ + unsigned char current_pdu[RPC_MAX_PDU_FRAG_LEN]; + + /* The amount of data in the current_pdu buffer. */ + uint32 current_pdu_len; + + /* The amount of data sent from the current PDU. */ + uint32 current_pdu_sent; +} output_data; + +typedef struct _input_data { + /* + * This is the current incoming pdu. The data here + * is collected via multiple writes until a complete + * pdu is seen, then the data is copied into the in_data + * structure. The maximum size of this is 0x1630 (RPC_MAX_PDU_FRAG_LEN). + */ + unsigned char current_in_pdu[RPC_MAX_PDU_FRAG_LEN]; + + /* + * The amount of data needed to complete the in_pdu. + * If this is zero, then we are at the start of a new + * pdu. + */ + uint32 pdu_needed_len; + + /* + * The amount of data received so far in the in_pdu. + * If this is zero, then we are at the start of a new + * pdu. + */ + uint32 pdu_received_len; + + /* + * This is the collection of input data with all + * the rpc headers and auth footers removed. + * The maximum length of this (1Mb) is strictly enforced. + */ + prs_struct data; +} input_data; + +/* + * Handle database - stored per pipe. + */ + +struct policy { + struct policy *next, *prev; + + POLICY_HND pol_hnd; + + void *data_ptr; + void (*free_fn)(void *); +}; + +struct handle_list { + struct policy *Policy; /* List of policies. */ + size_t count; /* Current number of handles. */ + size_t pipe_ref_count; /* Number of pipe handles referring to this list. */ +}; + +/* Domain controller authentication protocol info */ +struct dcinfo { + uint32 sequence; /* "timestamp" from client. */ + struct netr_Credential seed_chal; + struct netr_Credential clnt_chal; /* Client credential */ + struct netr_Credential srv_chal; /* Server credential */ + + unsigned char sess_key[16]; /* Session key - 8 bytes followed by 8 zero bytes */ + unsigned char mach_pw[16]; /* md4(machine password) */ + + fstring mach_acct; /* Machine name we've authenticated. */ + + fstring remote_machine; /* Machine name we've authenticated. */ + fstring domain; + + bool challenge_sent; + bool authenticated; +}; + +typedef struct pipe_rpc_fns { + + struct pipe_rpc_fns *next, *prev; + + /* RPC function table associated with the current rpc_bind (associated by context) */ + + const struct api_struct *cmds; + int n_cmds; + uint32 context_id; + +} PIPE_RPC_FNS; + +/* + * Different auth types we support. + * Can't keep in sync with wire values as spnego wraps different auth methods. + */ + +enum pipe_auth_type { PIPE_AUTH_TYPE_NONE = 0, PIPE_AUTH_TYPE_NTLMSSP, PIPE_AUTH_TYPE_SCHANNEL, + PIPE_AUTH_TYPE_SPNEGO_NTLMSSP, PIPE_AUTH_TYPE_KRB5, PIPE_AUTH_TYPE_SPNEGO_KRB5 }; + +/* Possible auth levels - keep these in sync with the wire values. */ +enum pipe_auth_level { PIPE_AUTH_LEVEL_NONE = 0, + PIPE_AUTH_LEVEL_CONNECT = 1, /* We treat as NONE. */ + PIPE_AUTH_LEVEL_INTEGRITY = 5, /* Sign. */ + PIPE_AUTH_LEVEL_PRIVACY = 6 /* Seal. */ +}; + +/* auth state for krb5. */ +struct kerberos_auth_struct { + const char *service_principal; + DATA_BLOB session_key; +}; + +/* auth state for schannel. */ +struct schannel_auth_struct { + unsigned char sess_key[16]; + uint32 seq_num; +}; + +/* auth state for all bind types. */ + +struct pipe_auth_data { + enum pipe_auth_type auth_type; /* switch for union below. */ + enum pipe_auth_level auth_level; + union { + struct schannel_auth_struct *schannel_auth; + AUTH_NTLMSSP_STATE *auth_ntlmssp_state; +/* struct kerberos_auth_struct *kerberos_auth; TO BE ADDED... */ + } a_u; + void (*auth_data_free_func)(struct pipe_auth_data *); +}; + +/* + * DCE/RPC-specific samba-internal-specific handling of data on + * NamedPipes. + */ + +typedef struct pipes_struct { + struct pipes_struct *next, *prev; + + char client_address[INET6_ADDRSTRLEN]; + + struct auth_serversupplied_info *server_info; + + fstring name; + fstring pipe_srv_name; + + /* linked list of rpc dispatch tables associated + with the open rpc contexts */ + + PIPE_RPC_FNS *contexts; + + RPC_HDR hdr; /* Incoming RPC header. */ + RPC_HDR_REQ hdr_req; /* Incoming request header. */ + + struct pipe_auth_data auth; + + struct dcinfo *dc; /* Keeps the creds data from netlogon. */ + + /* + * Unix user name and credentials used when a pipe is authenticated. + */ + + struct current_user pipe_user; + + /* + * Set to true when an RPC bind has been done on this pipe. + */ + + bool pipe_bound; + + /* + * Set to true when we should return fault PDU's for everything. + */ + + bool fault_state; + + /* + * Set to true when we should return fault PDU's for a bad handle. + */ + + bool bad_handle_fault_state; + + /* + * Set to true when the backend does not support a call. + */ + + bool rng_fault_state; + + /* + * Set to RPC_BIG_ENDIAN when dealing with big-endian PDU's + */ + + bool endian; + + /* + * Struct to deal with multiple pdu inputs. + */ + + input_data in_data; + + /* + * Struct to deal with multiple pdu outputs. + */ + + output_data out_data; + + /* This context is used for PDU data and is freed between each pdu. + Don't use for pipe state storage. */ + TALLOC_CTX *mem_ctx; + + /* handle database to use on this pipe. */ + struct handle_list *pipe_handles; + +} pipes_struct; + +typedef struct smb_np_struct { + struct smb_np_struct *next, *prev; + int pnum; + connection_struct *conn; + uint16 vuid; /* points to the unauthenticated user that opened this pipe. */ + bool open; /* open connection */ + uint16 device_state; + uint16 priority; + char *name; + + /* When replying to an SMBtrans, this is the maximum amount of + data that can be sent in the initial reply. */ + int max_trans_reply; + + /* + * NamedPipe state information. + */ + struct pipes_struct *np_state; + + /* + * NamedPipe functions, to be called to perform + * Named Pipe transactions on request from an + * SMB client. + */ + + /* call to create a named pipe connection. + * returns: state information representing the connection. + * is stored in np_state, above. + */ + struct pipes_struct *(*namedpipe_create)( + const char *pipe_name, + const char *client_address, + struct auth_serversupplied_info *server_info, + uint16_t vuid); + + /* call to perform a write namedpipe operation + */ + ssize_t (*namedpipe_write)(struct pipes_struct *p, + char *data, size_t n); + + /* call to perform a read namedpipe operation. + * + * NOTE: the only reason that the pipe_outstanding + * argument is here is because samba does not use + * the namedpipe_transact function yet: instead, + * it performs the same as what namedpipe_transact + * does - a write, followed by a read. + * + * when samba is modified to use namedpipe_transact, + * the pipe_outstanding argument may be removed. + */ + ssize_t (*namedpipe_read)(struct pipes_struct *p, + char *data, size_t max_len, + bool *pipe_outstanding); + +} smb_np_struct; + +struct api_struct { + const char *name; + uint8 opnum; + bool (*fn) (pipes_struct *); +}; + +typedef struct { + uint32 rid; + const char *name; +} rid_name; + +/* + * higher order functions for use with msrpc client code + */ + +#define PRINT_INFO_FN(fn)\ + void (*fn)(const char*, uint32, uint32, void *const *const) +#define JOB_INFO_FN(fn)\ + void (*fn)(const char*, const char*, uint32, uint32, void *const *const) + +/* end higher order functions */ + +typedef struct { + uint32 size; + prs_struct prs; + uint32 struct_start; + uint32 string_at_end; +} RPC_BUFFER; + +#endif /* _NT_DOMAIN_H */ diff --git a/source3/include/nterr.h b/source3/include/nterr.h new file mode 100644 index 0000000000..612cf6ea1b --- /dev/null +++ b/source3/include/nterr.h @@ -0,0 +1,571 @@ +/* + Unix SMB/CIFS implementation. + NT error code constants + Copyright (C) Andrew Tridgell 1992-2000 + Copyright (C) John H Terpstra 1996-2000 + Copyright (C) Luke Kenneth Casson Leighton 1996-2000 + Copyright (C) Paul Ashton 1998-2000 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _NTERR_H +#define _NTERR_H + +/* Win32 Status codes. */ + +#define STATUS_BUFFER_OVERFLOW NT_STATUS(0x80000005) +#define STATUS_NO_MORE_FILES NT_STATUS(0x80000006) +#define NT_STATUS_NO_MORE_ENTRIES NT_STATUS(0x8000001a) + +/* Vista Status codes. */ +#define NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT NT_STATUS(0x8000002d) + +#define STATUS_MORE_ENTRIES NT_STATUS(0x0105) +#define STATUS_SOME_UNMAPPED NT_STATUS(0x0107) +#define ERROR_INVALID_PARAMETER NT_STATUS(0x0057) +#define ERROR_INSUFFICIENT_BUFFER NT_STATUS(0x007a) +#define STATUS_NOTIFY_ENUM_DIR NT_STATUS(0x010c) +#define ERROR_INVALID_DATATYPE NT_STATUS(0x070c) + +/* Win32 Error codes extracted using a loop in smbclient then printing a + netmon sniff to a file. */ + +/* + -------------- + / \ + / REST \ + / IN \ + / PEACE \ + / \ + | NT_STATUS_NOPROBLEMO | + | | + | | + | 4 September | + | | + | 2001 | + *| * * * | * + _________)/\\_//(\/(/\)/\//\/\///|_)_______ +*/ + +#define NT_STATUS_OK NT_STATUS(0x0000) +#define NT_STATUS_UNSUCCESSFUL NT_STATUS(0xC0000000 | 0x0001) +#define NT_STATUS_NOT_IMPLEMENTED NT_STATUS(0xC0000000 | 0x0002) +#define NT_STATUS_INVALID_INFO_CLASS NT_STATUS(0xC0000000 | 0x0003) +#define NT_STATUS_INFO_LENGTH_MISMATCH NT_STATUS(0xC0000000 | 0x0004) +#define NT_STATUS_ACCESS_VIOLATION NT_STATUS(0xC0000000 | 0x0005) +#define NT_STATUS_IN_PAGE_ERROR NT_STATUS(0xC0000000 | 0x0006) +#define NT_STATUS_PAGEFILE_QUOTA NT_STATUS(0xC0000000 | 0x0007) +#define NT_STATUS_INVALID_HANDLE NT_STATUS(0xC0000000 | 0x0008) +#define NT_STATUS_BAD_INITIAL_STACK NT_STATUS(0xC0000000 | 0x0009) +#define NT_STATUS_BAD_INITIAL_PC NT_STATUS(0xC0000000 | 0x000a) +#define NT_STATUS_INVALID_CID NT_STATUS(0xC0000000 | 0x000b) +#define NT_STATUS_TIMER_NOT_CANCELED NT_STATUS(0xC0000000 | 0x000c) +#define NT_STATUS_INVALID_PARAMETER NT_STATUS(0xC0000000 | 0x000d) +#define NT_STATUS_NO_SUCH_DEVICE NT_STATUS(0xC0000000 | 0x000e) +#define NT_STATUS_NO_SUCH_FILE NT_STATUS(0xC0000000 | 0x000f) +#define NT_STATUS_INVALID_DEVICE_REQUEST NT_STATUS(0xC0000000 | 0x0010) +#define NT_STATUS_END_OF_FILE NT_STATUS(0xC0000000 | 0x0011) +#define NT_STATUS_WRONG_VOLUME NT_STATUS(0xC0000000 | 0x0012) +#define NT_STATUS_NO_MEDIA_IN_DEVICE NT_STATUS(0xC0000000 | 0x0013) +#define NT_STATUS_UNRECOGNIZED_MEDIA NT_STATUS(0xC0000000 | 0x0014) +#define NT_STATUS_NONEXISTENT_SECTOR NT_STATUS(0xC0000000 | 0x0015) +#define NT_STATUS_MORE_PROCESSING_REQUIRED NT_STATUS(0xC0000000 | 0x0016) +#define NT_STATUS_NO_MEMORY NT_STATUS(0xC0000000 | 0x0017) +#define NT_STATUS_CONFLICTING_ADDRESSES NT_STATUS(0xC0000000 | 0x0018) +#define NT_STATUS_NOT_MAPPED_VIEW NT_STATUS(0xC0000000 | 0x0019) +#define NT_STATUS_UNABLE_TO_FREE_VM NT_STATUS(0xC0000000 | 0x001a) +#define NT_STATUS_UNABLE_TO_DELETE_SECTION NT_STATUS(0xC0000000 | 0x001b) +#define NT_STATUS_INVALID_SYSTEM_SERVICE NT_STATUS(0xC0000000 | 0x001c) +#define NT_STATUS_ILLEGAL_INSTRUCTION NT_STATUS(0xC0000000 | 0x001d) +#define NT_STATUS_INVALID_LOCK_SEQUENCE NT_STATUS(0xC0000000 | 0x001e) +#define NT_STATUS_INVALID_VIEW_SIZE NT_STATUS(0xC0000000 | 0x001f) +#define NT_STATUS_INVALID_FILE_FOR_SECTION NT_STATUS(0xC0000000 | 0x0020) +#define NT_STATUS_ALREADY_COMMITTED NT_STATUS(0xC0000000 | 0x0021) +#define NT_STATUS_ACCESS_DENIED NT_STATUS(0xC0000000 | 0x0022) +#define NT_STATUS_BUFFER_TOO_SMALL NT_STATUS(0xC0000000 | 0x0023) +#define NT_STATUS_OBJECT_TYPE_MISMATCH NT_STATUS(0xC0000000 | 0x0024) +#define NT_STATUS_NONCONTINUABLE_EXCEPTION NT_STATUS(0xC0000000 | 0x0025) +#define NT_STATUS_INVALID_DISPOSITION NT_STATUS(0xC0000000 | 0x0026) +#define NT_STATUS_UNWIND NT_STATUS(0xC0000000 | 0x0027) +#define NT_STATUS_BAD_STACK NT_STATUS(0xC0000000 | 0x0028) +#define NT_STATUS_INVALID_UNWIND_TARGET NT_STATUS(0xC0000000 | 0x0029) +#define NT_STATUS_NOT_LOCKED NT_STATUS(0xC0000000 | 0x002a) +#define NT_STATUS_PARITY_ERROR NT_STATUS(0xC0000000 | 0x002b) +#define NT_STATUS_UNABLE_TO_DECOMMIT_VM NT_STATUS(0xC0000000 | 0x002c) +#define NT_STATUS_NOT_COMMITTED NT_STATUS(0xC0000000 | 0x002d) +#define NT_STATUS_INVALID_PORT_ATTRIBUTES NT_STATUS(0xC0000000 | 0x002e) +#define NT_STATUS_PORT_MESSAGE_TOO_LONG NT_STATUS(0xC0000000 | 0x002f) +#define NT_STATUS_INVALID_PARAMETER_MIX NT_STATUS(0xC0000000 | 0x0030) +#define NT_STATUS_INVALID_QUOTA_LOWER NT_STATUS(0xC0000000 | 0x0031) +#define NT_STATUS_DISK_CORRUPT_ERROR NT_STATUS(0xC0000000 | 0x0032) +#define NT_STATUS_OBJECT_NAME_INVALID NT_STATUS(0xC0000000 | 0x0033) +#define NT_STATUS_OBJECT_NAME_NOT_FOUND NT_STATUS(0xC0000000 | 0x0034) +#define NT_STATUS_OBJECT_NAME_COLLISION NT_STATUS(0xC0000000 | 0x0035) +#define NT_STATUS_HANDLE_NOT_WAITABLE NT_STATUS(0xC0000000 | 0x0036) +#define NT_STATUS_PORT_DISCONNECTED NT_STATUS(0xC0000000 | 0x0037) +#define NT_STATUS_DEVICE_ALREADY_ATTACHED NT_STATUS(0xC0000000 | 0x0038) +#define NT_STATUS_OBJECT_PATH_INVALID NT_STATUS(0xC0000000 | 0x0039) +#define NT_STATUS_OBJECT_PATH_NOT_FOUND NT_STATUS(0xC0000000 | 0x003a) +#define NT_STATUS_OBJECT_PATH_SYNTAX_BAD NT_STATUS(0xC0000000 | 0x003b) +#define NT_STATUS_DATA_OVERRUN NT_STATUS(0xC0000000 | 0x003c) +#define NT_STATUS_DATA_LATE_ERROR NT_STATUS(0xC0000000 | 0x003d) +#define NT_STATUS_DATA_ERROR NT_STATUS(0xC0000000 | 0x003e) +#define NT_STATUS_CRC_ERROR NT_STATUS(0xC0000000 | 0x003f) +#define NT_STATUS_SECTION_TOO_BIG NT_STATUS(0xC0000000 | 0x0040) +#define NT_STATUS_PORT_CONNECTION_REFUSED NT_STATUS(0xC0000000 | 0x0041) +#define NT_STATUS_INVALID_PORT_HANDLE NT_STATUS(0xC0000000 | 0x0042) +#define NT_STATUS_SHARING_VIOLATION NT_STATUS(0xC0000000 | 0x0043) +#define NT_STATUS_QUOTA_EXCEEDED NT_STATUS(0xC0000000 | 0x0044) +#define NT_STATUS_INVALID_PAGE_PROTECTION NT_STATUS(0xC0000000 | 0x0045) +#define NT_STATUS_MUTANT_NOT_OWNED NT_STATUS(0xC0000000 | 0x0046) +#define NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED NT_STATUS(0xC0000000 | 0x0047) +#define NT_STATUS_PORT_ALREADY_SET NT_STATUS(0xC0000000 | 0x0048) +#define NT_STATUS_SECTION_NOT_IMAGE NT_STATUS(0xC0000000 | 0x0049) +#define NT_STATUS_SUSPEND_COUNT_EXCEEDED NT_STATUS(0xC0000000 | 0x004a) +#define NT_STATUS_THREAD_IS_TERMINATING NT_STATUS(0xC0000000 | 0x004b) +#define NT_STATUS_BAD_WORKING_SET_LIMIT NT_STATUS(0xC0000000 | 0x004c) +#define NT_STATUS_INCOMPATIBLE_FILE_MAP NT_STATUS(0xC0000000 | 0x004d) +#define NT_STATUS_SECTION_PROTECTION NT_STATUS(0xC0000000 | 0x004e) +#define NT_STATUS_EAS_NOT_SUPPORTED NT_STATUS(0xC0000000 | 0x004f) +#define NT_STATUS_EA_TOO_LARGE NT_STATUS(0xC0000000 | 0x0050) +#define NT_STATUS_NONEXISTENT_EA_ENTRY NT_STATUS(0xC0000000 | 0x0051) +#define NT_STATUS_NO_EAS_ON_FILE NT_STATUS(0xC0000000 | 0x0052) +#define NT_STATUS_EA_CORRUPT_ERROR NT_STATUS(0xC0000000 | 0x0053) +#define NT_STATUS_FILE_LOCK_CONFLICT NT_STATUS(0xC0000000 | 0x0054) +#define NT_STATUS_LOCK_NOT_GRANTED NT_STATUS(0xC0000000 | 0x0055) +#define NT_STATUS_DELETE_PENDING NT_STATUS(0xC0000000 | 0x0056) +#define NT_STATUS_CTL_FILE_NOT_SUPPORTED NT_STATUS(0xC0000000 | 0x0057) +#define NT_STATUS_UNKNOWN_REVISION NT_STATUS(0xC0000000 | 0x0058) +#define NT_STATUS_REVISION_MISMATCH NT_STATUS(0xC0000000 | 0x0059) +#define NT_STATUS_INVALID_OWNER NT_STATUS(0xC0000000 | 0x005a) +#define NT_STATUS_INVALID_PRIMARY_GROUP NT_STATUS(0xC0000000 | 0x005b) +#define NT_STATUS_NO_IMPERSONATION_TOKEN NT_STATUS(0xC0000000 | 0x005c) +#define NT_STATUS_CANT_DISABLE_MANDATORY NT_STATUS(0xC0000000 | 0x005d) +#define NT_STATUS_NO_LOGON_SERVERS NT_STATUS(0xC0000000 | 0x005e) +#define NT_STATUS_NO_SUCH_LOGON_SESSION NT_STATUS(0xC0000000 | 0x005f) +#define NT_STATUS_NO_SUCH_PRIVILEGE NT_STATUS(0xC0000000 | 0x0060) +#define NT_STATUS_PRIVILEGE_NOT_HELD NT_STATUS(0xC0000000 | 0x0061) +#define NT_STATUS_INVALID_ACCOUNT_NAME NT_STATUS(0xC0000000 | 0x0062) +#define NT_STATUS_USER_EXISTS NT_STATUS(0xC0000000 | 0x0063) +#define NT_STATUS_NO_SUCH_USER NT_STATUS(0xC0000000 | 0x0064) +#define NT_STATUS_GROUP_EXISTS NT_STATUS(0xC0000000 | 0x0065) +#define NT_STATUS_NO_SUCH_GROUP NT_STATUS(0xC0000000 | 0x0066) +#define NT_STATUS_MEMBER_IN_GROUP NT_STATUS(0xC0000000 | 0x0067) +#define NT_STATUS_MEMBER_NOT_IN_GROUP NT_STATUS(0xC0000000 | 0x0068) +#define NT_STATUS_LAST_ADMIN NT_STATUS(0xC0000000 | 0x0069) +#define NT_STATUS_WRONG_PASSWORD NT_STATUS(0xC0000000 | 0x006a) +#define NT_STATUS_ILL_FORMED_PASSWORD NT_STATUS(0xC0000000 | 0x006b) +#define NT_STATUS_PASSWORD_RESTRICTION NT_STATUS(0xC0000000 | 0x006c) +#define NT_STATUS_LOGON_FAILURE NT_STATUS(0xC0000000 | 0x006d) +#define NT_STATUS_ACCOUNT_RESTRICTION NT_STATUS(0xC0000000 | 0x006e) +#define NT_STATUS_INVALID_LOGON_HOURS NT_STATUS(0xC0000000 | 0x006f) +#define NT_STATUS_INVALID_WORKSTATION NT_STATUS(0xC0000000 | 0x0070) +#define NT_STATUS_PASSWORD_EXPIRED NT_STATUS(0xC0000000 | 0x0071) +#define NT_STATUS_ACCOUNT_DISABLED NT_STATUS(0xC0000000 | 0x0072) +#define NT_STATUS_NONE_MAPPED NT_STATUS(0xC0000000 | 0x0073) +#define NT_STATUS_TOO_MANY_LUIDS_REQUESTED NT_STATUS(0xC0000000 | 0x0074) +#define NT_STATUS_LUIDS_EXHAUSTED NT_STATUS(0xC0000000 | 0x0075) +#define NT_STATUS_INVALID_SUB_AUTHORITY NT_STATUS(0xC0000000 | 0x0076) +#define NT_STATUS_INVALID_ACL NT_STATUS(0xC0000000 | 0x0077) +#define NT_STATUS_INVALID_SID NT_STATUS(0xC0000000 | 0x0078) +#define NT_STATUS_INVALID_SECURITY_DESCR NT_STATUS(0xC0000000 | 0x0079) +#define NT_STATUS_PROCEDURE_NOT_FOUND NT_STATUS(0xC0000000 | 0x007a) +#define NT_STATUS_INVALID_IMAGE_FORMAT NT_STATUS(0xC0000000 | 0x007b) +#define NT_STATUS_NO_TOKEN NT_STATUS(0xC0000000 | 0x007c) +#define NT_STATUS_BAD_INHERITANCE_ACL NT_STATUS(0xC0000000 | 0x007d) +#define NT_STATUS_RANGE_NOT_LOCKED NT_STATUS(0xC0000000 | 0x007e) +#define NT_STATUS_DISK_FULL NT_STATUS(0xC0000000 | 0x007f) +#define NT_STATUS_SERVER_DISABLED NT_STATUS(0xC0000000 | 0x0080) +#define NT_STATUS_SERVER_NOT_DISABLED NT_STATUS(0xC0000000 | 0x0081) +#define NT_STATUS_TOO_MANY_GUIDS_REQUESTED NT_STATUS(0xC0000000 | 0x0082) +#define NT_STATUS_GUIDS_EXHAUSTED NT_STATUS(0xC0000000 | 0x0083) +#define NT_STATUS_INVALID_ID_AUTHORITY NT_STATUS(0xC0000000 | 0x0084) +#define NT_STATUS_AGENTS_EXHAUSTED NT_STATUS(0xC0000000 | 0x0085) +#define NT_STATUS_INVALID_VOLUME_LABEL NT_STATUS(0xC0000000 | 0x0086) +#define NT_STATUS_SECTION_NOT_EXTENDED NT_STATUS(0xC0000000 | 0x0087) +#define NT_STATUS_NOT_MAPPED_DATA NT_STATUS(0xC0000000 | 0x0088) +#define NT_STATUS_RESOURCE_DATA_NOT_FOUND NT_STATUS(0xC0000000 | 0x0089) +#define NT_STATUS_RESOURCE_TYPE_NOT_FOUND NT_STATUS(0xC0000000 | 0x008a) +#define NT_STATUS_RESOURCE_NAME_NOT_FOUND NT_STATUS(0xC0000000 | 0x008b) +#define NT_STATUS_ARRAY_BOUNDS_EXCEEDED NT_STATUS(0xC0000000 | 0x008c) +#define NT_STATUS_FLOAT_DENORMAL_OPERAND NT_STATUS(0xC0000000 | 0x008d) +#define NT_STATUS_FLOAT_DIVIDE_BY_ZERO NT_STATUS(0xC0000000 | 0x008e) +#define NT_STATUS_FLOAT_INEXACT_RESULT NT_STATUS(0xC0000000 | 0x008f) +#define NT_STATUS_FLOAT_INVALID_OPERATION NT_STATUS(0xC0000000 | 0x0090) +#define NT_STATUS_FLOAT_OVERFLOW NT_STATUS(0xC0000000 | 0x0091) +#define NT_STATUS_FLOAT_STACK_CHECK NT_STATUS(0xC0000000 | 0x0092) +#define NT_STATUS_FLOAT_UNDERFLOW NT_STATUS(0xC0000000 | 0x0093) +#define NT_STATUS_INTEGER_DIVIDE_BY_ZERO NT_STATUS(0xC0000000 | 0x0094) +#define NT_STATUS_INTEGER_OVERFLOW NT_STATUS(0xC0000000 | 0x0095) +#define NT_STATUS_PRIVILEGED_INSTRUCTION NT_STATUS(0xC0000000 | 0x0096) +#define NT_STATUS_TOO_MANY_PAGING_FILES NT_STATUS(0xC0000000 | 0x0097) +#define NT_STATUS_FILE_INVALID NT_STATUS(0xC0000000 | 0x0098) +#define NT_STATUS_ALLOTTED_SPACE_EXCEEDED NT_STATUS(0xC0000000 | 0x0099) +#define NT_STATUS_INSUFFICIENT_RESOURCES NT_STATUS(0xC0000000 | 0x009a) +#define NT_STATUS_DFS_EXIT_PATH_FOUND NT_STATUS(0xC0000000 | 0x009b) +#define NT_STATUS_DEVICE_DATA_ERROR NT_STATUS(0xC0000000 | 0x009c) +#define NT_STATUS_DEVICE_NOT_CONNECTED NT_STATUS(0xC0000000 | 0x009d) +#define NT_STATUS_DEVICE_POWER_FAILURE NT_STATUS(0xC0000000 | 0x009e) +#define NT_STATUS_FREE_VM_NOT_AT_BASE NT_STATUS(0xC0000000 | 0x009f) +#define NT_STATUS_MEMORY_NOT_ALLOCATED NT_STATUS(0xC0000000 | 0x00a0) +#define NT_STATUS_WORKING_SET_QUOTA NT_STATUS(0xC0000000 | 0x00a1) +#define NT_STATUS_MEDIA_WRITE_PROTECTED NT_STATUS(0xC0000000 | 0x00a2) +#define NT_STATUS_DEVICE_NOT_READY NT_STATUS(0xC0000000 | 0x00a3) +#define NT_STATUS_INVALID_GROUP_ATTRIBUTES NT_STATUS(0xC0000000 | 0x00a4) +#define NT_STATUS_BAD_IMPERSONATION_LEVEL NT_STATUS(0xC0000000 | 0x00a5) +#define NT_STATUS_CANT_OPEN_ANONYMOUS NT_STATUS(0xC0000000 | 0x00a6) +#define NT_STATUS_BAD_VALIDATION_CLASS NT_STATUS(0xC0000000 | 0x00a7) +#define NT_STATUS_BAD_TOKEN_TYPE NT_STATUS(0xC0000000 | 0x00a8) +#define NT_STATUS_BAD_MASTER_BOOT_RECORD NT_STATUS(0xC0000000 | 0x00a9) +#define NT_STATUS_INSTRUCTION_MISALIGNMENT NT_STATUS(0xC0000000 | 0x00aa) +#define NT_STATUS_INSTANCE_NOT_AVAILABLE NT_STATUS(0xC0000000 | 0x00ab) +#define NT_STATUS_PIPE_NOT_AVAILABLE NT_STATUS(0xC0000000 | 0x00ac) +#define NT_STATUS_INVALID_PIPE_STATE NT_STATUS(0xC0000000 | 0x00ad) +#define NT_STATUS_PIPE_BUSY NT_STATUS(0xC0000000 | 0x00ae) +#define NT_STATUS_ILLEGAL_FUNCTION NT_STATUS(0xC0000000 | 0x00af) +#define NT_STATUS_PIPE_DISCONNECTED NT_STATUS(0xC0000000 | 0x00b0) +#define NT_STATUS_PIPE_CLOSING NT_STATUS(0xC0000000 | 0x00b1) +#define NT_STATUS_PIPE_CONNECTED NT_STATUS(0xC0000000 | 0x00b2) +#define NT_STATUS_PIPE_LISTENING NT_STATUS(0xC0000000 | 0x00b3) +#define NT_STATUS_INVALID_READ_MODE NT_STATUS(0xC0000000 | 0x00b4) +#define NT_STATUS_IO_TIMEOUT NT_STATUS(0xC0000000 | 0x00b5) +#define NT_STATUS_FILE_FORCED_CLOSED NT_STATUS(0xC0000000 | 0x00b6) +#define NT_STATUS_PROFILING_NOT_STARTED NT_STATUS(0xC0000000 | 0x00b7) +#define NT_STATUS_PROFILING_NOT_STOPPED NT_STATUS(0xC0000000 | 0x00b8) +#define NT_STATUS_COULD_NOT_INTERPRET NT_STATUS(0xC0000000 | 0x00b9) +#define NT_STATUS_FILE_IS_A_DIRECTORY NT_STATUS(0xC0000000 | 0x00ba) +#define NT_STATUS_NOT_SUPPORTED NT_STATUS(0xC0000000 | 0x00bb) +#define NT_STATUS_REMOTE_NOT_LISTENING NT_STATUS(0xC0000000 | 0x00bc) +#define NT_STATUS_DUPLICATE_NAME NT_STATUS(0xC0000000 | 0x00bd) +#define NT_STATUS_BAD_NETWORK_PATH NT_STATUS(0xC0000000 | 0x00be) +#define NT_STATUS_NETWORK_BUSY NT_STATUS(0xC0000000 | 0x00bf) +#define NT_STATUS_DEVICE_DOES_NOT_EXIST NT_STATUS(0xC0000000 | 0x00c0) +#define NT_STATUS_TOO_MANY_COMMANDS NT_STATUS(0xC0000000 | 0x00c1) +#define NT_STATUS_ADAPTER_HARDWARE_ERROR NT_STATUS(0xC0000000 | 0x00c2) +#define NT_STATUS_INVALID_NETWORK_RESPONSE NT_STATUS(0xC0000000 | 0x00c3) +#define NT_STATUS_UNEXPECTED_NETWORK_ERROR NT_STATUS(0xC0000000 | 0x00c4) +#define NT_STATUS_BAD_REMOTE_ADAPTER NT_STATUS(0xC0000000 | 0x00c5) +#define NT_STATUS_PRINT_QUEUE_FULL NT_STATUS(0xC0000000 | 0x00c6) +#define NT_STATUS_NO_SPOOL_SPACE NT_STATUS(0xC0000000 | 0x00c7) +#define NT_STATUS_PRINT_CANCELLED NT_STATUS(0xC0000000 | 0x00c8) +#define NT_STATUS_NETWORK_NAME_DELETED NT_STATUS(0xC0000000 | 0x00c9) +#define NT_STATUS_NETWORK_ACCESS_DENIED NT_STATUS(0xC0000000 | 0x00ca) +#define NT_STATUS_BAD_DEVICE_TYPE NT_STATUS(0xC0000000 | 0x00cb) +#define NT_STATUS_BAD_NETWORK_NAME NT_STATUS(0xC0000000 | 0x00cc) +#define NT_STATUS_TOO_MANY_NAMES NT_STATUS(0xC0000000 | 0x00cd) +#define NT_STATUS_TOO_MANY_SESSIONS NT_STATUS(0xC0000000 | 0x00ce) +#define NT_STATUS_SHARING_PAUSED NT_STATUS(0xC0000000 | 0x00cf) +#define NT_STATUS_REQUEST_NOT_ACCEPTED NT_STATUS(0xC0000000 | 0x00d0) +#define NT_STATUS_REDIRECTOR_PAUSED NT_STATUS(0xC0000000 | 0x00d1) +#define NT_STATUS_NET_WRITE_FAULT NT_STATUS(0xC0000000 | 0x00d2) +#define NT_STATUS_PROFILING_AT_LIMIT NT_STATUS(0xC0000000 | 0x00d3) +#define NT_STATUS_NOT_SAME_DEVICE NT_STATUS(0xC0000000 | 0x00d4) +#define NT_STATUS_FILE_RENAMED NT_STATUS(0xC0000000 | 0x00d5) +#define NT_STATUS_VIRTUAL_CIRCUIT_CLOSED NT_STATUS(0xC0000000 | 0x00d6) +#define NT_STATUS_NO_SECURITY_ON_OBJECT NT_STATUS(0xC0000000 | 0x00d7) +#define NT_STATUS_CANT_WAIT NT_STATUS(0xC0000000 | 0x00d8) +#define NT_STATUS_PIPE_EMPTY NT_STATUS(0xC0000000 | 0x00d9) +#define NT_STATUS_CANT_ACCESS_DOMAIN_INFO NT_STATUS(0xC0000000 | 0x00da) +#define NT_STATUS_CANT_TERMINATE_SELF NT_STATUS(0xC0000000 | 0x00db) +#define NT_STATUS_INVALID_SERVER_STATE NT_STATUS(0xC0000000 | 0x00dc) +#define NT_STATUS_INVALID_DOMAIN_STATE NT_STATUS(0xC0000000 | 0x00dd) +#define NT_STATUS_INVALID_DOMAIN_ROLE NT_STATUS(0xC0000000 | 0x00de) +#define NT_STATUS_NO_SUCH_DOMAIN NT_STATUS(0xC0000000 | 0x00df) +#define NT_STATUS_DOMAIN_EXISTS NT_STATUS(0xC0000000 | 0x00e0) +#define NT_STATUS_DOMAIN_LIMIT_EXCEEDED NT_STATUS(0xC0000000 | 0x00e1) +#define NT_STATUS_OPLOCK_NOT_GRANTED NT_STATUS(0xC0000000 | 0x00e2) +#define NT_STATUS_INVALID_OPLOCK_PROTOCOL NT_STATUS(0xC0000000 | 0x00e3) +#define NT_STATUS_INTERNAL_DB_CORRUPTION NT_STATUS(0xC0000000 | 0x00e4) +#define NT_STATUS_INTERNAL_ERROR NT_STATUS(0xC0000000 | 0x00e5) +#define NT_STATUS_GENERIC_NOT_MAPPED NT_STATUS(0xC0000000 | 0x00e6) +#define NT_STATUS_BAD_DESCRIPTOR_FORMAT NT_STATUS(0xC0000000 | 0x00e7) +#define NT_STATUS_INVALID_USER_BUFFER NT_STATUS(0xC0000000 | 0x00e8) +#define NT_STATUS_UNEXPECTED_IO_ERROR NT_STATUS(0xC0000000 | 0x00e9) +#define NT_STATUS_UNEXPECTED_MM_CREATE_ERR NT_STATUS(0xC0000000 | 0x00ea) +#define NT_STATUS_UNEXPECTED_MM_MAP_ERROR NT_STATUS(0xC0000000 | 0x00eb) +#define NT_STATUS_UNEXPECTED_MM_EXTEND_ERR NT_STATUS(0xC0000000 | 0x00ec) +#define NT_STATUS_NOT_LOGON_PROCESS NT_STATUS(0xC0000000 | 0x00ed) +#define NT_STATUS_LOGON_SESSION_EXISTS NT_STATUS(0xC0000000 | 0x00ee) +#define NT_STATUS_INVALID_PARAMETER_1 NT_STATUS(0xC0000000 | 0x00ef) +#define NT_STATUS_INVALID_PARAMETER_2 NT_STATUS(0xC0000000 | 0x00f0) +#define NT_STATUS_INVALID_PARAMETER_3 NT_STATUS(0xC0000000 | 0x00f1) +#define NT_STATUS_INVALID_PARAMETER_4 NT_STATUS(0xC0000000 | 0x00f2) +#define NT_STATUS_INVALID_PARAMETER_5 NT_STATUS(0xC0000000 | 0x00f3) +#define NT_STATUS_INVALID_PARAMETER_6 NT_STATUS(0xC0000000 | 0x00f4) +#define NT_STATUS_INVALID_PARAMETER_7 NT_STATUS(0xC0000000 | 0x00f5) +#define NT_STATUS_INVALID_PARAMETER_8 NT_STATUS(0xC0000000 | 0x00f6) +#define NT_STATUS_INVALID_PARAMETER_9 NT_STATUS(0xC0000000 | 0x00f7) +#define NT_STATUS_INVALID_PARAMETER_10 NT_STATUS(0xC0000000 | 0x00f8) +#define NT_STATUS_INVALID_PARAMETER_11 NT_STATUS(0xC0000000 | 0x00f9) +#define NT_STATUS_INVALID_PARAMETER_12 NT_STATUS(0xC0000000 | 0x00fa) +#define NT_STATUS_REDIRECTOR_NOT_STARTED NT_STATUS(0xC0000000 | 0x00fb) +#define NT_STATUS_REDIRECTOR_STARTED NT_STATUS(0xC0000000 | 0x00fc) +#define NT_STATUS_STACK_OVERFLOW NT_STATUS(0xC0000000 | 0x00fd) +#define NT_STATUS_NO_SUCH_PACKAGE NT_STATUS(0xC0000000 | 0x00fe) +#define NT_STATUS_BAD_FUNCTION_TABLE NT_STATUS(0xC0000000 | 0x00ff) +#define NT_STATUS_DIRECTORY_NOT_EMPTY NT_STATUS(0xC0000000 | 0x0101) +#define NT_STATUS_FILE_CORRUPT_ERROR NT_STATUS(0xC0000000 | 0x0102) +#define NT_STATUS_NOT_A_DIRECTORY NT_STATUS(0xC0000000 | 0x0103) +#define NT_STATUS_BAD_LOGON_SESSION_STATE NT_STATUS(0xC0000000 | 0x0104) +#define NT_STATUS_LOGON_SESSION_COLLISION NT_STATUS(0xC0000000 | 0x0105) +#define NT_STATUS_NAME_TOO_LONG NT_STATUS(0xC0000000 | 0x0106) +#define NT_STATUS_FILES_OPEN NT_STATUS(0xC0000000 | 0x0107) +#define NT_STATUS_CONNECTION_IN_USE NT_STATUS(0xC0000000 | 0x0108) +#define NT_STATUS_MESSAGE_NOT_FOUND NT_STATUS(0xC0000000 | 0x0109) +#define NT_STATUS_PROCESS_IS_TERMINATING NT_STATUS(0xC0000000 | 0x010a) +#define NT_STATUS_INVALID_LOGON_TYPE NT_STATUS(0xC0000000 | 0x010b) +#define NT_STATUS_NO_GUID_TRANSLATION NT_STATUS(0xC0000000 | 0x010c) +#define NT_STATUS_CANNOT_IMPERSONATE NT_STATUS(0xC0000000 | 0x010d) +#define NT_STATUS_IMAGE_ALREADY_LOADED NT_STATUS(0xC0000000 | 0x010e) +#define NT_STATUS_ABIOS_NOT_PRESENT NT_STATUS(0xC0000000 | 0x010f) +#define NT_STATUS_ABIOS_LID_NOT_EXIST NT_STATUS(0xC0000000 | 0x0110) +#define NT_STATUS_ABIOS_LID_ALREADY_OWNED NT_STATUS(0xC0000000 | 0x0111) +#define NT_STATUS_ABIOS_NOT_LID_OWNER NT_STATUS(0xC0000000 | 0x0112) +#define NT_STATUS_ABIOS_INVALID_COMMAND NT_STATUS(0xC0000000 | 0x0113) +#define NT_STATUS_ABIOS_INVALID_LID NT_STATUS(0xC0000000 | 0x0114) +#define NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE NT_STATUS(0xC0000000 | 0x0115) +#define NT_STATUS_ABIOS_INVALID_SELECTOR NT_STATUS(0xC0000000 | 0x0116) +#define NT_STATUS_NO_LDT NT_STATUS(0xC0000000 | 0x0117) +#define NT_STATUS_INVALID_LDT_SIZE NT_STATUS(0xC0000000 | 0x0118) +#define NT_STATUS_INVALID_LDT_OFFSET NT_STATUS(0xC0000000 | 0x0119) +#define NT_STATUS_INVALID_LDT_DESCRIPTOR NT_STATUS(0xC0000000 | 0x011a) +#define NT_STATUS_INVALID_IMAGE_NE_FORMAT NT_STATUS(0xC0000000 | 0x011b) +#define NT_STATUS_RXACT_INVALID_STATE NT_STATUS(0xC0000000 | 0x011c) +#define NT_STATUS_RXACT_COMMIT_FAILURE NT_STATUS(0xC0000000 | 0x011d) +#define NT_STATUS_MAPPED_FILE_SIZE_ZERO NT_STATUS(0xC0000000 | 0x011e) +#define NT_STATUS_TOO_MANY_OPENED_FILES NT_STATUS(0xC0000000 | 0x011f) +#define NT_STATUS_CANCELLED NT_STATUS(0xC0000000 | 0x0120) +#define NT_STATUS_CANNOT_DELETE NT_STATUS(0xC0000000 | 0x0121) +#define NT_STATUS_INVALID_COMPUTER_NAME NT_STATUS(0xC0000000 | 0x0122) +#define NT_STATUS_FILE_DELETED NT_STATUS(0xC0000000 | 0x0123) +#define NT_STATUS_SPECIAL_ACCOUNT NT_STATUS(0xC0000000 | 0x0124) +#define NT_STATUS_SPECIAL_GROUP NT_STATUS(0xC0000000 | 0x0125) +#define NT_STATUS_SPECIAL_USER NT_STATUS(0xC0000000 | 0x0126) +#define NT_STATUS_MEMBERS_PRIMARY_GROUP NT_STATUS(0xC0000000 | 0x0127) +#define NT_STATUS_FILE_CLOSED NT_STATUS(0xC0000000 | 0x0128) +#define NT_STATUS_TOO_MANY_THREADS NT_STATUS(0xC0000000 | 0x0129) +#define NT_STATUS_THREAD_NOT_IN_PROCESS NT_STATUS(0xC0000000 | 0x012a) +#define NT_STATUS_TOKEN_ALREADY_IN_USE NT_STATUS(0xC0000000 | 0x012b) +#define NT_STATUS_PAGEFILE_QUOTA_EXCEEDED NT_STATUS(0xC0000000 | 0x012c) +#define NT_STATUS_COMMITMENT_LIMIT NT_STATUS(0xC0000000 | 0x012d) +#define NT_STATUS_INVALID_IMAGE_LE_FORMAT NT_STATUS(0xC0000000 | 0x012e) +#define NT_STATUS_INVALID_IMAGE_NOT_MZ NT_STATUS(0xC0000000 | 0x012f) +#define NT_STATUS_INVALID_IMAGE_PROTECT NT_STATUS(0xC0000000 | 0x0130) +#define NT_STATUS_INVALID_IMAGE_WIN_16 NT_STATUS(0xC0000000 | 0x0131) +#define NT_STATUS_LOGON_SERVER_CONFLICT NT_STATUS(0xC0000000 | 0x0132) +#define NT_STATUS_TIME_DIFFERENCE_AT_DC NT_STATUS(0xC0000000 | 0x0133) +#define NT_STATUS_SYNCHRONIZATION_REQUIRED NT_STATUS(0xC0000000 | 0x0134) +#define NT_STATUS_DLL_NOT_FOUND NT_STATUS(0xC0000000 | 0x0135) +#define NT_STATUS_OPEN_FAILED NT_STATUS(0xC0000000 | 0x0136) +#define NT_STATUS_IO_PRIVILEGE_FAILED NT_STATUS(0xC0000000 | 0x0137) +#define NT_STATUS_ORDINAL_NOT_FOUND NT_STATUS(0xC0000000 | 0x0138) +#define NT_STATUS_ENTRYPOINT_NOT_FOUND NT_STATUS(0xC0000000 | 0x0139) +#define NT_STATUS_CONTROL_C_EXIT NT_STATUS(0xC0000000 | 0x013a) +#define NT_STATUS_LOCAL_DISCONNECT NT_STATUS(0xC0000000 | 0x013b) +#define NT_STATUS_REMOTE_DISCONNECT NT_STATUS(0xC0000000 | 0x013c) +#define NT_STATUS_REMOTE_RESOURCES NT_STATUS(0xC0000000 | 0x013d) +#define NT_STATUS_LINK_FAILED NT_STATUS(0xC0000000 | 0x013e) +#define NT_STATUS_LINK_TIMEOUT NT_STATUS(0xC0000000 | 0x013f) +#define NT_STATUS_INVALID_CONNECTION NT_STATUS(0xC0000000 | 0x0140) +#define NT_STATUS_INVALID_ADDRESS NT_STATUS(0xC0000000 | 0x0141) +#define NT_STATUS_DLL_INIT_FAILED NT_STATUS(0xC0000000 | 0x0142) +#define NT_STATUS_MISSING_SYSTEMFILE NT_STATUS(0xC0000000 | 0x0143) +#define NT_STATUS_UNHANDLED_EXCEPTION NT_STATUS(0xC0000000 | 0x0144) +#define NT_STATUS_APP_INIT_FAILURE NT_STATUS(0xC0000000 | 0x0145) +#define NT_STATUS_PAGEFILE_CREATE_FAILED NT_STATUS(0xC0000000 | 0x0146) +#define NT_STATUS_NO_PAGEFILE NT_STATUS(0xC0000000 | 0x0147) +#define NT_STATUS_INVALID_LEVEL NT_STATUS(0xC0000000 | 0x0148) +#define NT_STATUS_WRONG_PASSWORD_CORE NT_STATUS(0xC0000000 | 0x0149) +#define NT_STATUS_ILLEGAL_FLOAT_CONTEXT NT_STATUS(0xC0000000 | 0x014a) +#define NT_STATUS_PIPE_BROKEN NT_STATUS(0xC0000000 | 0x014b) +#define NT_STATUS_REGISTRY_CORRUPT NT_STATUS(0xC0000000 | 0x014c) +#define NT_STATUS_REGISTRY_IO_FAILED NT_STATUS(0xC0000000 | 0x014d) +#define NT_STATUS_NO_EVENT_PAIR NT_STATUS(0xC0000000 | 0x014e) +#define NT_STATUS_UNRECOGNIZED_VOLUME NT_STATUS(0xC0000000 | 0x014f) +#define NT_STATUS_SERIAL_NO_DEVICE_INITED NT_STATUS(0xC0000000 | 0x0150) +#define NT_STATUS_NO_SUCH_ALIAS NT_STATUS(0xC0000000 | 0x0151) +#define NT_STATUS_MEMBER_NOT_IN_ALIAS NT_STATUS(0xC0000000 | 0x0152) +#define NT_STATUS_MEMBER_IN_ALIAS NT_STATUS(0xC0000000 | 0x0153) +#define NT_STATUS_ALIAS_EXISTS NT_STATUS(0xC0000000 | 0x0154) +#define NT_STATUS_LOGON_NOT_GRANTED NT_STATUS(0xC0000000 | 0x0155) +#define NT_STATUS_TOO_MANY_SECRETS NT_STATUS(0xC0000000 | 0x0156) +#define NT_STATUS_SECRET_TOO_LONG NT_STATUS(0xC0000000 | 0x0157) +#define NT_STATUS_INTERNAL_DB_ERROR NT_STATUS(0xC0000000 | 0x0158) +#define NT_STATUS_FULLSCREEN_MODE NT_STATUS(0xC0000000 | 0x0159) +#define NT_STATUS_TOO_MANY_CONTEXT_IDS NT_STATUS(0xC0000000 | 0x015a) +#define NT_STATUS_LOGON_TYPE_NOT_GRANTED NT_STATUS(0xC0000000 | 0x015b) +#define NT_STATUS_NOT_REGISTRY_FILE NT_STATUS(0xC0000000 | 0x015c) +#define NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED NT_STATUS(0xC0000000 | 0x015d) +#define NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR NT_STATUS(0xC0000000 | 0x015e) +#define NT_STATUS_FT_MISSING_MEMBER NT_STATUS(0xC0000000 | 0x015f) +#define NT_STATUS_ILL_FORMED_SERVICE_ENTRY NT_STATUS(0xC0000000 | 0x0160) +#define NT_STATUS_ILLEGAL_CHARACTER NT_STATUS(0xC0000000 | 0x0161) +#define NT_STATUS_UNMAPPABLE_CHARACTER NT_STATUS(0xC0000000 | 0x0162) +#define NT_STATUS_UNDEFINED_CHARACTER NT_STATUS(0xC0000000 | 0x0163) +#define NT_STATUS_FLOPPY_VOLUME NT_STATUS(0xC0000000 | 0x0164) +#define NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND NT_STATUS(0xC0000000 | 0x0165) +#define NT_STATUS_FLOPPY_WRONG_CYLINDER NT_STATUS(0xC0000000 | 0x0166) +#define NT_STATUS_FLOPPY_UNKNOWN_ERROR NT_STATUS(0xC0000000 | 0x0167) +#define NT_STATUS_FLOPPY_BAD_REGISTERS NT_STATUS(0xC0000000 | 0x0168) +#define NT_STATUS_DISK_RECALIBRATE_FAILED NT_STATUS(0xC0000000 | 0x0169) +#define NT_STATUS_DISK_OPERATION_FAILED NT_STATUS(0xC0000000 | 0x016a) +#define NT_STATUS_DISK_RESET_FAILED NT_STATUS(0xC0000000 | 0x016b) +#define NT_STATUS_SHARED_IRQ_BUSY NT_STATUS(0xC0000000 | 0x016c) +#define NT_STATUS_FT_ORPHANING NT_STATUS(0xC0000000 | 0x016d) +#define NT_STATUS_PARTITION_FAILURE NT_STATUS(0xC0000000 | 0x0172) +#define NT_STATUS_INVALID_BLOCK_LENGTH NT_STATUS(0xC0000000 | 0x0173) +#define NT_STATUS_DEVICE_NOT_PARTITIONED NT_STATUS(0xC0000000 | 0x0174) +#define NT_STATUS_UNABLE_TO_LOCK_MEDIA NT_STATUS(0xC0000000 | 0x0175) +#define NT_STATUS_UNABLE_TO_UNLOAD_MEDIA NT_STATUS(0xC0000000 | 0x0176) +#define NT_STATUS_EOM_OVERFLOW NT_STATUS(0xC0000000 | 0x0177) +#define NT_STATUS_NO_MEDIA NT_STATUS(0xC0000000 | 0x0178) +#define NT_STATUS_NO_SUCH_MEMBER NT_STATUS(0xC0000000 | 0x017a) +#define NT_STATUS_INVALID_MEMBER NT_STATUS(0xC0000000 | 0x017b) +#define NT_STATUS_KEY_DELETED NT_STATUS(0xC0000000 | 0x017c) +#define NT_STATUS_NO_LOG_SPACE NT_STATUS(0xC0000000 | 0x017d) +#define NT_STATUS_TOO_MANY_SIDS NT_STATUS(0xC0000000 | 0x017e) +#define NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED NT_STATUS(0xC0000000 | 0x017f) +#define NT_STATUS_KEY_HAS_CHILDREN NT_STATUS(0xC0000000 | 0x0180) +#define NT_STATUS_CHILD_MUST_BE_VOLATILE NT_STATUS(0xC0000000 | 0x0181) +#define NT_STATUS_DEVICE_CONFIGURATION_ERROR NT_STATUS(0xC0000000 | 0x0182) +#define NT_STATUS_DRIVER_INTERNAL_ERROR NT_STATUS(0xC0000000 | 0x0183) +#define NT_STATUS_INVALID_DEVICE_STATE NT_STATUS(0xC0000000 | 0x0184) +#define NT_STATUS_IO_DEVICE_ERROR NT_STATUS(0xC0000000 | 0x0185) +#define NT_STATUS_DEVICE_PROTOCOL_ERROR NT_STATUS(0xC0000000 | 0x0186) +#define NT_STATUS_BACKUP_CONTROLLER NT_STATUS(0xC0000000 | 0x0187) +#define NT_STATUS_LOG_FILE_FULL NT_STATUS(0xC0000000 | 0x0188) +#define NT_STATUS_TOO_LATE NT_STATUS(0xC0000000 | 0x0189) +#define NT_STATUS_NO_TRUST_LSA_SECRET NT_STATUS(0xC0000000 | 0x018a) +#define NT_STATUS_NO_TRUST_SAM_ACCOUNT NT_STATUS(0xC0000000 | 0x018b) +#define NT_STATUS_TRUSTED_DOMAIN_FAILURE NT_STATUS(0xC0000000 | 0x018c) +#define NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE NT_STATUS(0xC0000000 | 0x018d) +#define NT_STATUS_EVENTLOG_FILE_CORRUPT NT_STATUS(0xC0000000 | 0x018e) +#define NT_STATUS_EVENTLOG_CANT_START NT_STATUS(0xC0000000 | 0x018f) +#define NT_STATUS_TRUST_FAILURE NT_STATUS(0xC0000000 | 0x0190) +#define NT_STATUS_MUTANT_LIMIT_EXCEEDED NT_STATUS(0xC0000000 | 0x0191) +#define NT_STATUS_NETLOGON_NOT_STARTED NT_STATUS(0xC0000000 | 0x0192) +#define NT_STATUS_ACCOUNT_EXPIRED NT_STATUS(0xC0000000 | 0x0193) +#define NT_STATUS_POSSIBLE_DEADLOCK NT_STATUS(0xC0000000 | 0x0194) +#define NT_STATUS_NETWORK_CREDENTIAL_CONFLICT NT_STATUS(0xC0000000 | 0x0195) +#define NT_STATUS_REMOTE_SESSION_LIMIT NT_STATUS(0xC0000000 | 0x0196) +#define NT_STATUS_EVENTLOG_FILE_CHANGED NT_STATUS(0xC0000000 | 0x0197) +#define NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT NT_STATUS(0xC0000000 | 0x0198) +#define NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT NT_STATUS(0xC0000000 | 0x0199) +#define NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT NT_STATUS(0xC0000000 | 0x019a) +#define NT_STATUS_DOMAIN_TRUST_INCONSISTENT NT_STATUS(0xC0000000 | 0x019b) +#define NT_STATUS_FS_DRIVER_REQUIRED NT_STATUS(0xC0000000 | 0x019c) +#define NT_STATUS_NO_USER_SESSION_KEY NT_STATUS(0xC0000000 | 0x0202) +#define NT_STATUS_USER_SESSION_DELETED NT_STATUS(0xC0000000 | 0x0203) +#define NT_STATUS_RESOURCE_LANG_NOT_FOUND NT_STATUS(0xC0000000 | 0x0204) +#define NT_STATUS_INSUFF_SERVER_RESOURCES NT_STATUS(0xC0000000 | 0x0205) +#define NT_STATUS_INVALID_BUFFER_SIZE NT_STATUS(0xC0000000 | 0x0206) +#define NT_STATUS_INVALID_ADDRESS_COMPONENT NT_STATUS(0xC0000000 | 0x0207) +#define NT_STATUS_INVALID_ADDRESS_WILDCARD NT_STATUS(0xC0000000 | 0x0208) +#define NT_STATUS_TOO_MANY_ADDRESSES NT_STATUS(0xC0000000 | 0x0209) +#define NT_STATUS_ADDRESS_ALREADY_EXISTS NT_STATUS(0xC0000000 | 0x020a) +#define NT_STATUS_ADDRESS_CLOSED NT_STATUS(0xC0000000 | 0x020b) +#define NT_STATUS_CONNECTION_DISCONNECTED NT_STATUS(0xC0000000 | 0x020c) +#define NT_STATUS_CONNECTION_RESET NT_STATUS(0xC0000000 | 0x020d) +#define NT_STATUS_TOO_MANY_NODES NT_STATUS(0xC0000000 | 0x020e) +#define NT_STATUS_TRANSACTION_ABORTED NT_STATUS(0xC0000000 | 0x020f) +#define NT_STATUS_TRANSACTION_TIMED_OUT NT_STATUS(0xC0000000 | 0x0210) +#define NT_STATUS_TRANSACTION_NO_RELEASE NT_STATUS(0xC0000000 | 0x0211) +#define NT_STATUS_TRANSACTION_NO_MATCH NT_STATUS(0xC0000000 | 0x0212) +#define NT_STATUS_TRANSACTION_RESPONDED NT_STATUS(0xC0000000 | 0x0213) +#define NT_STATUS_TRANSACTION_INVALID_ID NT_STATUS(0xC0000000 | 0x0214) +#define NT_STATUS_TRANSACTION_INVALID_TYPE NT_STATUS(0xC0000000 | 0x0215) +#define NT_STATUS_NOT_SERVER_SESSION NT_STATUS(0xC0000000 | 0x0216) +#define NT_STATUS_NOT_CLIENT_SESSION NT_STATUS(0xC0000000 | 0x0217) +#define NT_STATUS_CANNOT_LOAD_REGISTRY_FILE NT_STATUS(0xC0000000 | 0x0218) +#define NT_STATUS_DEBUG_ATTACH_FAILED NT_STATUS(0xC0000000 | 0x0219) +#define NT_STATUS_SYSTEM_PROCESS_TERMINATED NT_STATUS(0xC0000000 | 0x021a) +#define NT_STATUS_DATA_NOT_ACCEPTED NT_STATUS(0xC0000000 | 0x021b) +#define NT_STATUS_NO_BROWSER_SERVERS_FOUND NT_STATUS(0xC0000000 | 0x021c) +#define NT_STATUS_VDM_HARD_ERROR NT_STATUS(0xC0000000 | 0x021d) +#define NT_STATUS_DRIVER_CANCEL_TIMEOUT NT_STATUS(0xC0000000 | 0x021e) +#define NT_STATUS_REPLY_MESSAGE_MISMATCH NT_STATUS(0xC0000000 | 0x021f) +#define NT_STATUS_MAPPED_ALIGNMENT NT_STATUS(0xC0000000 | 0x0220) +#define NT_STATUS_IMAGE_CHECKSUM_MISMATCH NT_STATUS(0xC0000000 | 0x0221) +#define NT_STATUS_LOST_WRITEBEHIND_DATA NT_STATUS(0xC0000000 | 0x0222) +#define NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID NT_STATUS(0xC0000000 | 0x0223) +#define NT_STATUS_PASSWORD_MUST_CHANGE NT_STATUS(0xC0000000 | 0x0224) +#define NT_STATUS_NOT_FOUND NT_STATUS(0xC0000000 | 0x0225) +#define NT_STATUS_NOT_TINY_STREAM NT_STATUS(0xC0000000 | 0x0226) +#define NT_STATUS_RECOVERY_FAILURE NT_STATUS(0xC0000000 | 0x0227) +#define NT_STATUS_STACK_OVERFLOW_READ NT_STATUS(0xC0000000 | 0x0228) +#define NT_STATUS_FAIL_CHECK NT_STATUS(0xC0000000 | 0x0229) +#define NT_STATUS_DUPLICATE_OBJECTID NT_STATUS(0xC0000000 | 0x022a) +#define NT_STATUS_OBJECTID_EXISTS NT_STATUS(0xC0000000 | 0x022b) +#define NT_STATUS_CONVERT_TO_LARGE NT_STATUS(0xC0000000 | 0x022c) +#define NT_STATUS_RETRY NT_STATUS(0xC0000000 | 0x022d) +#define NT_STATUS_FOUND_OUT_OF_SCOPE NT_STATUS(0xC0000000 | 0x022e) +#define NT_STATUS_ALLOCATE_BUCKET NT_STATUS(0xC0000000 | 0x022f) +#define NT_STATUS_PROPSET_NOT_FOUND NT_STATUS(0xC0000000 | 0x0230) +#define NT_STATUS_MARSHALL_OVERFLOW NT_STATUS(0xC0000000 | 0x0231) +#define NT_STATUS_INVALID_VARIANT NT_STATUS(0xC0000000 | 0x0232) +#define NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND NT_STATUS(0xC0000000 | 0x0233) +#define NT_STATUS_ACCOUNT_LOCKED_OUT NT_STATUS(0xC0000000 | 0x0234) +#define NT_STATUS_HANDLE_NOT_CLOSABLE NT_STATUS(0xC0000000 | 0x0235) +#define NT_STATUS_CONNECTION_REFUSED NT_STATUS(0xC0000000 | 0x0236) +#define NT_STATUS_GRACEFUL_DISCONNECT NT_STATUS(0xC0000000 | 0x0237) +#define NT_STATUS_ADDRESS_ALREADY_ASSOCIATED NT_STATUS(0xC0000000 | 0x0238) +#define NT_STATUS_ADDRESS_NOT_ASSOCIATED NT_STATUS(0xC0000000 | 0x0239) +#define NT_STATUS_CONNECTION_INVALID NT_STATUS(0xC0000000 | 0x023a) +#define NT_STATUS_CONNECTION_ACTIVE NT_STATUS(0xC0000000 | 0x023b) +#define NT_STATUS_NETWORK_UNREACHABLE NT_STATUS(0xC0000000 | 0x023c) +#define NT_STATUS_HOST_UNREACHABLE NT_STATUS(0xC0000000 | 0x023d) +#define NT_STATUS_PROTOCOL_UNREACHABLE NT_STATUS(0xC0000000 | 0x023e) +#define NT_STATUS_PORT_UNREACHABLE NT_STATUS(0xC0000000 | 0x023f) +#define NT_STATUS_REQUEST_ABORTED NT_STATUS(0xC0000000 | 0x0240) +#define NT_STATUS_CONNECTION_ABORTED NT_STATUS(0xC0000000 | 0x0241) +#define NT_STATUS_BAD_COMPRESSION_BUFFER NT_STATUS(0xC0000000 | 0x0242) +#define NT_STATUS_USER_MAPPED_FILE NT_STATUS(0xC0000000 | 0x0243) +#define NT_STATUS_AUDIT_FAILED NT_STATUS(0xC0000000 | 0x0244) +#define NT_STATUS_TIMER_RESOLUTION_NOT_SET NT_STATUS(0xC0000000 | 0x0245) +#define NT_STATUS_CONNECTION_COUNT_LIMIT NT_STATUS(0xC0000000 | 0x0246) +#define NT_STATUS_LOGIN_TIME_RESTRICTION NT_STATUS(0xC0000000 | 0x0247) +#define NT_STATUS_LOGIN_WKSTA_RESTRICTION NT_STATUS(0xC0000000 | 0x0248) +#define NT_STATUS_IMAGE_MP_UP_MISMATCH NT_STATUS(0xC0000000 | 0x0249) +#define NT_STATUS_INSUFFICIENT_LOGON_INFO NT_STATUS(0xC0000000 | 0x0250) +#define NT_STATUS_BAD_DLL_ENTRYPOINT NT_STATUS(0xC0000000 | 0x0251) +#define NT_STATUS_BAD_SERVICE_ENTRYPOINT NT_STATUS(0xC0000000 | 0x0252) +#define NT_STATUS_LPC_REPLY_LOST NT_STATUS(0xC0000000 | 0x0253) +#define NT_STATUS_IP_ADDRESS_CONFLICT1 NT_STATUS(0xC0000000 | 0x0254) +#define NT_STATUS_IP_ADDRESS_CONFLICT2 NT_STATUS(0xC0000000 | 0x0255) +#define NT_STATUS_REGISTRY_QUOTA_LIMIT NT_STATUS(0xC0000000 | 0x0256) +#define NT_STATUS_PATH_NOT_COVERED NT_STATUS(0xC0000000 | 0x0257) +#define NT_STATUS_NO_CALLBACK_ACTIVE NT_STATUS(0xC0000000 | 0x0258) +#define NT_STATUS_LICENSE_QUOTA_EXCEEDED NT_STATUS(0xC0000000 | 0x0259) +#define NT_STATUS_PWD_TOO_SHORT NT_STATUS(0xC0000000 | 0x025a) +#define NT_STATUS_PWD_TOO_RECENT NT_STATUS(0xC0000000 | 0x025b) +#define NT_STATUS_PWD_HISTORY_CONFLICT NT_STATUS(0xC0000000 | 0x025c) +#define NT_STATUS_PLUGPLAY_NO_DEVICE NT_STATUS(0xC0000000 | 0x025e) +#define NT_STATUS_UNSUPPORTED_COMPRESSION NT_STATUS(0xC0000000 | 0x025f) +#define NT_STATUS_INVALID_HW_PROFILE NT_STATUS(0xC0000000 | 0x0260) +#define NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH NT_STATUS(0xC0000000 | 0x0261) +#define NT_STATUS_DRIVER_ORDINAL_NOT_FOUND NT_STATUS(0xC0000000 | 0x0262) +#define NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND NT_STATUS(0xC0000000 | 0x0263) +#define NT_STATUS_RESOURCE_NOT_OWNED NT_STATUS(0xC0000000 | 0x0264) +#define NT_STATUS_TOO_MANY_LINKS NT_STATUS(0xC0000000 | 0x0265) +#define NT_STATUS_QUOTA_LIST_INCONSISTENT NT_STATUS(0xC0000000 | 0x0266) +#define NT_STATUS_FILE_IS_OFFLINE NT_STATUS(0xC0000000 | 0x0267) +#define NT_STATUS_DS_NO_MORE_RIDS NT_STATUS(0xC0000000 | 0x02a8) +#define NT_STATUS_NOT_A_REPARSE_POINT NT_STATUS(0xC0000000 | 0x0275) +#define NT_STATUS_DOWNGRADE_DETECTED NT_STATUS(0xC0000000 | 0x0388) +#define NT_STATUS_NO_SUCH_JOB NT_STATUS(0xC0000000 | 0xEDE) /* scheduler */ +#define NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED NT_STATUS(0xC0000000 | 0x20004) +#define NT_STATUS_RPC_CANNOT_SUPPORT NT_STATUS(0xC0000000 | 0x20041) + +#endif /* _NTERR_H */ diff --git a/source3/include/ntioctl.h b/source3/include/ntioctl.h new file mode 100644 index 0000000000..c565b8f9a4 --- /dev/null +++ b/source3/include/ntioctl.h @@ -0,0 +1,88 @@ +/* + Unix SMB/CIFS implementation. + NT ioctl code constants + Copyright (C) Andrew Tridgell 2002 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* + I'm guessing we will need to support a bunch of these eventually. For now + we only need the sparse flag +*/ + +#ifndef _NTIOCTL_H +#define _NTIOCTL_H + +/* IOCTL information */ +/* List of ioctl function codes that look to be of interest to remote clients like this. */ +/* Need to do some experimentation to make sure they all work remotely. */ +/* Some of the following such as the encryption/compression ones would be */ +/* invoked from tools via a specialized hook into the VFS rather than via the */ +/* standard vfs entry points */ +#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 +#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 +#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 +#define FSCTL_LOCK_VOLUME 0x00090018 +#define FSCTL_UNLOCK_VOLUME 0x0009001C +#define FSCTL_GET_COMPRESSION 0x0009003C +#define FSCTL_SET_COMPRESSION 0x0009C040 +#define FSCTL_REQUEST_FILTER_OPLOCK 0x0009008C +#define FSCTL_FIND_FILES_BY_SID 0x0009008F +#define FSCTL_FILESYS_GET_STATISTICS 0x00090090 +#define FSCTL_SET_OBJECT_ID 0x00090098 +#define FSCTL_GET_OBJECT_ID 0x0009009C +#define FSCTL_SET_REPARSE_POINT 0x000900A4 +#define FSCTL_GET_REPARSE_POINT 0x000900A8 +#define FSCTL_DELETE_REPARSE_POINT 0x000900AC +#define FSCTL_CREATE_OR_GET_OBJECT_ID 0x000900C0 +#define FSCTL_SET_SPARSE 0x000900C4 +#define FSCTL_SET_ZERO_DATA 0x000900C8 +#define FSCTL_SET_ENCRYPTION 0x000900D7 +#define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB +#define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF +#define FSCTL_READ_RAW_ENCRYPTED 0x000900E3 +#define FSCTL_SIS_COPYFILE 0x00090100 +#define FSCTL_QUERY_ALLOCATED_RANGES 0x000940CF +#define FSCTL_SIS_LINK_FILES 0x0009C104 + +#define FSCTL_GET_SHADOW_COPY_DATA 0x00144064 /* KJC -- Shadow Copy information */ + +#if 0 +#define FSCTL_SECURITY_ID_CHECK +#define FSCTL_DISMOUNT_VOLUME +#define FSCTL_GET_NTFS_FILE_RECORD +#define FSCTL_ALLOW_EXTENDED_DASD_IO +#define FSCTL_RECALL_FILE + +#endif + +#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 +#define IO_REPARSE_TAG_HSM 0xC0000004 +#define IO_REPARSE_TAG_SIS 0x80000007 + + +/* For FSCTL_GET_SHADOW_COPY_DATA ...*/ +typedef char SHADOW_COPY_LABEL[25]; + +typedef struct shadow_copy_data { + TALLOC_CTX *mem_ctx; + /* Total number of shadow volumes currently mounted */ + uint32 num_volumes; + /* Concatenated list of labels */ + SHADOW_COPY_LABEL *labels; +} SHADOW_COPY_DATA; + + +#endif /* _NTIOCTL_H */ diff --git a/source3/include/ntlmssp.h b/source3/include/ntlmssp.h new file mode 100644 index 0000000000..3fb41c5613 --- /dev/null +++ b/source3/include/ntlmssp.h @@ -0,0 +1,175 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* NTLMSSP mode */ +enum NTLMSSP_ROLE +{ + NTLMSSP_SERVER, + NTLMSSP_CLIENT +}; + +/* NTLMSSP message types */ +enum NTLM_MESSAGE_TYPE +{ + NTLMSSP_INITIAL = 0 /* samba internal state */, + NTLMSSP_NEGOTIATE = 1, + NTLMSSP_CHALLENGE = 2, + NTLMSSP_AUTH = 3, + NTLMSSP_UNKNOWN = 4, + NTLMSSP_DONE = 5 /* samba final state */ +}; + +/* NTLMSSP negotiation flags */ +#define NTLMSSP_NEGOTIATE_UNICODE 0x00000001 +#define NTLMSSP_NEGOTIATE_OEM 0x00000002 +#define NTLMSSP_REQUEST_TARGET 0x00000004 +#define NTLMSSP_NEGOTIATE_SIGN 0x00000010 /* Message integrity */ +#define NTLMSSP_NEGOTIATE_SEAL 0x00000020 /* Message confidentiality */ +#define NTLMSSP_NEGOTIATE_DATAGRAM_STYLE 0x00000040 +#define NTLMSSP_NEGOTIATE_LM_KEY 0x00000080 +#define NTLMSSP_NEGOTIATE_NETWARE 0x00000100 +#define NTLMSSP_NEGOTIATE_NTLM 0x00000200 +#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x00001000 +#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x00002000 +#define NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL 0x00004000 +#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x00008000 +#define NTLMSSP_TARGET_TYPE_DOMAIN 0x10000 +#define NTLMSSP_TARGET_TYPE_SERVER 0x20000 +#define NTLMSSP_CHAL_INIT_RESPONSE 0x00010000 + +#define NTLMSSP_CHAL_ACCEPT_RESPONSE 0x00020000 +#define NTLMSSP_CHAL_NON_NT_SESSION_KEY 0x00040000 +#define NTLMSSP_NEGOTIATE_NTLM2 0x00080000 +#define NTLMSSP_CHAL_TARGET_INFO 0x00800000 +#define NTLMSSP_NEGOTIATE_VERSION 0x02000000 +#define NTLMSSP_NEGOTIATE_128 0x20000000 /* 128-bit encryption */ +#define NTLMSSP_NEGOTIATE_KEY_EXCH 0x40000000 +#define NTLMSSP_NEGOTIATE_56 0x80000000 + +#define NTLMSSP_FEATURE_SESSION_KEY 0x00000001 +#define NTLMSSP_FEATURE_SIGN 0x00000002 +#define NTLMSSP_FEATURE_SEAL 0x00000004 + +#define NTLMSSP_NAME_TYPE_SERVER 0x01 +#define NTLMSSP_NAME_TYPE_DOMAIN 0x02 +#define NTLMSSP_NAME_TYPE_SERVER_DNS 0x03 +#define NTLMSSP_NAME_TYPE_DOMAIN_DNS 0x04 + +#define NTLMSSP_SIG_SIZE 16 + +typedef struct ntlmssp_state +{ + TALLOC_CTX *mem_ctx; + unsigned int ref_count; + enum NTLMSSP_ROLE role; + enum server_types server_role; + uint32 expected_state; + + bool unicode; + bool use_ntlmv2; + char *user; + char *domain; + char *workstation; + unsigned char *nt_hash; + unsigned char *lm_hash; + char *server_domain; + + DATA_BLOB internal_chal; /* Random challenge as supplied to the client for NTLM authentication */ + + DATA_BLOB chal; /* Random challenge as input into the actual NTLM (or NTLM2) authentication */ + DATA_BLOB lm_resp; + DATA_BLOB nt_resp; + DATA_BLOB session_key; + + uint32 neg_flags; /* the current state of negotiation with the NTLMSSP partner */ + + void *auth_context; + + /** + * Callback to get the 'challenge' used for NTLM authentication. + * + * @param ntlmssp_state This structure + * @return 8 bytes of challnege data, determined by the server to be the challenge for NTLM authentication + * + */ + const uint8 *(*get_challenge)(const struct ntlmssp_state *ntlmssp_state); + + /** + * Callback to find if the challenge used by NTLM authentication may be modified + * + * The NTLM2 authentication scheme modifies the effective challenge, but this is not compatiable with the + * current 'security=server' implementation.. + * + * @param ntlmssp_state This structure + * @return Can the challenge be set to arbitary values? + * + */ + bool (*may_set_challenge)(const struct ntlmssp_state *ntlmssp_state); + + /** + * Callback to set the 'challenge' used for NTLM authentication. + * + * The callback may use the void *auth_context to store state information, but the same value is always available + * from the DATA_BLOB chal on this structure. + * + * @param ntlmssp_state This structure + * @param challenge 8 bytes of data, agreed by the client and server to be the effective challenge for NTLM2 authentication + * + */ + NTSTATUS (*set_challenge)(struct ntlmssp_state *ntlmssp_state, DATA_BLOB *challenge); + + /** + * Callback to check the user's password. + * + * The callback must reads the feilds of this structure for the information it needs on the user + * @param ntlmssp_state This structure + * @param nt_session_key If an NT session key is returned by the authentication process, return it here + * @param lm_session_key If an LM session key is returned by the authentication process, return it here + * + */ + NTSTATUS (*check_password)(struct ntlmssp_state *ntlmssp_state, DATA_BLOB *nt_session_key, DATA_BLOB *lm_session_key); + + const char *(*get_global_myname)(void); + const char *(*get_domain)(void); + + /* ntlmv2 */ + + unsigned char send_sign_key[16]; + unsigned char send_seal_key[16]; + unsigned char recv_sign_key[16]; + unsigned char recv_seal_key[16]; + + unsigned char send_seal_arc4_state[258]; + unsigned char recv_seal_arc4_state[258]; + + uint32 ntlm2_send_seq_num; + uint32 ntlm2_recv_seq_num; + + /* ntlmv1 */ + unsigned char ntlmv1_arc4_state[258]; + uint32 ntlmv1_seq_num; + + /* it turns out that we don't always get the + response in at the time we want to process it. + Store it here, until we need it */ + DATA_BLOB stored_response; + +} NTLMSSP_STATE; diff --git a/source3/include/ntquotas.h b/source3/include/ntquotas.h new file mode 100644 index 0000000000..ed503b3854 --- /dev/null +++ b/source3/include/ntquotas.h @@ -0,0 +1,91 @@ +/* + Unix SMB/CIFS implementation. + NT QUOTA code constants + Copyright (C) Stefan (metze) Metzmacher 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _NTQUOTAS_H +#define _NTQUOTAS_H + +/* + * details for Quota Flags: + * + * 0x20 Log Limit: log if the user exceeds his Hard Quota + * 0x10 Log Warn: log if the user exceeds his Soft Quota + * 0x02 Deny Disk: deny disk access when the user exceeds his Hard Quota + * 0x01 Enable Quotas: enable quota for this fs + * + */ + +#define QUOTAS_ENABLED 0x0001 +#define QUOTAS_DENY_DISK 0x0002 +#define QUOTAS_LOG_VIOLATIONS 0x0004 +#define CONTENT_INDEX_DISABLED 0x0008 +#define QUOTAS_LOG_THRESHOLD 0x0010 +#define QUOTAS_LOG_LIMIT 0x0020 +#define LOG_VOLUME_THRESHOLD 0x0040 +#define LOG_VOLUME_LIMIT 0x0080 +#define QUOTAS_INCOMPLETE 0x0100 +#define QUOTAS_REBUILDING 0x0200 +#define QUOTAS_0400 0x0400 +#define QUOTAS_0800 0x0800 +#define QUOTAS_1000 0x1000 +#define QUOTAS_2000 0x2000 +#define QUOTAS_4000 0x4000 +#define QUOTAS_8000 0x8000 + +#define SMB_NTQUOTAS_NO_LIMIT ((SMB_BIG_UINT)(-1)) +#define SMB_NTQUOTAS_NO_ENTRY ((SMB_BIG_UINT)(-2)) +#define SMB_NTQUOTAS_NO_SPACE ((SMB_BIG_UINT)(0)) +#define SMB_NTQUOTAS_1_B (SMB_BIG_UINT)0x0000000000000001 +#define SMB_NTQUOTAS_1KB (SMB_BIG_UINT)0x0000000000000400 +#define SMB_NTQUOTAS_1MB (SMB_BIG_UINT)0x0000000000100000 +#define SMB_NTQUOTAS_1GB (SMB_BIG_UINT)0x0000000040000000 +#define SMB_NTQUOTAS_1TB (SMB_BIG_UINT)0x0000010000000000 +#define SMB_NTQUOTAS_1PB (SMB_BIG_UINT)0x0004000000000000 +#define SMB_NTQUOTAS_1EB (SMB_BIG_UINT)0x1000000000000000 + +enum SMB_QUOTA_TYPE { + SMB_INVALID_QUOTA_TYPE = -1, + SMB_USER_FS_QUOTA_TYPE = 1, + SMB_USER_QUOTA_TYPE = 2, + SMB_GROUP_FS_QUOTA_TYPE = 3,/* not used yet */ + SMB_GROUP_QUOTA_TYPE = 4 /* not in use yet, maybe for disk_free queries */ +}; + +typedef struct _SMB_NTQUOTA_STRUCT { + enum SMB_QUOTA_TYPE qtype; + SMB_BIG_UINT usedspace; + SMB_BIG_UINT softlim; + SMB_BIG_UINT hardlim; + uint32 qflags; + DOM_SID sid; +} SMB_NTQUOTA_STRUCT; + +typedef struct _SMB_NTQUOTA_LIST { + struct _SMB_NTQUOTA_LIST *prev,*next; + TALLOC_CTX *mem_ctx; + uid_t uid; + SMB_NTQUOTA_STRUCT *quotas; +} SMB_NTQUOTA_LIST; + +typedef struct _SMB_NTQUOTA_HANDLE { + bool valid; + SMB_NTQUOTA_LIST *quota_list; + SMB_NTQUOTA_LIST *tmp_list; +} SMB_NTQUOTA_HANDLE; + +#endif /*_NTQUOTAS_H */ diff --git a/source3/include/packet.h b/source3/include/packet.h new file mode 100644 index 0000000000..d5174229ca --- /dev/null +++ b/source3/include/packet.h @@ -0,0 +1,83 @@ +/* + Unix SMB/CIFS implementation. + Packet handling + Copyright (C) Volker Lendecke 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* + * A packet context is a wrapper around a bidirectional file descriptor, + * hiding the handling of individual requests. + */ + +struct packet_context; + +/* + * Initialize a packet context. The fd is given to the packet context, meaning + * that it is automatically closed when the packet context is freed. + */ +struct packet_context *packet_init(TALLOC_CTX *mem_ctx, int fd); + +/* + * Pull data from the fd + */ +NTSTATUS packet_fd_read(struct packet_context *ctx); + +/* + * Sync read, wait for the next chunk + */ +NTSTATUS packet_fd_read_sync(struct packet_context *ctx); + +/* + * Handle an incoming packet: + * Return False if none is available + * Otherwise return True and store the callback result in *status + */ +bool packet_handler(struct packet_context *ctx, + bool (*full_req)(const struct data_blob *data, + size_t *length, + void *private_data), + NTSTATUS (*callback)(const struct data_blob *data, + void *private_data), + void *private_data, + NTSTATUS *status); + +/* + * How many bytes of outgoing data do we have pending? + */ +size_t packet_outgoing_bytes(struct packet_context *ctx); + +/* + * Push data to the fd + */ +NTSTATUS packet_fd_write(struct packet_context *ctx); + +/* + * Sync flush all outgoing bytes + */ +NTSTATUS packet_flush(struct packet_context *ctx); + +/* + * Send a list of DATA_BLOBs + * + * Example: packet_send(ctx, 2, data_blob_const(&size, sizeof(size)), + * data_blob_const(buf, size)); + */ +NTSTATUS packet_send(struct packet_context *ctx, int num_blobs, ...); + +/* + * Get the packet context's file descriptor + */ +int packet_get_fd(struct packet_context *ctx); diff --git a/source3/include/passdb.h b/source3/include/passdb.h new file mode 100644 index 0000000000..360a0d0444 --- /dev/null +++ b/source3/include/passdb.h @@ -0,0 +1,399 @@ +/* + Unix SMB/CIFS implementation. + passdb structures and parameters + Copyright (C) Gerald Carter 2001 + Copyright (C) Luke Kenneth Casson Leighton 1998 - 2000 + Copyright (C) Andrew Bartlett 2002 + Copyright (C) Simo Sorce 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _PASSDB_H +#define _PASSDB_H + + +/* + * in samba4 idl + * ACCT_NT_PWD_SET == SAMR_FIELD_PASSWORD and + * ACCT_LM_PWD_SET == SAMR_FIELD_PASSWORD2 + */ + +#define ACCT_NT_PWD_SET 0x01000000 +#define ACCT_LM_PWD_SET 0x02000000 + +/* + * bit flags representing initialized fields in struct samu + */ +enum pdb_elements { + PDB_UNINIT, + PDB_SMBHOME, + PDB_PROFILE, + PDB_DRIVE, + PDB_LOGONSCRIPT, + PDB_LOGONTIME, + PDB_LOGOFFTIME, + PDB_KICKOFFTIME, + PDB_BAD_PASSWORD_TIME, + PDB_CANCHANGETIME, + PDB_MUSTCHANGETIME, + PDB_PLAINTEXT_PW, + PDB_USERNAME, + PDB_FULLNAME, + PDB_DOMAIN, + PDB_NTUSERNAME, + PDB_HOURSLEN, + PDB_LOGONDIVS, + PDB_USERSID, + PDB_GROUPSID, + PDB_ACCTCTRL, + PDB_PASSLASTSET, + PDB_ACCTDESC, + PDB_WORKSTATIONS, + PDB_COMMENT, + PDB_MUNGEDDIAL, + PDB_HOURS, + PDB_FIELDS_PRESENT, + PDB_BAD_PASSWORD_COUNT, + PDB_LOGON_COUNT, + PDB_UNKNOWN6, + PDB_LMPASSWD, + PDB_NTPASSWD, + PDB_PWHISTORY, + PDB_BACKEND_PRIVATE_DATA, + + /* this must be the last element */ + PDB_COUNT +}; + +enum pdb_group_elements { + PDB_GROUP_NAME, + PDB_GROUP_SID, + PDB_GROUP_SID_NAME_USE, + PDB_GROUP_MEMBERS, + + /* this must be the last element */ + PDB_GROUP_COUNT +}; + + +enum pdb_value_state { + PDB_DEFAULT=0, + PDB_SET, + PDB_CHANGED +}; + +#define IS_SAM_SET(x, flag) (pdb_get_init_flags(x, flag) == PDB_SET) +#define IS_SAM_CHANGED(x, flag) (pdb_get_init_flags(x, flag) == PDB_CHANGED) +#define IS_SAM_DEFAULT(x, flag) (pdb_get_init_flags(x, flag) == PDB_DEFAULT) + +/* cache for bad password lockout data, to be used on replicated SAMs */ +typedef struct logon_cache_struct { + time_t entry_timestamp; + uint32 acct_ctrl; + uint16 bad_password_count; + time_t bad_password_time; +} LOGIN_CACHE; + +struct samu { + struct pdb_methods *methods; + + /* initialization flags */ + struct bitmap *change_flags; + struct bitmap *set_flags; + + time_t logon_time; /* logon time */ + time_t logoff_time; /* logoff time */ + time_t kickoff_time; /* kickoff time */ + time_t bad_password_time; /* last bad password entered */ + time_t pass_last_set_time; /* password last set time */ + time_t pass_can_change_time; /* password can change time */ + time_t pass_must_change_time; /* password must change time */ + + const char *username; /* UNIX username string */ + const char *domain; /* Windows Domain name */ + const char *nt_username; /* Windows username string */ + const char *full_name; /* user's full name string */ + const char *home_dir; /* home directory string */ + const char *dir_drive; /* home directory drive string */ + const char *logon_script; /* logon script string */ + const char *profile_path; /* profile path string */ + const char *acct_desc; /* user description string */ + const char *workstations; /* login from workstations string */ + const char *comment; + const char *munged_dial; /* munged path name and dial-back tel number */ + + DOM_SID user_sid; + DOM_SID *group_sid; + + DATA_BLOB lm_pw; /* .data is Null if no password */ + DATA_BLOB nt_pw; /* .data is Null if no password */ + DATA_BLOB nt_pw_his; /* nt hashed password history .data is Null if not available */ + char* plaintext_pw; /* is Null if not available */ + + uint32 acct_ctrl; /* account info (ACB_xxxx bit-mask) */ + uint32 fields_present; /* 0x00ff ffff */ + + uint16 logon_divs; /* 168 - number of hours in a week */ + uint32 hours_len; /* normally 21 bytes */ + uint8 hours[MAX_HOURS_LEN]; + + /* Was unknown_5. */ + uint16 bad_password_count; + uint16 logon_count; + + uint32 unknown_6; /* 0x0000 04ec */ + + /* a tag for who added the private methods */ + + const struct pdb_methods *backend_private_methods; + void *backend_private_data; + void (*backend_private_data_free_fn)(void **); + + /* maintain a copy of the user's struct passwd */ + + struct passwd *unix_pw; +}; + +struct acct_info { + fstring acct_name; /* account name */ + fstring acct_desc; /* account name */ + uint32 rid; /* domain-relative RID */ +}; + +struct samr_displayentry { + uint32 idx; + uint32 rid; + uint32 acct_flags; + const char *account_name; + const char *fullname; + const char *description; +}; + +enum pdb_search_type { + PDB_USER_SEARCH, + PDB_GROUP_SEARCH, + PDB_ALIAS_SEARCH +}; + +struct pdb_search { + TALLOC_CTX *mem_ctx; + enum pdb_search_type type; + struct samr_displayentry *cache; + uint32 num_entries; + ssize_t cache_size; + bool search_ended; + void *private_data; + bool (*next_entry)(struct pdb_search *search, + struct samr_displayentry *entry); + void (*search_end)(struct pdb_search *search); +}; + +/***************************************************************** + Functions to be implemented by the new (v2) passdb API +****************************************************************/ + +/* + * This next constant specifies the version number of the PASSDB interface + * this SAMBA will load. Increment this if *ANY* changes are made to the interface. + * Changed interface to fix int -> size_t problems. JRA. + * There's no point in allocating arrays in + * samr_lookup_rids twice. It was done in the srv_samr_nt.c code as well as in + * the pdb module. Remove the latter, this might happen more often. VL. + * changed to version 14 to move lookup_rids and lookup_names to return + * enum lsa_SidType rather than uint32. + * Changed to 16 for access to the trusted domain passwords (obnox). + * Changed to 17, the sampwent interface is gone. + */ + +#define PASSDB_INTERFACE_VERSION 17 + +struct pdb_methods +{ + const char *name; /* What name got this module */ + + NTSTATUS (*getsampwnam)(struct pdb_methods *, struct samu *sam_acct, const char *username); + + NTSTATUS (*getsampwsid)(struct pdb_methods *, struct samu *sam_acct, const DOM_SID *sid); + + NTSTATUS (*create_user)(struct pdb_methods *, TALLOC_CTX *tmp_ctx, + const char *name, uint32 acct_flags, + uint32 *rid); + + NTSTATUS (*delete_user)(struct pdb_methods *, TALLOC_CTX *tmp_ctx, + struct samu *sam_acct); + + NTSTATUS (*add_sam_account)(struct pdb_methods *, struct samu *sampass); + + NTSTATUS (*update_sam_account)(struct pdb_methods *, struct samu *sampass); + + NTSTATUS (*delete_sam_account)(struct pdb_methods *, struct samu *username); + + NTSTATUS (*rename_sam_account)(struct pdb_methods *, struct samu *oldname, const char *newname); + + NTSTATUS (*update_login_attempts)(struct pdb_methods *methods, struct samu *sam_acct, bool success); + + NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map, DOM_SID sid); + + NTSTATUS (*getgrgid)(struct pdb_methods *methods, GROUP_MAP *map, gid_t gid); + + NTSTATUS (*getgrnam)(struct pdb_methods *methods, GROUP_MAP *map, const char *name); + + NTSTATUS (*create_dom_group)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, const char *name, + uint32 *rid); + + NTSTATUS (*delete_dom_group)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, uint32 rid); + + NTSTATUS (*add_group_mapping_entry)(struct pdb_methods *methods, + GROUP_MAP *map); + + NTSTATUS (*update_group_mapping_entry)(struct pdb_methods *methods, + GROUP_MAP *map); + + NTSTATUS (*delete_group_mapping_entry)(struct pdb_methods *methods, + DOM_SID sid); + + NTSTATUS (*enum_group_mapping)(struct pdb_methods *methods, + const DOM_SID *sid, enum lsa_SidType sid_name_use, + GROUP_MAP **pp_rmap, size_t *p_num_entries, + bool unix_only); + + NTSTATUS (*enum_group_members)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + const DOM_SID *group, + uint32 **pp_member_rids, + size_t *p_num_members); + + NTSTATUS (*enum_group_memberships)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + struct samu *user, + DOM_SID **pp_sids, gid_t **pp_gids, + size_t *p_num_groups); + + NTSTATUS (*set_unix_primary_group)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + struct samu *user); + + NTSTATUS (*add_groupmem)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + uint32 group_rid, uint32 member_rid); + + NTSTATUS (*del_groupmem)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + uint32 group_rid, uint32 member_rid); + + NTSTATUS (*create_alias)(struct pdb_methods *methods, + const char *name, uint32 *rid); + + NTSTATUS (*delete_alias)(struct pdb_methods *methods, + const DOM_SID *sid); + + NTSTATUS (*get_aliasinfo)(struct pdb_methods *methods, + const DOM_SID *sid, + struct acct_info *info); + + NTSTATUS (*set_aliasinfo)(struct pdb_methods *methods, + const DOM_SID *sid, + struct acct_info *info); + + NTSTATUS (*add_aliasmem)(struct pdb_methods *methods, + const DOM_SID *alias, const DOM_SID *member); + NTSTATUS (*del_aliasmem)(struct pdb_methods *methods, + const DOM_SID *alias, const DOM_SID *member); + NTSTATUS (*enum_aliasmem)(struct pdb_methods *methods, + const DOM_SID *alias, DOM_SID **members, + size_t *p_num_members); + NTSTATUS (*enum_alias_memberships)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + const DOM_SID *members, + size_t num_members, + uint32 **pp_alias_rids, + size_t *p_num_alias_rids); + + NTSTATUS (*lookup_rids)(struct pdb_methods *methods, + const DOM_SID *domain_sid, + int num_rids, + uint32 *rids, + const char **pp_names, + enum lsa_SidType *attrs); + + NTSTATUS (*lookup_names)(struct pdb_methods *methods, + const DOM_SID *domain_sid, + int num_names, + const char **pp_names, + uint32 *rids, + enum lsa_SidType *attrs); + + NTSTATUS (*get_account_policy)(struct pdb_methods *methods, + int policy_index, uint32 *value); + + NTSTATUS (*set_account_policy)(struct pdb_methods *methods, + int policy_index, uint32 value); + + NTSTATUS (*get_seq_num)(struct pdb_methods *methods, time_t *seq_num); + + bool (*search_users)(struct pdb_methods *methods, + struct pdb_search *search, + uint32 acct_flags); + bool (*search_groups)(struct pdb_methods *methods, + struct pdb_search *search); + bool (*search_aliases)(struct pdb_methods *methods, + struct pdb_search *search, + const DOM_SID *sid); + + bool (*uid_to_rid)(struct pdb_methods *methods, uid_t uid, + uint32 *rid); + bool (*uid_to_sid)(struct pdb_methods *methods, uid_t uid, + DOM_SID *sid); + bool (*gid_to_sid)(struct pdb_methods *methods, gid_t gid, + DOM_SID *sid); + bool (*sid_to_id)(struct pdb_methods *methods, const DOM_SID *sid, + union unid_t *id, enum lsa_SidType *type); + + bool (*rid_algorithm)(struct pdb_methods *methods); + bool (*new_rid)(struct pdb_methods *methods, uint32 *rid); + + + bool (*get_trusteddom_pw)(struct pdb_methods *methods, + const char *domain, char** pwd, + DOM_SID *sid, time_t *pass_last_set_time); + bool (*set_trusteddom_pw)(struct pdb_methods *methods, + const char* domain, const char* pwd, + const DOM_SID *sid); + bool (*del_trusteddom_pw)(struct pdb_methods *methods, + const char *domain); + NTSTATUS (*enum_trusteddoms)(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, uint32 *num_domains, + struct trustdom_info ***domains); + + void *private_data; /* Private data of some kind */ + + void (*free_private_data)(void **); +}; + +typedef NTSTATUS (*pdb_init_function)(struct pdb_methods **, const char *); + +struct pdb_init_function_entry { + const char *name; + + /* Function to create a member of the pdb_methods list */ + pdb_init_function init; + + struct pdb_init_function_entry *prev, *next; +}; + +#endif /* _PASSDB_H */ diff --git a/source3/include/popt_common.h b/source3/include/popt_common.h new file mode 100644 index 0000000000..bbd013a18f --- /dev/null +++ b/source3/include/popt_common.h @@ -0,0 +1,58 @@ +/* + Unix SMB/CIFS implementation. + Common popt arguments + Copyright (C) Jelmer Vernooij 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _POPT_COMMON_H +#define _POPT_COMMON_H + +#include <popt.h> + +/* Common popt structures */ +extern struct poptOption popt_common_samba[]; +extern struct poptOption popt_common_connection[]; +extern struct poptOption popt_common_configfile[]; +extern struct poptOption popt_common_version[]; +extern struct poptOption popt_common_credentials[]; +extern struct poptOption popt_common_debuglevel[]; +extern const struct poptOption popt_common_dynconfig[]; + +#ifndef POPT_TABLEEND +#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL } +#endif + +#define POPT_COMMON_SAMBA { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_samba, 0, "Common samba options:", NULL }, +#define POPT_COMMON_CONNECTION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_connection, 0, "Connection options:", NULL }, +#define POPT_COMMON_VERSION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version, 0, "Common samba options:", NULL }, +#define POPT_COMMON_CONFIGFILE { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile, 0, "Common samba config:", NULL }, +#define POPT_COMMON_CREDENTIALS { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_credentials, 0, "Authentication options:", NULL }, +#define POPT_COMMON_DYNCONFIG { NULL, 0, POPT_ARG_INCLUDE_TABLE, \ + CONST_DISCARD(poptOption *, popt_common_dynconfig), 0, \ + "Build-time configuration overrides:", NULL }, +#define POPT_COMMON_DEBUGLEVEL { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debuglevel, 0, "Common samba debugging:", NULL }, + +struct user_auth_info { + char *username; + char *password; + bool got_pass; + bool use_kerberos; + int signing_state; + bool smb_encrypt; + bool use_machine_account; +}; + +#endif /* _POPT_COMMON_H */ diff --git a/source3/include/printing.h b/source3/include/printing.h new file mode 100644 index 0000000000..2788143cc5 --- /dev/null +++ b/source3/include/printing.h @@ -0,0 +1,102 @@ +#ifndef PRINTING_H_ +#define PRINTING_H_ + +/* + Unix SMB/CIFS implementation. + printing definitions + Copyright (C) Andrew Tridgell 1992-2000 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* + This file defines the low-level printing system interfaces used by the + SAMBA printing subsystem. +*/ + +/* Information for print jobs */ +struct printjob { + pid_t pid; /* which process launched the job */ + int sysjob; /* the system (lp) job number */ + int fd; /* file descriptor of open file if open */ + time_t starttime; /* when the job started spooling */ + int status; /* the status of this job */ + size_t size; /* the size of the job so far */ + int page_count; /* then number of pages so far */ + bool spooled; /* has it been sent to the spooler yet? */ + bool smbjob; /* set if the job is a SMB job */ + fstring filename; /* the filename used to spool the file */ + fstring jobname; /* the job name given to us by the client */ + fstring user; /* the user who started the job */ + fstring queuename; /* service number of printer for this job */ + NT_DEVICEMODE *nt_devmode; +}; + +/* Information for print interfaces */ +struct printif +{ + /* value of the 'printing' option for this service */ + enum printing_types type; + + int (*queue_get)(const char *printer_name, + enum printing_types printing_type, + char *lpq_command, + print_queue_struct **q, + print_status_struct *status); + int (*queue_pause)(int snum); + int (*queue_resume)(int snum); + int (*job_delete)(const char *sharename, const char *lprm_command, struct printjob *pjob); + int (*job_pause)(int snum, struct printjob *pjob); + int (*job_resume)(int snum, struct printjob *pjob); + int (*job_submit)(int snum, struct printjob *pjob); +}; + +extern struct printif generic_printif; + +#ifdef HAVE_CUPS +extern struct printif cups_printif; +#endif /* HAVE_CUPS */ + +#ifdef HAVE_IPRINT +extern struct printif iprint_printif; +#endif /* HAVE_IPRINT */ + +/* PRINT_MAX_JOBID is now defined in local.h */ +#define UNIX_JOB_START PRINT_MAX_JOBID +#define NEXT_JOBID(j) ((j+1) % PRINT_MAX_JOBID > 0 ? (j+1) % PRINT_MAX_JOBID : 1) + +#define MAX_CACHE_VALID_TIME 3600 + +#ifndef PRINT_SPOOL_PREFIX +#define PRINT_SPOOL_PREFIX "smbprn." +#endif +#define PRINT_DATABASE_VERSION 5 + +/* There can be this many printing tdb's open, plus any locked ones. */ +#define MAX_PRINT_DBS_OPEN 1 + +struct tdb_print_db { + struct tdb_print_db *next, *prev; + TDB_CONTEXT *tdb; + int ref_count; + fstring printer_name; +}; + +/* + * Used for print notify + */ + +#define NOTIFY_PID_LIST_KEY "NOTIFY_PID_LIST" + +#endif /* PRINTING_H_ */ diff --git a/source3/include/privileges.h b/source3/include/privileges.h new file mode 100644 index 0000000000..9a5d928da0 --- /dev/null +++ b/source3/include/privileges.h @@ -0,0 +1,112 @@ + +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + Copyright (C) Simo Sorce 2003 + Copyright (C) Gerald (Jerry) Carter 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef PRIVILEGES_H +#define PRIVILEGES_H + +/* privilege bitmask */ + +#define SE_PRIV_MASKSIZE 4 + +typedef struct { + uint32 mask[SE_PRIV_MASKSIZE]; +} SE_PRIV; + + +/* common privilege defines */ + +#define SE_END { { 0x00000000, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_NONE { { 0x00000000, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_ALL_PRIVS { { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF } } + + +/* + * We will use our own set of privileges since it makes no sense + * to implement all of the Windows set when only a portion will + * be used. Use 128-bit mask to give room to grow. + */ + +#define SE_NETWORK_LOGON { { 0x00000001, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_INTERACTIVE_LOGON { { 0x00000002, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_BATCH_LOGON { { 0x00000004, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_SERVICE_LOGON { { 0x00000008, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_MACHINE_ACCOUNT { { 0x00000010, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_PRINT_OPERATOR { { 0x00000020, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_ADD_USERS { { 0x00000040, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_DISK_OPERATOR { { 0x00000080, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_REMOTE_SHUTDOWN { { 0x00000100, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_BACKUP { { 0x00000200, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_RESTORE { { 0x00000400, 0x00000000, 0x00000000, 0x00000000 } } +#define SE_TAKE_OWNERSHIP { { 0x00000800, 0x00000000, 0x00000000, 0x00000000 } } + +/* defined in lib/privilegs_basic.c */ + +extern const SE_PRIV se_priv_all; + +extern const SE_PRIV se_priv_none; +extern const SE_PRIV se_machine_account; +extern const SE_PRIV se_print_operator; +extern const SE_PRIV se_add_users; +extern const SE_PRIV se_disk_operators; +extern const SE_PRIV se_remote_shutdown; +extern const SE_PRIV se_restore; +extern const SE_PRIV se_take_ownership; + + +/* + * These are used in Lsa replies (srv_lsa_nt.c) + */ +#define PR_NONE 0x0000 +#define PR_LOG_ON_LOCALLY 0x0001 +#define PR_ACCESS_FROM_NETWORK 0x0002 +#define PR_LOG_ON_BATCH_JOB 0x0004 +#define PR_LOG_ON_SERVICE 0x0010 + + +typedef struct { + uint32 high; + uint32 low; +} LUID; + +typedef struct { + LUID luid; + uint32 attr; +} LUID_ATTR; + +typedef struct { + TALLOC_CTX *mem_ctx; + bool ext_ctx; + uint32 count; + uint32 control; + LUID_ATTR *set; +} PRIVILEGE_SET; + +typedef struct { + SE_PRIV se_priv; + const char *name; + const char *description; + LUID luid; +} PRIVS; + +#endif /* PRIVILEGES_H */ diff --git a/source3/include/proto.h b/source3/include/proto.h new file mode 100644 index 0000000000..2901911c70 --- /dev/null +++ b/source3/include/proto.h @@ -0,0 +1,10554 @@ +/* + * Unix SMB/CIFS implementation. + * collected prototypes header + * + * frozen from "make proto" in May 2008 + * + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _PROTO_H_ +#define _PROTO_H_ + + +/* The following definitions come from auth/auth.c */ + +NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init); +bool load_auth_module(struct auth_context *auth_context, + const char *module, auth_methods **ret) ; +NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) ; +NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[8]) ; + +/* The following definitions come from auth/auth_builtin.c */ + +NTSTATUS auth_builtin_init(void); + +/* The following definitions come from auth/auth_compat.c */ + +NTSTATUS check_plaintext_password(const char *smb_name, DATA_BLOB plaintext_password, auth_serversupplied_info **server_info); +bool password_ok(const char *smb_name, DATA_BLOB password_blob); + +/* The following definitions come from auth/auth_domain.c */ + +NTSTATUS auth_domain_init(void) ; + +/* The following definitions come from auth/auth_ntlmssp.c */ + +NTSTATUS auth_ntlmssp_start(AUTH_NTLMSSP_STATE **auth_ntlmssp_state); +void auth_ntlmssp_end(AUTH_NTLMSSP_STATE **auth_ntlmssp_state); +NTSTATUS auth_ntlmssp_update(AUTH_NTLMSSP_STATE *auth_ntlmssp_state, + const DATA_BLOB request, DATA_BLOB *reply) ; + +/* The following definitions come from auth/auth_sam.c */ + +NTSTATUS auth_sam_init(void); + +/* The following definitions come from auth/auth_server.c */ + +NTSTATUS auth_server_init(void); + +/* The following definitions come from auth/auth_unix.c */ + +NTSTATUS auth_unix_init(void); + +/* The following definitions come from auth/auth_util.c */ + +NTSTATUS make_user_info_map(auth_usersupplied_info **user_info, + const char *smb_name, + const char *client_domain, + const char *wksta_name, + DATA_BLOB *lm_pwd, DATA_BLOB *nt_pwd, + DATA_BLOB *lm_interactive_pwd, DATA_BLOB *nt_interactive_pwd, + DATA_BLOB *plaintext, + bool encrypted); +bool make_user_info_netlogon_network(auth_usersupplied_info **user_info, + const char *smb_name, + const char *client_domain, + const char *wksta_name, + uint32 logon_parameters, + const uchar *lm_network_pwd, + int lm_pwd_len, + const uchar *nt_network_pwd, + int nt_pwd_len); +bool make_user_info_netlogon_interactive(auth_usersupplied_info **user_info, + const char *smb_name, + const char *client_domain, + const char *wksta_name, + uint32 logon_parameters, + const uchar chal[8], + const uchar lm_interactive_pwd[16], + const uchar nt_interactive_pwd[16], + const uchar *dc_sess_key); +bool make_user_info_for_reply(auth_usersupplied_info **user_info, + const char *smb_name, + const char *client_domain, + const uint8 chal[8], + DATA_BLOB plaintext_password); +NTSTATUS make_user_info_for_reply_enc(auth_usersupplied_info **user_info, + const char *smb_name, + const char *client_domain, + DATA_BLOB lm_resp, DATA_BLOB nt_resp); +bool make_user_info_guest(auth_usersupplied_info **user_info) ; +NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info, + struct samu *sampass); +NTSTATUS create_local_token(auth_serversupplied_info *server_info); +NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, + bool is_guest, + uid_t *uid, gid_t *gid, + char **found_username, + struct nt_user_token **token); +bool user_in_group_sid(const char *username, const DOM_SID *group_sid); +bool user_in_group(const char *username, const char *groupname); +NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info, + char *unix_username, + struct passwd *pwd); +NTSTATUS make_serverinfo_from_username(TALLOC_CTX *mem_ctx, + const char *username, + bool is_guest, + struct auth_serversupplied_info **presult); +struct auth_serversupplied_info *copy_serverinfo(TALLOC_CTX *mem_ctx, + auth_serversupplied_info *src); +bool init_guest_info(void); +bool server_info_set_session_key(struct auth_serversupplied_info *info, + DATA_BLOB session_key); +NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx, + auth_serversupplied_info **server_info); +bool copy_current_user(struct current_user *dst, struct current_user *src); +struct passwd *smb_getpwnam( TALLOC_CTX *mem_ctx, char *domuser, + fstring save_username, bool create ); +NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, + const char *sent_nt_username, + const char *domain, + auth_serversupplied_info **server_info, + struct netr_SamInfo3 *info3); +NTSTATUS make_server_info_wbcAuthUserInfo(TALLOC_CTX *mem_ctx, + const char *sent_nt_username, + const char *domain, + const struct wbcAuthUserInfo *info, + auth_serversupplied_info **server_info); +void free_user_info(auth_usersupplied_info **user_info); +bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_method) ; +bool is_trusted_domain(const char* dom_name); + +/* The following definitions come from auth/auth_winbind.c */ + +NTSTATUS auth_winbind_init(void); + +/* The following definitions come from auth/pampass.c */ + +bool smb_pam_claim_session(char *user, char *tty, char *rhost); +bool smb_pam_close_session(char *user, char *tty, char *rhost); +NTSTATUS smb_pam_accountcheck(const char * user); +NTSTATUS smb_pam_passcheck(const char * user, const char * password); +bool smb_pam_passchange(const char * user, const char * oldpassword, const char * newpassword); +NTSTATUS smb_pam_accountcheck(const char * user); +bool smb_pam_claim_session(char *user, char *tty, char *rhost); +bool smb_pam_close_session(char *in_user, char *tty, char *rhost); + +/* The following definitions come from auth/pass_check.c */ + +void dfs_unlogin(void); +NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *password, + int pwlen, bool (*fn) (const char *, const char *), bool run_cracker); + +/* The following definitions come from auth/token_util.c */ + +bool nt_token_check_sid ( const DOM_SID *sid, const NT_USER_TOKEN *token ); +bool nt_token_check_domain_rid( NT_USER_TOKEN *token, uint32 rid ); +NT_USER_TOKEN *get_root_nt_token( void ); +NTSTATUS add_aliases(const DOM_SID *domain_sid, + struct nt_user_token *token); +NTSTATUS create_builtin_users(const DOM_SID *sid); +NTSTATUS create_builtin_administrators(const DOM_SID *sid); +struct nt_user_token *create_local_nt_token(TALLOC_CTX *mem_ctx, + const DOM_SID *user_sid, + bool is_guest, + int num_groupsids, + const DOM_SID *groupsids); +void debug_nt_user_token(int dbg_class, int dbg_lev, NT_USER_TOKEN *token); +void debug_unix_user_token(int dbg_class, int dbg_lev, uid_t uid, gid_t gid, + int n_groups, gid_t *groups); + +/* The following definitions come from groupdb/mapping.c */ + +NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment); +bool get_domain_group_from_sid(DOM_SID sid, GROUP_MAP *map); +int smb_create_group(const char *unix_group, gid_t *new_gid); +int smb_delete_group(const char *unix_group); +int smb_set_primary_group(const char *unix_group, const char* unix_user); +int smb_add_user_group(const char *unix_group, const char *unix_user); +int smb_delete_user_group(const char *unix_group, const char *unix_user); +NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map, + DOM_SID sid); +NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map, + gid_t gid); +NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map, + const char *name); +NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods, + GROUP_MAP *map); +NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods, + GROUP_MAP *map); +NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods, + DOM_SID sid); +NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods, + const DOM_SID *sid, enum lsa_SidType sid_name_use, + GROUP_MAP **pp_rmap, size_t *p_num_entries, + bool unix_only); +NTSTATUS pdb_default_create_alias(struct pdb_methods *methods, + const char *name, uint32 *rid); +NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods, + const DOM_SID *sid); +NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods, + const DOM_SID *sid, + struct acct_info *info); +NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods, + const DOM_SID *sid, + struct acct_info *info); +NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods, + const DOM_SID *alias, const DOM_SID *member); +NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods, + const DOM_SID *alias, const DOM_SID *member); +NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods, + const DOM_SID *alias, DOM_SID **pp_members, + size_t *p_num_members); +NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods, + TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + const DOM_SID *members, + size_t num_members, + uint32 **pp_alias_rids, + size_t *p_num_alias_rids); +NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map, + DOM_SID sid); +NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map, + gid_t gid); +NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map, + const char *name); +NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods, + GROUP_MAP *map); +NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods, + GROUP_MAP *map); +NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods, + DOM_SID sid); +NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods, + enum lsa_SidType sid_name_use, + GROUP_MAP **rmap, size_t *num_entries, + bool unix_only); +bool pdb_get_dom_grp_info(const DOM_SID *sid, struct acct_info *info); +bool pdb_set_dom_grp_info(const DOM_SID *sid, const struct acct_info *info); +NTSTATUS pdb_create_builtin_alias(uint32 rid); + +/* The following definitions come from groupdb/mapping_ldb.c */ + +const struct mapping_backend *groupdb_ldb_init(void); + +/* The following definitions come from groupdb/mapping_tdb.c */ + +const struct mapping_backend *groupdb_tdb_init(void); + +/* The following definitions come from intl/lang_tdb.c */ + +bool lang_tdb_init(const char *lang); +const char *lang_msg(const char *msgid); +void lang_msg_free(const char *msgstr); +char *lang_tdb_current(void); + +/* The following definitions come from lib/access.c */ + +bool client_match(const char *tok, const void *item); +bool list_match(const char **list,const void *item, + bool (*match_fn)(const char *, const void *)); +bool allow_access(const char **deny_list, + const char **allow_list, + const char *cname, + const char *caddr); +bool check_access(int sock, const char **allow_list, const char **deny_list); + +/* The following definitions come from lib/account_pol.c */ + +void account_policy_names_list(const char ***names, int *num_names); +const char *decode_account_policy_name(int field); +const char *get_account_policy_attr(int field); +const char *account_policy_get_desc(int field); +int account_policy_name_to_fieldnum(const char *name); +bool account_policy_get_default(int account_policy, uint32 *val); +bool init_account_policy(void); +bool account_policy_get(int field, uint32 *value); +bool account_policy_set(int field, uint32 value); +bool cache_account_policy_set(int field, uint32 value); +bool cache_account_policy_get(int field, uint32 *value); +struct db_context *get_account_pol_db( void ); + +/* The following definitions come from lib/adt_tree.c */ + + +/* The following definitions come from lib/afs.c */ + +char *afs_createtoken_str(const char *username, const char *cell); +bool afs_login(connection_struct *conn); +bool afs_login(connection_struct *conn); +char *afs_createtoken_str(const char *username, const char *cell); + +/* The following definitions come from lib/afs_settoken.c */ + +int afs_syscall( int subcall, + char * path, + int cmd, + char * cmarg, + int follow); +bool afs_settoken_str(const char *token_string); +bool afs_settoken_str(const char *token_string); + +/* The following definitions come from lib/arc4.c */ + +void smb_arc4_init(unsigned char arc4_state_out[258], const unsigned char *key, size_t keylen); +void smb_arc4_crypt(unsigned char arc4_state_inout[258], unsigned char *data, size_t len); + +/* The following definitions come from lib/audit.c */ + +const char *audit_category_str(uint32 category); +const char *audit_param_str(uint32 category); +const char *audit_description_str(uint32 category); +bool get_audit_category_from_param(const char *param, uint32 *audit_category); +const char *audit_policy_str(TALLOC_CTX *mem_ctx, uint32 policy); + +/* The following definitions come from lib/bitmap.c */ + +struct bitmap *bitmap_allocate(int n); +void bitmap_free(struct bitmap *bm); +struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n); +int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src); +bool bitmap_set(struct bitmap *bm, unsigned i); +bool bitmap_clear(struct bitmap *bm, unsigned i); +bool bitmap_query(struct bitmap *bm, unsigned i); +int bitmap_find(struct bitmap *bm, unsigned ofs); + +/* The following definitions come from lib/charcnv.c */ + +char lp_failed_convert_char(void); +void lazy_initialize_conv(void); +void gfree_charcnv(void); +void init_iconv(void); +size_t convert_string(charset_t from, charset_t to, + void const *src, size_t srclen, + void *dest, size_t destlen, bool allow_bad_conv); +bool convert_string_allocate(TALLOC_CTX *ctx, charset_t from, charset_t to, + void const *src, size_t srclen, void *dst, + size_t *converted_size, bool allow_bad_conv); +bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, + void const *src, size_t srclen, void *dst, + size_t *converted_size, bool allow_bad_conv); +size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen); +char *strdup_upper(const char *s); +char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s); +size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen); +char *strdup_lower(const char *s); +char *talloc_strdup_lower(TALLOC_CTX *ctx, const char *s); +size_t ucs2_align(const void *base_ptr, const void *p, int flags); +size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags); +size_t push_ascii_fstring(void *dest, const char *src); +size_t push_ascii_nstring(void *dest, const char *src); +bool push_ascii_allocate(char **dest, const char *src, size_t *converted_size); +size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, int flags); +size_t pull_ascii_fstring(char *dest, const void *src); +size_t pull_ascii_nstring(char *dest, size_t dest_len, const void *src); +size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_len, int flags); +bool push_ucs2_allocate(smb_ucs2_t **dest, const char *src, + size_t *converted_size); +size_t push_utf8_fstring(void *dest, const char *src); +bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src, + size_t *converted_size); +bool push_utf8_allocate(char **dest, const char *src, size_t *converted_size); +size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_len, size_t src_len, int flags); +size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx, + const void *base_ptr, + char **ppdest, + const void *src, + size_t src_len, + int flags); +size_t pull_ucs2_fstring(char *dest, const void *src); +bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src, + size_t *converted_size); +bool pull_ucs2_allocate(char **dest, const smb_ucs2_t *src, + size_t *converted_size); +bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src, + size_t *converted_size); +bool pull_utf8_allocate(char **dest, const char *src, size_t *converted_size); +bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src, + size_t *converted_size); +bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src, + size_t *converted_size); +size_t push_string_fn(const char *function, unsigned int line, + const void *base_ptr, uint16 flags2, + void *dest, const char *src, + size_t dest_len, int flags); +size_t pull_string_fn(const char *function, + unsigned int line, + const void *base_ptr, + uint16 smb_flags2, + char *dest, + const void *src, + size_t dest_len, + size_t src_len, + int flags); +size_t pull_string_talloc_fn(const char *function, + unsigned int line, + TALLOC_CTX *ctx, + const void *base_ptr, + uint16 smb_flags2, + char **ppdest, + const void *src, + size_t src_len, + int flags); +size_t align_string(const void *base_ptr, const char *p, int flags); +codepoint_t next_codepoint(const char *str, size_t *size); + +/* The following definitions come from lib/clobber.c */ + +void clobber_region(const char *fn, unsigned int line, char *dest, size_t len); + +/* The following definitions come from lib/conn_tdb.c */ + +struct db_record *connections_fetch_record(TALLOC_CTX *mem_ctx, + TDB_DATA key); +struct db_record *connections_fetch_entry(TALLOC_CTX *mem_ctx, + connection_struct *conn, + const char *name); +int connections_traverse(int (*fn)(struct db_record *rec, + void *private_data), + void *private_data); +int connections_forall(int (*fn)(struct db_record *rec, + const struct connections_key *key, + const struct connections_data *data, + void *private_data), + void *private_data); +bool connections_init(bool rw); + +/* The following definitions come from lib/crc32.c */ + +uint32 crc32_calc_buffer(const char *buf, size_t size); + +/* The following definitions come from lib/data_blob.c */ + +DATA_BLOB data_blob(const void *p, size_t length); +DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length); +void data_blob_free(DATA_BLOB *d); +void data_blob_clear(DATA_BLOB *d); +void data_blob_clear_free(DATA_BLOB *d); +DATA_BLOB data_blob_string_const(const char *str); +DATA_BLOB data_blob_const(const void *p, size_t length); +DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length); +_PUBLIC_ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob); + +/* The following definitions come from lib/dbwrap_util.c */ + +int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr); +int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v); +bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr, + uint32_t *val); +bool dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v); +uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr, + uint32_t *oldval, uint32_t change_val); +int32 dbwrap_change_int32_atomic(struct db_context *db, const char *keystr, + int32 *oldval, int32 change_val); +NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf, + int flag); +NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key); +NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr, + int32_t v); +NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr, + uint32_t v); +NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key, + TDB_DATA data, int flags); +NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key); + +/* The following definitions come from lib/debug.c */ + +void gfree_debugsyms(void); +const char *debug_classname_from_index(int ndx); +int debug_add_class(const char *classname); +int debug_lookup_classname(const char *classname); +bool debug_parse_levels(const char *params_str); +void debug_message(struct messaging_context *msg_ctx, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data); +void debug_init(void); +void debug_register_msgs(struct messaging_context *msg_ctx); +void setup_logging(const char *pname, bool interactive); +void debug_set_logfile(const char *name); +bool reopen_logs( void ); +void force_check_log_size( void ); +bool need_to_check_log_size( void ); +void check_log_size( void ); +void dbgflush( void ); +bool dbghdr(int level, int cls, const char *file, const char *func, int line); +TALLOC_CTX *debug_ctx(void); + +/* The following definitions come from lib/display_sec.c */ + +char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type); +void display_sec_access(SEC_ACCESS *info); +void display_sec_ace_flags(uint8_t flags); +void display_sec_ace(SEC_ACE *ace); +void display_sec_acl(SEC_ACL *sec_acl); +void display_acl_type(uint16 type); +void display_sec_desc(SEC_DESC *sec); + +/* The following definitions come from lib/dmallocmsg.c */ + +void register_dmalloc_msgs(struct messaging_context *msg_ctx); + +/* The following definitions come from lib/dprintf.c */ + +void display_set_stderr(void); + +/* The following definitions come from lib/errmap_unix.c */ + +NTSTATUS map_nt_error_from_unix(int unix_error); + +/* The following definitions come from lib/events.c */ + +struct timed_event *event_add_timed(struct event_context *event_ctx, + TALLOC_CTX *mem_ctx, + struct timeval when, + const char *event_name, + void (*handler)(struct event_context *event_ctx, + struct timed_event *te, + const struct timeval *now, + void *private_data), + void *private_data); +struct fd_event *event_add_fd(struct event_context *event_ctx, + TALLOC_CTX *mem_ctx, + int fd, uint16_t flags, + void (*handler)(struct event_context *event_ctx, + struct fd_event *event, + uint16 flags, + void *private_data), + void *private_data); +void event_fd_set_writeable(struct fd_event *fde); +void event_fd_set_not_writeable(struct fd_event *fde); +void event_fd_set_readable(struct fd_event *fde); +void event_fd_set_not_readable(struct fd_event *fde); +bool event_add_to_select_args(struct event_context *event_ctx, + const struct timeval *now, + fd_set *read_fds, fd_set *write_fds, + struct timeval *timeout, int *maxfd); +bool events_pending(struct event_context *event_ctx); +bool run_events(struct event_context *event_ctx, + int selrtn, fd_set *read_fds, fd_set *write_fds); +struct timeval *get_timed_events_timeout(struct event_context *event_ctx, + struct timeval *to_ret); +int event_loop_once(struct event_context *ev); +struct event_context *event_context_init(TALLOC_CTX *mem_ctx); +int set_event_dispatch_time(struct event_context *event_ctx, + const char *event_name, struct timeval when); +int cancel_named_event(struct event_context *event_ctx, + const char *event_name); +void dump_event_list(struct event_context *event_ctx); + +/* The following definitions come from lib/fault.c */ + +void fault_setup(void (*fn)(void *)); +void dump_core_setup(const char *progname); + +/* The following definitions come from lib/file_id.c */ + +struct file_id file_id_create_dev(SMB_DEV_T dev, SMB_INO_T inode); +struct file_id vfs_file_id_from_sbuf(connection_struct *conn, const SMB_STRUCT_STAT *sbuf); +bool file_id_equal(const struct file_id *id1, const struct file_id *id2); +const char *file_id_string_tos(const struct file_id *id); +void push_file_id_16(char *buf, const struct file_id *id); +void pull_file_id_16(char *buf, struct file_id *id); + +/* The following definitions come from lib/fsusage.c */ + +int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); + +/* The following definitions come from lib/gencache.c */ + +bool gencache_init(void); +bool gencache_shutdown(void); +bool gencache_set(const char *keystr, const char *value, time_t timeout); +bool gencache_del(const char *keystr); +bool gencache_get(const char *keystr, char **valstr, time_t *timeout); +bool gencache_get_data_blob(const char *keystr, DATA_BLOB *blob, bool *expired); +bool gencache_set_data_blob(const char *keystr, const DATA_BLOB *blob, time_t timeout); +void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr), + void* data, const char* keystr_pattern); +int gencache_lock_entry( const char *key ); +void gencache_unlock_entry( const char *key ); + +/* The following definitions come from lib/genrand.c */ + +void set_rand_reseed_callback(void (*fn)(int *)); +void set_need_random_reseed(void); +void generate_random_buffer( unsigned char *out, int len); +char *generate_random_str(size_t len); + +/* The following definitions come from lib/hmacmd5.c */ + +void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context *ctx); +void hmac_md5_init_limK_to_64(const unsigned char* key, int key_len, + HMACMD5Context *ctx); +void hmac_md5_update(const unsigned char *text, int text_len, HMACMD5Context *ctx); +void hmac_md5_final(unsigned char *digest, HMACMD5Context *ctx); +void hmac_md5( unsigned char key[16], const unsigned char *data, int data_len, + unsigned char *digest); + +/* The following definitions come from lib/iconv.c */ + +NTSTATUS smb_register_charset(struct charset_functions *funcs) ; +size_t smb_iconv(smb_iconv_t cd, + const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); +smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode); +int smb_iconv_close (smb_iconv_t cd); + +/* The following definitions come from lib/interface.c */ + +bool ismyaddr(const struct sockaddr_storage *ip); +bool ismyip_v4(struct in_addr ip); +bool is_local_net(const struct sockaddr_storage *from); +void setup_linklocal_scope_id(struct sockaddr_storage *pss); +bool is_local_net_v4(struct in_addr from); +int iface_count(void); +int iface_count_v4_nl(void); +const struct in_addr *first_ipv4_iface(void); +struct interface *get_interface(int n); +const struct sockaddr_storage *iface_n_sockaddr_storage(int n); +const struct in_addr *iface_n_ip_v4(int n); +const struct in_addr *iface_n_bcast_v4(int n); +const struct sockaddr_storage *iface_n_bcast(int n); +const struct sockaddr_storage *iface_ip(const struct sockaddr_storage *ip); +bool iface_local(const struct sockaddr_storage *ip); +void load_interfaces(void); +void gfree_interfaces(void); +bool interfaces_changed(void); + +/* The following definitions come from lib/ldap_debug_handler.c */ + +void init_ldap_debugging(void); + +/* The following definitions come from lib/ldap_escape.c */ + +char *escape_ldap_string_alloc(const char *s); +char *escape_rdn_val_string_alloc(const char *s); + +/* The following definitions come from lib/md4.c */ + +void mdfour(unsigned char *out, const unsigned char *in, int n); + +/* The following definitions come from lib/md5.c */ + +void MD5Init(struct MD5Context *ctx); +void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len); +void MD5Final(unsigned char digest[16], struct MD5Context *ctx); + +/* The following definitions come from lib/module.c */ + +NTSTATUS smb_load_module(const char *module_name); +int smb_load_modules(const char **modules); +NTSTATUS smb_probe_module(const char *subsystem, const char *module); +NTSTATUS smb_load_module(const char *module_name); +int smb_load_modules(const char **modules); +NTSTATUS smb_probe_module(const char *subsystem, const char *module); +void init_modules(void); + +/* The following definitions come from lib/ms_fnmatch.c */ + +int ms_fnmatch(const char *pattern, const char *string, bool translate_pattern, + bool is_case_sensitive); +int gen_fnmatch(const char *pattern, const char *string); + +/* The following definitions come from lib/pam_errors.c */ + +NTSTATUS pam_to_nt_status(int pam_error); +int nt_status_to_pam(NTSTATUS nt_status); +NTSTATUS pam_to_nt_status(int pam_error); +int nt_status_to_pam(NTSTATUS nt_status); + +/* The following definitions come from lib/pidfile.c */ + +pid_t pidfile_pid(const char *name); +void pidfile_create(const char *program_name); + +/* The following definitions come from lib/popt_common.c */ + + +/* The following definitions come from lib/privileges.c */ + +bool get_privileges_for_sids(SE_PRIV *privileges, DOM_SID *slist, int scount); +NTSTATUS privilege_enumerate_accounts(DOM_SID **sids, int *num_sids); +NTSTATUS privilege_enum_sids(const SE_PRIV *mask, TALLOC_CTX *mem_ctx, + DOM_SID **sids, int *num_sids); +bool grant_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask); +bool grant_privilege_by_name(DOM_SID *sid, const char *name); +bool revoke_privilege(const DOM_SID *sid, const SE_PRIV *priv_mask); +bool revoke_all_privileges( DOM_SID *sid ); +bool revoke_privilege_by_name(DOM_SID *sid, const char *name); +NTSTATUS privilege_create_account(const DOM_SID *sid ); +NTSTATUS privilege_set_init(PRIVILEGE_SET *priv_set); +NTSTATUS privilege_set_init_by_ctx(TALLOC_CTX *mem_ctx, PRIVILEGE_SET *priv_set); +void privilege_set_free(PRIVILEGE_SET *priv_set); +NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_la, int count); +bool is_privileged_sid( const DOM_SID *sid ); +bool grant_all_privileges( const DOM_SID *sid ); + +/* The following definitions come from lib/privileges_basic.c */ + +bool se_priv_copy( SE_PRIV *dst, const SE_PRIV *src ); +bool se_priv_put_all_privileges(SE_PRIV *mask); +void se_priv_add( SE_PRIV *mask, const SE_PRIV *addpriv ); +void se_priv_remove( SE_PRIV *mask, const SE_PRIV *removepriv ); +bool se_priv_equal( const SE_PRIV *mask1, const SE_PRIV *mask2 ); +bool se_priv_from_name( const char *name, SE_PRIV *mask ); +void dump_se_priv( int dbg_cl, int dbg_lvl, const SE_PRIV *mask ); +bool is_privilege_assigned(const SE_PRIV *privileges, + const SE_PRIV *check); +const char* get_privilege_dispname( const char *name ); +bool user_has_privileges(const NT_USER_TOKEN *token, const SE_PRIV *privilege); +bool user_has_any_privilege(NT_USER_TOKEN *token, const SE_PRIV *privilege); +int count_all_privileges( void ); +LUID_ATTR get_privilege_luid( SE_PRIV *mask ); +const char *luid_to_privilege_name(const LUID *set); +bool se_priv_to_privilege_set( PRIVILEGE_SET *set, SE_PRIV *mask ); +bool privilege_set_to_se_priv( SE_PRIV *mask, struct lsa_PrivilegeSet *privset ); + +/* The following definitions come from lib/readline.c */ + +char *smb_readline(const char *prompt, void (*callback)(void), + char **(completion_fn)(const char *text, int start, int end)); +const char *smb_readline_get_line_buffer(void); +void smb_readline_ca_char(char c); +int cmd_history(void); + +/* The following definitions come from lib/recvfile.c */ + +ssize_t sys_recvfile(int fromfd, + int tofd, + SMB_OFF_T offset, + size_t count); +ssize_t sys_recvfile(int fromfd, + int tofd, + SMB_OFF_T offset, + size_t count); +ssize_t drain_socket(int sockfd, size_t count); + +/* The following definitions come from lib/secace.c */ + +bool sec_ace_object(uint8 type); +void sec_ace_copy(SEC_ACE *ace_dest, SEC_ACE *ace_src); +void init_sec_ace(SEC_ACE *t, const DOM_SID *sid, enum security_ace_type type, + uint32 mask, uint8 flag); +NTSTATUS sec_ace_add_sid(TALLOC_CTX *ctx, SEC_ACE **pp_new, SEC_ACE *old, unsigned *num, DOM_SID *sid, uint32 mask); +NTSTATUS sec_ace_mod_sid(SEC_ACE *ace, size_t num, DOM_SID *sid, uint32 mask); +NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **pp_new, SEC_ACE *old, uint32 *num, DOM_SID *sid); +bool sec_ace_equal(SEC_ACE *s1, SEC_ACE *s2); +int nt_ace_inherit_comp( SEC_ACE *a1, SEC_ACE *a2); +int nt_ace_canon_comp( SEC_ACE *a1, SEC_ACE *a2); +void dacl_sort_into_canonical_order(SEC_ACE *srclist, unsigned int num_aces); +bool token_sid_in_ace(const NT_USER_TOKEN *token, const SEC_ACE *ace); + +/* The following definitions come from lib/secacl.c */ + +SEC_ACL *make_sec_acl(TALLOC_CTX *ctx, enum security_acl_revision revision, + int num_aces, SEC_ACE *ace_list); +SEC_ACL *dup_sec_acl(TALLOC_CTX *ctx, SEC_ACL *src); +bool sec_acl_equal(SEC_ACL *s1, SEC_ACL *s2); + +/* The following definitions come from lib/secdesc.c */ + +bool sec_desc_equal(SEC_DESC *s1, SEC_DESC *s2); +SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb); +SEC_DESC *make_sec_desc(TALLOC_CTX *ctx, + enum security_descriptor_revision revision, + uint16 type, + const DOM_SID *owner_sid, const DOM_SID *grp_sid, + SEC_ACL *sacl, SEC_ACL *dacl, size_t *sd_size); +SEC_DESC *dup_sec_desc(TALLOC_CTX *ctx, const SEC_DESC *src); +NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx, + struct security_descriptor *secdesc, + uint8 **data, size_t *len); +NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len, + struct security_descriptor **psecdesc); +SEC_DESC *make_standard_sec_desc(TALLOC_CTX *ctx, const DOM_SID *owner_sid, const DOM_SID *grp_sid, + SEC_ACL *dacl, size_t *sd_size); +SEC_DESC_BUF *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, SEC_DESC *sec_desc); +SEC_DESC_BUF *dup_sec_desc_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *src); +NTSTATUS sec_desc_add_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, uint32 mask, size_t *sd_size); +NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask); +NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size); +SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr, + bool child_container); +void init_sec_access(uint32 *t, uint32 mask); + +/* The following definitions come from lib/select.c */ + +void sys_select_signal(char c); +int sys_select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval); +int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *tval); + +/* The following definitions come from lib/sendfile.c */ + +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); + +/* The following definitions come from lib/server_mutex.c */ + +struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name, + int timeout); + +/* The following definitions come from lib/sharesec.c */ + +SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access); +SEC_DESC *get_share_security( TALLOC_CTX *ctx, const char *servicename, + size_t *psize); +bool set_share_security(const char *share_name, SEC_DESC *psd); +bool delete_share_security(const char *servicename); +bool share_access_check(const NT_USER_TOKEN *token, const char *sharename, + uint32 desired_access); +bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd); + +/* The following definitions come from lib/signal.c */ + +void BlockSignals(bool block,int signum); +void (*CatchSignal(int signum,void (*handler)(int )))(int); +void CatchChild(void); +void CatchChildLeaveStatus(void); + +/* The following definitions come from lib/smbldap.c */ + +int smb_ldap_start_tls(LDAP *ldap_struct, int version); +int smb_ldap_setup_conn(LDAP **ldap_struct, const char *uri); +int smb_ldap_upgrade_conn(LDAP *ldap_struct, int *new_version) ; +int smb_ldap_setup_full_conn(LDAP **ldap_struct, const char *uri); +int smbldap_search(struct smbldap_state *ldap_state, + const char *base, int scope, const char *filter, + const char *attrs[], int attrsonly, + LDAPMessage **res); +int smbldap_search_paged(struct smbldap_state *ldap_state, + const char *base, int scope, const char *filter, + const char **attrs, int attrsonly, int pagesize, + LDAPMessage **res, void **cookie); +int smbldap_modify(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]); +int smbldap_add(struct smbldap_state *ldap_state, const char *dn, LDAPMod *attrs[]); +int smbldap_delete(struct smbldap_state *ldap_state, const char *dn); +int smbldap_extended_operation(struct smbldap_state *ldap_state, + LDAP_CONST char *reqoid, struct berval *reqdata, + LDAPControl **serverctrls, LDAPControl **clientctrls, + char **retoidp, struct berval **retdatap); +int smbldap_search_suffix (struct smbldap_state *ldap_state, + const char *filter, const char **search_attr, + LDAPMessage ** result); +void smbldap_free_struct(struct smbldap_state **ldap_state) ; +NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, + const char *location, + struct smbldap_state **smbldap_state); +char *smbldap_get_dn(LDAP *ld, LDAPMessage *entry); +bool smbldap_has_control(LDAP *ld, const char *control); +bool smbldap_has_extension(LDAP *ld, const char *extension); +bool smbldap_has_naming_context(LDAP *ld, const char *naming_context); +bool smbldap_set_creds(struct smbldap_state *ldap_state, bool anon, const char *dn, const char *secret); + +/* The following definitions come from lib/smbldap_util.c */ + +NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state, + LDAPMessage ** result, const char *domain_name, + bool try_add); + +/* The following definitions come from lib/smbrun.c */ + +int smbrun_no_sanitize(const char *cmd, int *outfd); +int smbrun(const char *cmd, int *outfd); +int smbrunsecret(const char *cmd, const char *secret); + +/* The following definitions come from lib/sock_exec.c */ + +int sock_exec(const char *prog); + +/* The following definitions come from lib/substitute.c */ + +void free_local_machine_name(void); +bool set_local_machine_name(const char *local_name, bool perm); +const char *get_local_machine_name(void); +bool set_remote_machine_name(const char *remote_name, bool perm); +const char *get_remote_machine_name(void); +void sub_set_smb_name(const char *name); +void set_current_user_info(const char *smb_name, const char *unix_name, + const char *full_name, const char *domain); +const char *get_current_username(void); +void standard_sub_basic(const char *smb_name, const char *domain_name, + char *str, size_t len); +char *talloc_sub_basic(TALLOC_CTX *mem_ctx, const char *smb_name, + const char *domain_name, const char *str); +char *alloc_sub_basic(const char *smb_name, const char *domain_name, + const char *str); +char *talloc_sub_specified(TALLOC_CTX *mem_ctx, + const char *input_string, + const char *username, + const char *domain, + uid_t uid, + gid_t gid); +char *talloc_sub_advanced(TALLOC_CTX *mem_ctx, + const char *servicename, const char *user, + const char *connectpath, gid_t gid, + const char *smb_name, const char *domain_name, + const char *str); +void standard_sub_advanced(const char *servicename, const char *user, + const char *connectpath, gid_t gid, + const char *smb_name, const char *domain_name, + char *str, size_t len); +char *standard_sub_conn(TALLOC_CTX *ctx, connection_struct *conn, const char *str); + +/* The following definitions come from lib/sysacls.c */ + +int sys_acl_get_entry(SMB_ACL_T acl_d, int entry_id, SMB_ACL_ENTRY_T *entry_p); +int sys_acl_get_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *type_p); +int sys_acl_get_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); +void *sys_acl_get_qualifier(SMB_ACL_ENTRY_T entry_d); +int sys_acl_clear_perms(SMB_ACL_PERMSET_T permset_d); +int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm); +int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm); +char *sys_acl_to_text(SMB_ACL_T acl_d, ssize_t *len_p); +SMB_ACL_T sys_acl_init(int count); +int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p); +int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type); +int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p); +int sys_acl_set_permset(SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T permset_d); +int sys_acl_free_text(char *text); +int sys_acl_free_acl(SMB_ACL_T acl_d) ; +int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype); +int sys_acl_valid(SMB_ACL_T acl_d); +SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, + const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); +int sys_acl_set_file(vfs_handle_struct *handle, + const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); +int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, + SMB_ACL_T acl_d); +int sys_acl_delete_def_file(vfs_handle_struct *handle, + const char *path); +SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, + const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); +int sys_acl_set_file(vfs_handle_struct *handle, + const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); +int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, + SMB_ACL_T acl_d); +int sys_acl_delete_def_file(vfs_handle_struct *handle, + const char *path); +SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, + const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); +int sys_acl_set_file(vfs_handle_struct *handle, + const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); +int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, + SMB_ACL_T acl_d); +int sys_acl_delete_def_file(vfs_handle_struct *handle, + const char *path); +SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, + const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); +int sys_acl_set_file(vfs_handle_struct *handle, + const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); +int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, + SMB_ACL_T acl_d); +int sys_acl_delete_def_file(vfs_handle_struct *handle, + const char *path); +SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, + const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); +int sys_acl_set_file(vfs_handle_struct *handle, + const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); +int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, + SMB_ACL_T acl_d); +int sys_acl_delete_def_file(vfs_handle_struct *handle, + const char *path); +SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, + const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); +int sys_acl_set_file(vfs_handle_struct *handle, + const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); +int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, + SMB_ACL_T acl_d); +int sys_acl_delete_def_file(vfs_handle_struct *handle, + const char *path); +SMB_ACL_T sys_acl_get_file(vfs_handle_struct *handle, + const char *path_p, SMB_ACL_TYPE_T type); +SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp); +int sys_acl_set_file(vfs_handle_struct *handle, + const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d); +int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, + SMB_ACL_T acl_d); +int sys_acl_delete_def_file(vfs_handle_struct *handle, + const char *path); +int no_acl_syscall_error(int err); + +/* The following definitions come from lib/sysquotas.c */ + +int sys_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp); +int sys_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp); + +/* The following definitions come from lib/sysquotas_4A.c */ + +int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp); +int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp); + +/* The following definitions come from lib/sysquotas_linux.c */ + +int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp); +int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp); + +/* The following definitions come from lib/sysquotas_xfs.c */ + +int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp); +int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dp); + +/* The following definitions come from lib/system.c */ + +void *sys_memalign( size_t align, size_t size ); +int sys_usleep(long usecs); +ssize_t sys_read(int fd, void *buf, size_t count); +ssize_t sys_write(int fd, const void *buf, size_t count); +ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off); +ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off); +ssize_t sys_send(int s, const void *msg, size_t len, int flags); +ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); +ssize_t sys_recv(int fd, void *buf, size_t count, int flags); +ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); +int sys_fcntl_ptr(int fd, int cmd, void *arg); +int sys_fcntl_long(int fd, int cmd, long arg); +int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf); +int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf); +int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf); +int sys_ftruncate(int fd, SMB_OFF_T offset); +SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence); +int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence); +SMB_OFF_T sys_ftell(FILE *fp); +int sys_creat(const char *path, mode_t mode); +int sys_open(const char *path, int oflag, mode_t mode); +FILE *sys_fopen(const char *path, const char *type); +void kernel_flock(int fd, uint32 share_mode); +SMB_STRUCT_DIR *sys_opendir(const char *name); +SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp); +void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset); +long sys_telldir(SMB_STRUCT_DIR *dirp); +void sys_rewinddir(SMB_STRUCT_DIR *dirp); +int sys_closedir(SMB_STRUCT_DIR *dirp); +int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev); +char *sys_realpath(const char *path, char *resolved_path); +int sys_waitpid(pid_t pid,int *status,int options); +char *sys_getwd(char *s); +int sys_symlink(const char *oldpath, const char *newpath); +int sys_readlink(const char *path, char *buf, size_t bufsiz); +int sys_link(const char *oldpath, const char *newpath); +int sys_chown(const char *fname,uid_t uid,gid_t gid); +int sys_lchown(const char *fname,uid_t uid,gid_t gid); +int sys_chroot(const char *dname); +void set_effective_capability(enum smbd_capability capability); +void drop_effective_capability(enum smbd_capability capability); +long sys_random(void); +void sys_srandom(unsigned int seed); +int groups_max(void); +int sys_getgroups(int setlen, gid_t *gidset); +int sys_setgroups(gid_t UNUSED(primary_gid), int setlen, gid_t *gidset); +void sys_setpwent(void); +struct passwd *sys_getpwent(void); +void sys_endpwent(void); +struct passwd *sys_getpwnam(const char *name); +struct passwd *sys_getpwuid(uid_t uid); +struct group *sys_getgrnam(const char *name); +struct group *sys_getgrgid(gid_t gid); +pid_t sys_fork(void); +pid_t sys_getpid(void); +int sys_popen(const char *command); +int sys_pclose(int fd); +void *sys_dlopen(const char *name, int flags); +void *sys_dlsym(void *handle, const char *symbol); +int sys_dlclose (void *handle); +const char *sys_dlerror(void); +int sys_dup2(int oldfd, int newfd) ; +ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size); +ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size); +ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size); +ssize_t sys_listxattr (const char *path, char *list, size_t size); +ssize_t sys_llistxattr (const char *path, char *list, size_t size); +ssize_t sys_flistxattr (int filedes, char *list, size_t size); +int sys_removexattr (const char *path, const char *name); +int sys_lremovexattr (const char *path, const char *name); +int sys_fremovexattr (int filedes, const char *name); +int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags); +int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags); +int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags); +uint32 unix_dev_major(SMB_DEV_T dev); +uint32 unix_dev_minor(SMB_DEV_T dev); +int sys_aio_read(SMB_STRUCT_AIOCB *aiocb); +int sys_aio_write(SMB_STRUCT_AIOCB *aiocb); +ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb); +int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb); +int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb); +int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb); +int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout); +int sys_aio_read(SMB_STRUCT_AIOCB *aiocb); +int sys_aio_write(SMB_STRUCT_AIOCB *aiocb); +ssize_t sys_aio_return(SMB_STRUCT_AIOCB *aiocb); +int sys_aio_cancel(int fd, SMB_STRUCT_AIOCB *aiocb); +int sys_aio_error(const SMB_STRUCT_AIOCB *aiocb); +int sys_aio_fsync(int op, SMB_STRUCT_AIOCB *aiocb); +int sys_aio_suspend(const SMB_STRUCT_AIOCB * const cblist[], int n, const struct timespec *timeout); +int sys_getpeereid( int s, uid_t *uid); +int sys_getnameinfo(const struct sockaddr *psa, + socklen_t salen, + char *host, + size_t hostlen, + char *service, + size_t servlen, + int flags); +int sys_connect(int fd, const struct sockaddr * addr); + +/* The following definitions come from lib/system_smbd.c */ + +bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user, + gid_t primary_gid, + gid_t **ret_groups, size_t *p_ngroups); + +/* The following definitions come from lib/tallocmsg.c */ + +void register_msg_pool_usage(struct messaging_context *msg_ctx); + +/* The following definitions come from lib/time.c */ + +time_t get_time_t_max(void); +void GetTimeOfDay(struct timeval *tval); +time_t nt_time_to_unix(NTTIME nt); +void unix_to_nt_time(NTTIME *nt, time_t t); +bool null_time(time_t t); +bool null_nttime(NTTIME t); +bool null_timespec(struct timespec ts); +void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset); +void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset); +void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset); +time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset); +time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset); +time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset); +char *http_timestring(time_t t); +char *timestring(TALLOC_CTX *mem_ctx, time_t t); +const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt); +NTTIME nttime_from_string(const char *s); +int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2); +struct timeval timeval_zero(void); +bool timeval_is_zero(const struct timeval *tv); +struct timeval timeval_current(void); +struct timeval timeval_set(uint32_t secs, uint32_t usecs); +struct timeval timeval_add(const struct timeval *tv, + uint32_t secs, uint32_t usecs); +struct timeval timeval_sum(const struct timeval *tv1, + const struct timeval *tv2); +struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs); +int timeval_compare(const struct timeval *tv1, const struct timeval *tv2); +bool timeval_expired(const struct timeval *tv); +double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2); +double timeval_elapsed(const struct timeval *tv); +struct timeval timeval_min(const struct timeval *tv1, + const struct timeval *tv2); +struct timeval timeval_max(const struct timeval *tv1, + const struct timeval *tv2); +struct timeval timeval_until(const struct timeval *tv1, + const struct timeval *tv2); +NTTIME timeval_to_nttime(const struct timeval *tv); +uint32 convert_time_t_to_uint32(time_t t); +time_t convert_uint32_to_time_t(uint32 u); +int get_time_zone(time_t t); +bool nt_time_is_zero(const NTTIME *nt); +time_t generalized_to_unix_time(const char *str); +int get_server_zone_offset(void); +int set_server_zone_offset(time_t t); +char *current_timestring(TALLOC_CTX *ctx, bool hires); +void srv_put_dos_date(char *buf,int offset,time_t unixdate); +void srv_put_dos_date2(char *buf,int offset, time_t unixdate); +void srv_put_dos_date3(char *buf,int offset,time_t unixdate); +void put_long_date_timespec(char *p, struct timespec ts); +void put_long_date(char *p, time_t t); +struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs); +struct timespec get_atimespec(const SMB_STRUCT_STAT *pst); +void set_atimespec(SMB_STRUCT_STAT *pst, struct timespec ts); +struct timespec get_mtimespec(const SMB_STRUCT_STAT *pst); +void set_mtimespec(SMB_STRUCT_STAT *pst, struct timespec ts); +struct timespec get_ctimespec(const SMB_STRUCT_STAT *pst); +void set_ctimespec(SMB_STRUCT_STAT *pst, struct timespec ts); +void dos_filetime_timespec(struct timespec *tsp); +time_t srv_make_unix_date(const void *date_ptr); +time_t srv_make_unix_date2(const void *date_ptr); +time_t srv_make_unix_date3(const void *date_ptr); +time_t convert_timespec_to_time_t(struct timespec ts); +struct timespec convert_time_t_to_timespec(time_t t); +struct timespec convert_timeval_to_timespec(const struct timeval tv); +struct timeval convert_timespec_to_timeval(const struct timespec ts); +struct timespec timespec_current(void); +struct timespec timespec_min(const struct timespec *ts1, + const struct timespec *ts2); +int timespec_compare(const struct timespec *ts1, const struct timespec *ts2); +struct timespec interpret_long_date(const char *p); +void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate); +void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate); +void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate); +time_t cli_make_unix_date(struct cli_state *cli, const void *date_ptr); +time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr); +time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr); +struct timespec nt_time_to_unix_timespec(NTTIME *nt); +bool nt_time_equals(const NTTIME *nt1, const NTTIME *nt2); +void TimeInit(void); +void get_process_uptime(struct timeval *ret_time); +time_t nt_time_to_unix_abs(const NTTIME *nt); +time_t uint64s_nt_time_to_unix_abs(const uint64_t *src); +void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts); +void unix_to_nt_time_abs(NTTIME *nt, time_t t); +bool null_mtime(time_t mtime); +const char *time_to_asc(const time_t t); +const char *display_time(NTTIME nttime); +bool nt_time_is_set(const NTTIME *nt); + +/* The following definitions come from lib/ufc.c */ + +char *ufc_crypt(const char *key,const char *salt); + +/* The following definitions come from lib/username.c */ + +char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user); +struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user); + +/* The following definitions come from lib/util.c */ + +bool set_global_myname(const char *myname); +const char *global_myname(void); +bool set_global_myworkgroup(const char *myworkgroup); +const char *lp_workgroup(void); +bool set_global_scope(const char *scope); +const char *global_scope(void); +void gfree_names(void); +void gfree_all( void ); +const char *my_netbios_names(int i); +bool set_netbios_aliases(const char **str_array); +bool init_names(void); +const char *get_cmdline_auth_info_username(void); +void set_cmdline_auth_info_username(const char *username); +const char *get_cmdline_auth_info_password(void); +void set_cmdline_auth_info_password(const char *password); +bool set_cmdline_auth_info_signing_state(const char *arg); +int get_cmdline_auth_info_signing_state(void); +void set_cmdline_auth_info_use_kerberos(bool b); +bool get_cmdline_auth_info_use_kerberos(void); +void set_cmdline_auth_info_use_krb5_ticket(void); +void set_cmdline_auth_info_smb_encrypt(void); +void set_cmdline_auth_info_use_machine_account(void); +bool get_cmdline_auth_info_got_pass(void); +bool get_cmdline_auth_info_smb_encrypt(void); +bool get_cmdline_auth_info_use_machine_account(void); +bool get_cmdline_auth_info_copy(struct user_auth_info *info); +bool set_cmdline_auth_info_machine_account_creds(void); +const char *tmpdir(void); +bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid, + gid_t **gids, size_t *num_gids); +const char *get_numlist(const char *p, uint32 **num, int *count); +bool file_exist(const char *fname,SMB_STRUCT_STAT *sbuf); +bool socket_exist(const char *fname); +time_t file_modtime(const char *fname); +bool directory_exist(char *dname,SMB_STRUCT_STAT *st); +SMB_OFF_T get_file_size(char *file_name); +char *attrib_string(uint16 mode); +void show_msg(char *buf); +void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num); +void smb_setlen(char *buf,int len); +int set_message_bcc(char *buf,int num_bytes); +ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob); +char *unix_clean_name(TALLOC_CTX *ctx, const char *s); +char *clean_name(TALLOC_CTX *ctx, const char *s); +void close_low_fds(bool stderr_too); +ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos); +int set_blocking(int fd, bool set); +void smb_msleep(unsigned int t); +void become_daemon(bool Fork, bool no_process_group); +bool reinit_after_fork(struct messaging_context *msg_ctx, + bool parent_longlived); +bool yesno(const char *p); +void *malloc_(size_t size); +void *malloc_array(size_t el_size, unsigned int count); +void *memalign_array(size_t el_size, size_t align, unsigned int count); +void *calloc_array(size_t size, size_t nmemb); +void *Realloc(void *p, size_t size, bool free_old_on_error); +void *realloc_array(void *p, size_t el_size, unsigned int count, bool free_old_on_error); +void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size, + void *element, void *_array, uint32 *num_elements, + ssize_t *array_size); +void safe_free(void *p); +char *get_myname(TALLOC_CTX *ctx); +char *get_mydnsdomname(TALLOC_CTX *ctx); +int interpret_protocol(const char *str,int def); +char *automount_lookup(TALLOC_CTX *ctx, const char *user_name); +char *automount_lookup(TALLOC_CTX *ctx, const char *user_name); +bool process_exists(const struct server_id pid); +bool process_exists_by_pid(pid_t pid); +const char *uidtoname(uid_t uid); +char *gidtoname(gid_t gid); +uid_t nametouid(const char *name); +gid_t nametogid(const char *name); +void smb_panic(const char *const why); +void log_stack_trace(void); +const char *readdirname(SMB_STRUCT_DIR *p); +bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive); +void set_namearray(name_compare_entry **ppname_array, const char *namelist); +void free_namearray(name_compare_entry *name_array); +bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); +bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); +bool is_myname(const char *s); +bool is_myworkgroup(const char *s); +void ra_lanman_string( const char *native_lanman ); +const char *get_remote_arch_str(void); +void set_remote_arch(enum remote_arch_types type); +enum remote_arch_types get_remote_arch(void); +void print_asc(int level, const unsigned char *buf,int len); +void dump_data(int level, const unsigned char *buf1,int len); +void dump_data_pw(const char *msg, const uchar * data, size_t len); +const char *tab_depth(int level, int depth); +int str_checksum(const char *s); +void zero_free(void *p, size_t size); +int set_maxfiles(int requested_max); +int smb_mkstemp(char *name_template); +void *smb_xmalloc_array(size_t size, unsigned int count); +void *smb_xmemdup(const void *p, size_t size); +char *smb_xstrdup(const char *s); +char *smb_xstrndup(const char *s, size_t n); +void *memdup(const void *p, size_t size); +char *myhostname(void); +char *lock_path(const char *name); +char *pid_path(const char *name); +char *lib_path(const char *name); +char *modules_path(const char *name); +char *data_path(const char *name); +char *state_path(const char *name); +const char *shlib_ext(void); +char *parent_dirname(const char *path); +bool parent_dirname_talloc(TALLOC_CTX *mem_ctx, const char *dir, + char **parent, const char **name); +bool ms_has_wild(const char *s); +bool ms_has_wild_w(const smb_ucs2_t *s); +bool mask_match(const char *string, const char *pattern, bool is_case_sensitive); +bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive); +bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive); +bool unix_wild_match(const char *pattern, const char *string); +bool name_to_fqdn(fstring fqdn, const char *name); +void *talloc_check_name_abort(const void *ptr, const char *name); +void *talloc_append_blob(TALLOC_CTX *mem_ctx, void *buf, DATA_BLOB blob); +uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options); +pid_t procid_to_pid(const struct server_id *proc); +void set_my_vnn(uint32 vnn); +uint32 get_my_vnn(void); +struct server_id pid_to_procid(pid_t pid); +struct server_id procid_self(void); +struct server_id server_id_self(void); +bool procid_equal(const struct server_id *p1, const struct server_id *p2); +bool cluster_id_equal(const struct server_id *id1, + const struct server_id *id2); +bool procid_is_me(const struct server_id *pid); +struct server_id interpret_pid(const char *pid_string); +char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid); +char *procid_str_static(const struct server_id *pid); +bool procid_valid(const struct server_id *pid); +bool procid_is_local(const struct server_id *pid); +int this_is_smp(void); +bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off); +char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off); +char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off); +int get_safe_SVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval); +int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, int failval); +void split_domain_user(TALLOC_CTX *mem_ctx, + const char *full_name, + char **domain, + char **user); +void *_talloc_zero_zeronull(const void *ctx, size_t size, const char *name); +void *_talloc_memdup_zeronull(const void *t, const void *p, size_t size, const char *name); +void *_talloc_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name); +void *_talloc_zero_array_zeronull(const void *ctx, size_t el_size, unsigned count, const char *name); +void *talloc_zeronull(const void *context, size_t size, const char *name); +NTSTATUS split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname, + char **pbase, char **pstream); +bool is_valid_policy_hnd(const POLICY_HND *hnd); +bool policy_hnd_equal(const struct policy_handle *hnd1, + const struct policy_handle *hnd2); +const char *strip_hostname(const char *s); + +/* The following definitions come from lib/util_file.c */ + +char *fgets_slash(char *s2,int maxlen,XFILE *f); +char *fd_load(int fd, size_t *psize, size_t maxsize); +char *file_load(const char *fname, size_t *size, size_t maxsize); +bool unmap_file(void* start, size_t size); +void *map_file(char *fname, size_t size); +char **file_lines_load(const char *fname, int *numlines, size_t maxsize); +char **fd_lines_load(int fd, int *numlines, size_t maxsize); +char **file_lines_pload(char *syscmd, int *numlines); +void file_lines_free(char **lines); +void file_lines_slashcont(char **lines); +bool file_save(const char *fname, void *packet, size_t length); + +/* The following definitions come from lib/util_nscd.c */ + +void smb_nscd_flush_user_cache(void); +void smb_nscd_flush_group_cache(void); + +/* The following definitions come from lib/util_nttoken.c */ + +NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, const NT_USER_TOKEN *ptoken); +NTSTATUS merge_nt_token(TALLOC_CTX *mem_ctx, + const struct nt_user_token *token_1, + const struct nt_user_token *token_2, + struct nt_user_token **token_out); + +/* The following definitions come from lib/util_pw.c */ + +struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, const struct passwd *from) ; +void flush_pwnam_cache(void); +struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name); +struct passwd *getpwuid_alloc(TALLOC_CTX *mem_ctx, uid_t uid) ; + +/* The following definitions come from lib/util_reg.c */ + +const char *reg_type_lookup(enum winreg_Type type); +WERROR reg_pull_multi_sz(TALLOC_CTX *mem_ctx, const void *buf, size_t len, + uint32 *num_values, char ***values); + +/* The following definitions come from lib/util_reg_api.c */ + +WERROR registry_pull_value(TALLOC_CTX *mem_ctx, + struct registry_value **pvalue, + enum winreg_Type type, uint8 *data, + uint32 size, uint32 length); +WERROR registry_push_value(TALLOC_CTX *mem_ctx, + const struct registry_value *value, + DATA_BLOB *presult); + +/* The following definitions come from lib/util_seaccess.c */ + +void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping); +void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping); +bool se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token, + uint32 acc_desired, uint32 *acc_granted, + NTSTATUS *status); +NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size); + +/* The following definitions come from lib/util_sec.c */ + +void sec_init(void); +uid_t sec_initial_uid(void); +gid_t sec_initial_gid(void); +bool non_root_mode(void); +void gain_root_privilege(void); +void gain_root_group_privilege(void); +void set_effective_uid(uid_t uid); +void set_effective_gid(gid_t gid); +void save_re_uid(void); +void restore_re_uid_fromroot(void); +void restore_re_uid(void); +void save_re_gid(void); +void restore_re_gid(void); +int set_re_uid(void); +void become_user_permanently(uid_t uid, gid_t gid); +bool is_setuid_root(void) ; + +/* The following definitions come from lib/util_sid.c */ + +const char *sid_type_lookup(uint32 sid_type) ; +NT_USER_TOKEN *get_system_token(void) ; +const char *get_global_sam_name(void) ; +char *sid_to_fstring(fstring sidstr_out, const DOM_SID *sid); +char *sid_string_talloc(TALLOC_CTX *mem_ctx, const DOM_SID *sid); +char *sid_string_dbg(const DOM_SID *sid); +char *sid_string_tos(const DOM_SID *sid); +bool string_to_sid(DOM_SID *sidout, const char *sidstr); +DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr); +bool sid_append_rid(DOM_SID *sid, uint32 rid); +bool sid_compose(DOM_SID *dst, const DOM_SID *domain_sid, uint32 rid); +bool sid_split_rid(DOM_SID *sid, uint32 *rid); +bool sid_peek_rid(const DOM_SID *sid, uint32 *rid); +bool sid_peek_check_rid(const DOM_SID *exp_dom_sid, const DOM_SID *sid, uint32 *rid); +void sid_copy(DOM_SID *dst, const DOM_SID *src); +bool sid_linearize(char *outbuf, size_t len, const DOM_SID *sid); +bool sid_parse(const char *inbuf, size_t len, DOM_SID *sid); +int sid_compare(const DOM_SID *sid1, const DOM_SID *sid2); +int sid_compare_domain(const DOM_SID *sid1, const DOM_SID *sid2); +bool sid_equal(const DOM_SID *sid1, const DOM_SID *sid2); +bool non_mappable_sid(DOM_SID *sid); +char *sid_binstring(const DOM_SID *sid); +char *sid_binstring_hex(const DOM_SID *sid); +DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src); +NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + DOM_SID **sids, size_t *num); +NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + DOM_SID **sids, size_t *num_sids); +void del_sid_from_array(const DOM_SID *sid, DOM_SID **sids, size_t *num); +bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx, + uint32 rid, uint32 **pp_rids, size_t *p_num); +bool is_null_sid(const DOM_SID *sid); +NTSTATUS sid_array_from_info3(TALLOC_CTX *mem_ctx, + const struct netr_SamInfo3 *info3, + DOM_SID **user_sids, + size_t *num_user_sids, + bool include_user_group_rid, + bool skip_ressource_groups); + +/* The following definitions come from lib/util_sock.c */ + +bool is_ipaddress_v4(const char *str); +bool is_ipaddress(const char *str); +bool is_broadcast_addr(const struct sockaddr_storage *pss); +uint32 interpret_addr(const char *str); +struct in_addr *interpret_addr2(struct in_addr *ip, const char *str); +bool interpret_string_addr(struct sockaddr_storage *pss, + const char *str, + int flags); +bool is_loopback_ip_v4(struct in_addr ip); +bool is_loopback_addr(const struct sockaddr_storage *pss); +bool is_zero_ip_v4(struct in_addr ip); +bool is_zero_addr(const struct sockaddr_storage *pss); +void zero_ip_v4(struct in_addr *ip); +void zero_addr(struct sockaddr_storage *pss); +bool same_net_v4(struct in_addr ip1,struct in_addr ip2,struct in_addr mask); +void in_addr_to_sockaddr_storage(struct sockaddr_storage *ss, + struct in_addr ip); +bool same_net(const struct sockaddr_storage *ip1, + const struct sockaddr_storage *ip2, + const struct sockaddr_storage *mask); +bool addr_equal(const struct sockaddr_storage *ip1, + const struct sockaddr_storage *ip2); +bool is_address_any(const struct sockaddr_storage *psa); +uint16_t get_sockaddr_port(const struct sockaddr_storage *pss); +char *print_sockaddr(char *dest, + size_t destlen, + const struct sockaddr_storage *psa); +char *print_canonical_sockaddr(TALLOC_CTX *ctx, + const struct sockaddr_storage *pss); +void set_sockaddr_port(struct sockaddr_storage *psa, uint16 port); +const char *client_name(int fd); +const char *client_addr(int fd, char *addr, size_t addrlen); +const char *client_socket_addr(int fd, char *addr, size_t addr_len); +int client_socket_port(int fd); +void set_smb_read_error(enum smb_read_errors *pre, + enum smb_read_errors newerr); +void cond_set_smb_read_error(enum smb_read_errors *pre, + enum smb_read_errors newerr); +bool is_a_socket(int fd); +void set_socket_options(int fd, const char *options); +ssize_t read_udp_v4_socket(int fd, + char *buf, + size_t len, + struct sockaddr_storage *psa); +NTSTATUS read_socket_with_timeout(int fd, char *buf, + size_t mincnt, size_t maxcnt, + unsigned int time_out, + size_t *size_ret); +NTSTATUS read_data(int fd, char *buffer, size_t N); +ssize_t write_data(int fd, const char *buffer, size_t N); +bool send_keepalive(int client); +NTSTATUS read_smb_length_return_keepalive(int fd, char *inbuf, + unsigned int timeout, + size_t *len); +NTSTATUS read_smb_length(int fd, char *inbuf, unsigned int timeout, + size_t *len); +NTSTATUS receive_smb_raw(int fd, + char *buffer, + size_t buflen, + unsigned int timeout, + size_t maxlen, + size_t *p_len); +int open_socket_in(int type, + uint16_t port, + int dlevel, + const struct sockaddr_storage *psock, + bool rebind); +int open_socket_out(int type, + const struct sockaddr_storage *pss, + uint16_t port, + int timeout); +bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs, + int timeout, int *fd_index, int *fd); +int open_udp_socket(const char *host, int port); +const char *get_peer_name(int fd, bool force_lookup); +const char *get_peer_addr(int fd, char *addr, size_t addr_len); +int create_pipe_sock(const char *socket_dir, + const char *socket_name, + mode_t dir_perms); +const char *get_mydnsfullname(void); +bool is_myname_or_ipaddr(const char *s); + +/* The following definitions come from lib/util_str.c */ + +bool next_token(const char **ptr, char *buff, const char *sep, size_t bufsize); +bool next_token_talloc(TALLOC_CTX *ctx, + const char **ptr, + char **pp_buff, + const char *sep); +bool next_token_no_ltrim_talloc(TALLOC_CTX *ctx, + const char **ptr, + char **pp_buff, + const char *sep); +int StrCaseCmp(const char *s, const char *t); +int StrnCaseCmp(const char *s, const char *t, size_t len); +bool strequal(const char *s1, const char *s2); +bool strnequal(const char *s1,const char *s2,size_t n); +bool strcsequal(const char *s1,const char *s2); +int strwicmp(const char *psz1, const char *psz2); +void strnorm(char *s, int case_default); +bool strisnormal(const char *s, int case_default); +void string_replace( char *s, char oldc, char newc ); +char *push_skip_string(char *buf); +char *skip_string(const char *base, size_t len, char *buf); +size_t str_charnum(const char *s); +size_t str_ascii_charnum(const char *s); +bool trim_char(char *s,char cfront,char cback); +bool trim_string(char *s,const char *front,const char *back); +bool strhasupper(const char *s); +bool strhaslower(const char *s); +size_t count_chars(const char *s,char c); +char *safe_strcpy_fn(const char *fn, + int line, + char *dest, + const char *src, + size_t maxlength); +char *safe_strcat_fn(const char *fn, + int line, + char *dest, + const char *src, + size_t maxlength); +char *alpha_strcpy_fn(const char *fn, + int line, + char *dest, + const char *src, + const char *other_safe_chars, + size_t maxlength); +char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n); +size_t strhex_to_str(char *buf, size_t buf_len, const char *strhex, size_t strhex_len); +DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex); +char *hex_encode(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len); +bool in_list(const char *s, const char *list, bool casesensitive); +void string_free(char **s); +bool string_set(char **dest,const char *src); +void string_sub2(char *s,const char *pattern, const char *insert, size_t len, + bool remove_unsafe_characters, bool replace_once, + bool allow_trailing_dollar); +void string_sub_once(char *s, const char *pattern, + const char *insert, size_t len); +void string_sub(char *s,const char *pattern, const char *insert, size_t len); +void fstring_sub(char *s,const char *pattern,const char *insert); +char *realloc_string_sub2(char *string, + const char *pattern, + const char *insert, + bool remove_unsafe_characters, + bool allow_trailing_dollar); +char *realloc_string_sub(char *string, + const char *pattern, + const char *insert); +char *talloc_string_sub2(TALLOC_CTX *mem_ctx, const char *src, + const char *pattern, + const char *insert, + bool remove_unsafe_characters, + bool replace_once, + bool allow_trailing_dollar); +char *talloc_string_sub(TALLOC_CTX *mem_ctx, + const char *src, + const char *pattern, + const char *insert); +void all_string_sub(char *s,const char *pattern,const char *insert, size_t len); +char *talloc_all_string_sub(TALLOC_CTX *ctx, + const char *src, + const char *pattern, + const char *insert); +char *octal_string(int i); +char *string_truncate(char *s, unsigned int length); +char *strchr_m(const char *src, char c); +char *strrchr_m(const char *s, char c); +char *strnrchr_m(const char *s, char c, unsigned int n); +char *strstr_m(const char *src, const char *findstr); +void strlower_m(char *s); +void strupper_m(char *s); +size_t strlen_m(const char *s); +size_t strlen_m_term(const char *s); +size_t strlen_m_term_null(const char *s); +char *binary_string_rfc2254(char *buf, int len); +char *binary_string(char *buf, int len); +int fstr_sprintf(fstring s, const char *fmt, ...); +char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep); +bool str_list_copy(TALLOC_CTX *mem_ctx, char ***dest, const char **src); +bool str_list_compare(char **list1, char **list2); +int str_list_count( const char **list ); +bool str_list_sub_basic( char **list, const char *smb_name, + const char *domain_name ); +bool str_list_substitute(char **list, const char *pattern, const char *insert); +char *ipstr_list_make(char **ipstr_list, + const struct ip_service *ip_list, + int ip_count); +int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list); +void ipstr_list_free(char* ipstr_list); +void rfc1738_unescape(char *buf); +DATA_BLOB base64_decode_data_blob(const char *s); +void base64_decode_inplace(char *s); +char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data); +SMB_BIG_UINT STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr); +SMB_OFF_T conv_str_size(const char * str); +void string_append(char **left, const char *right); +bool add_string_to_array(TALLOC_CTX *mem_ctx, + const char *str, const char ***strings, + int *num); +void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len, + size_t *bufsize, const char *fmt, ...); +int asprintf_strupper_m(char **strp, const char *fmt, ...); +char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...); +char *talloc_asprintf_strlower_m(TALLOC_CTX *t, const char *fmt, ...); +char *sstring_sub(const char *src, char front, char back); +bool validate_net_name( const char *name, + const char *invalid_chars, + int max_len); +size_t ascii_len_n(const char *src, size_t n); +size_t utf16_len(const void *buf); +size_t utf16_len_n(const void *src, size_t n); +char *escape_shell_string(const char *src); + +/* The following definitions come from lib/util_unistr.c */ + +void gfree_case_tables(void); +void load_case_tables(void); +void init_valid_table(void); +size_t dos_PutUniCode(char *dst,const char *src, size_t len, bool null_terminate); +char *skip_unibuf(char *src, size_t len); +int rpcstr_pull(char* dest, void *src, int dest_len, int src_len, int flags); +int rpcstr_pull_talloc(TALLOC_CTX *ctx, + char **dest, + void *src, + int src_len, + int flags); +int rpcstr_pull_unistr2_fstring(char *dest, UNISTR2 *src); +char *rpcstr_pull_unistr2_talloc(TALLOC_CTX *ctx, const UNISTR2 *src); +int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags); +int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src); +void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen); +void unistr3_to_ascii(char *dest, const UNISTR3 *str, size_t maxlen); +char *unistr2_to_ascii_talloc(TALLOC_CTX *ctx, const UNISTR2 *str); +const char *unistr2_static(const UNISTR2 *str); +smb_ucs2_t toupper_w(smb_ucs2_t val); +smb_ucs2_t tolower_w( smb_ucs2_t val ); +bool islower_w(smb_ucs2_t c); +bool isupper_w(smb_ucs2_t c); +bool isvalid83_w(smb_ucs2_t c); +size_t strlen_w(const smb_ucs2_t *src); +size_t strnlen_w(const smb_ucs2_t *src, size_t max); +smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c); +smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c); +smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c); +smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n); +smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins); +bool strlower_w(smb_ucs2_t *s); +bool strupper_w(smb_ucs2_t *s); +void strnorm_w(smb_ucs2_t *s, int case_default); +int strcmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b); +int strncmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len); +int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b); +int strncasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len); +bool strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2); +bool strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n); +smb_ucs2_t *strdup_w(const smb_ucs2_t *src); +smb_ucs2_t *strndup_w(const smb_ucs2_t *src, size_t len); +smb_ucs2_t *strncpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max); +smb_ucs2_t *strncat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max); +smb_ucs2_t *strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src); +void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc); +bool trim_string_w(smb_ucs2_t *s, const smb_ucs2_t *front, + const smb_ucs2_t *back); +int strcmp_wa(const smb_ucs2_t *a, const char *b); +int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len); +smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p); +smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins); +int unistrlen(uint16 *s); +int unistrcpy(uint16 *dst, uint16 *src); +UNISTR2* ucs2_to_unistr2(TALLOC_CTX *ctx, UNISTR2* dst, smb_ucs2_t* src); +int toupper_ascii(int c); +int tolower_ascii(int c); +int isupper_ascii(int c); +int islower_ascii(int c); + +/* The following definitions come from lib/util_uuid.c */ + +void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr); +void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu); +void smb_uuid_generate_random(struct GUID *uu); +const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu); +bool smb_string_to_uuid(const char *in, struct GUID* uu); +char *guid_binstring(const struct GUID *guid); + +/* The following definitions come from lib/version.c */ + +const char *samba_version_string(void); + +/* The following definitions come from lib/winbind_util.c */ + +bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, + enum lsa_SidType *name_type); +bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + const char **domain, const char **name, + enum lsa_SidType *name_type); +bool winbind_ping(void); +bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid); +bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid); +bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid); +bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid); +wbcErr wb_is_trusted_domain(const char *domain); +bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + int num_rids, uint32 *rids, + const char **domain_name, + const char ***names, enum lsa_SidType **types); +bool winbind_allocate_uid(uid_t *uid); +bool winbind_allocate_gid(gid_t *gid); +bool winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, + enum lsa_SidType *name_type); +bool winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + const char **domain, const char **name, + enum lsa_SidType *name_type); +bool winbind_ping(void); +bool winbind_sid_to_uid(uid_t *puid, const DOM_SID *sid); +bool winbind_uid_to_sid(DOM_SID *sid, uid_t uid); +bool winbind_sid_to_gid(gid_t *pgid, const DOM_SID *sid); +bool winbind_gid_to_sid(DOM_SID *sid, gid_t gid); +wbcErr wb_is_trusted_domain(const char *domain); +bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + int num_rids, uint32 *rids, + const char **domain_name, + const char ***names, enum lsa_SidType **types); +bool winbind_allocate_uid(uid_t *uid); +bool winbind_allocate_gid(gid_t *gid); + +/* The following definitions come from lib/wins_srv.c */ + +bool wins_srv_is_dead(struct in_addr wins_ip, struct in_addr src_ip); +void wins_srv_alive(struct in_addr wins_ip, struct in_addr src_ip); +void wins_srv_died(struct in_addr wins_ip, struct in_addr src_ip); +unsigned wins_srv_count(void); +char **wins_srv_tags(void); +void wins_srv_tags_free(char **list); +struct in_addr wins_srv_ip_tag(const char *tag, struct in_addr src_ip); +unsigned wins_srv_count_tag(const char *tag); + +/* The following definitions come from lib/xfile.c */ + +int x_setvbuf(XFILE *f, char *buf, int mode, size_t size); +XFILE *x_fopen(const char *fname, int flags, mode_t mode); +XFILE *x_fdup(const XFILE *f); +int x_fclose(XFILE *f); +size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f); +int x_fileno(const XFILE *f); +int x_fflush(XFILE *f); +void x_setbuffer(XFILE *f, char *buf, size_t size); +void x_setbuf(XFILE *f, char *buf); +void x_setlinebuf(XFILE *f); +int x_feof(XFILE *f); +int x_ferror(XFILE *f); +int x_fgetc(XFILE *f); +size_t x_fread(void *p, size_t size, size_t nmemb, XFILE *f); +char *x_fgets(char *s, int size, XFILE *stream) ; +off_t x_tseek(XFILE *f, off_t offset, int whence); + +/* The following definitions come from libads/ads_status.c */ + +ADS_STATUS ads_build_error(enum ads_error_type etype, + int rc, int minor_status); +ADS_STATUS ads_build_nt_error(enum ads_error_type etype, + NTSTATUS nt_status); +NTSTATUS ads_ntstatus(ADS_STATUS status); +const char *ads_errstr(ADS_STATUS status); +NTSTATUS gss_err_to_ntstatus(uint32 maj, uint32 min); + +/* The following definitions come from libads/ads_struct.c */ + +char *ads_build_path(const char *realm, const char *sep, const char *field, int reverse); +char *ads_build_dn(const char *realm); +char *ads_build_domain(const char *dn); +ADS_STRUCT *ads_init(const char *realm, + const char *workgroup, + const char *ldap_server); +void ads_destroy(ADS_STRUCT **ads); + +/* The following definitions come from libads/ads_utils.c */ + +uint32 ads_acb2uf(uint32 acb); +uint32 ads_uf2acb(uint32 uf); +uint32 ads_uf2atype(uint32 uf); +uint32 ads_gtype2atype(uint32 gtype); +enum lsa_SidType ads_atype_map(uint32 atype); + +/* The following definitions come from libads/authdata.c */ + +struct PAC_LOGON_INFO *get_logon_info_from_pac(struct PAC_DATA *pac_data); +NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx, + const char *name, + const char *pass, + time_t time_offset, + time_t *expire_time, + time_t *renew_till_time, + const char *cache_name, + bool request_pac, + bool add_netbios_addr, + time_t renewable_time, + struct PAC_DATA **pac_ret); +NTSTATUS kerberos_return_info3_from_pac(TALLOC_CTX *mem_ctx, + const char *name, + const char *pass, + time_t time_offset, + time_t *expire_time, + time_t *renew_till_time, + const char *cache_name, + bool request_pac, + bool add_netbios_addr, + time_t renewable_time, + struct netr_SamInfo3 **info3); + +/* The following definitions come from libads/cldap.c */ + +bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx, + const char *server, + const char *realm, + uint32_t *nt_version, + union nbt_cldap_netlogon **reply); +bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx, + const char *server, + const char *realm, + struct nbt_cldap_netlogon_5 *reply5); +bool pull_mailslot_cldap_reply(TALLOC_CTX *mem_ctx, + const DATA_BLOB *blob, + union nbt_cldap_netlogon *r, + uint32_t *nt_version); + +/* The following definitions come from libads/disp_sec.c */ + +void ads_disp_sd(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, SEC_DESC *sd); + +/* The following definitions come from libads/dns.c */ + +NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx, + const char *dnsdomain, + struct dns_rr_ns **nslist, + int *numns); +bool sitename_store(const char *realm, const char *sitename); +char *sitename_fetch(const char *realm); +bool stored_sitename_changed(const char *realm, const char *sitename); +NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx, + const char *realm, + const char *sitename, + struct dns_rr_srv **dclist, + int *numdcs ); +NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx, + const char *realm, + const char *sitename, + struct dns_rr_srv **dclist, + int *numdcs ); +NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx, + const char *dns_forest_name, + const char *sitename, + struct dns_rr_srv **dclist, + int *numdcs ); +NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx, + const char *dns_domain_name, + struct dns_rr_srv **dclist, + int *numdcs ); +NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx, + const char *dns_forest_name, + const struct GUID *domain_guid, + struct dns_rr_srv **dclist, + int *numdcs ); + +/* The following definitions come from libads/kerberos.c */ + +int kerberos_kinit_password_ext(const char *principal, + const char *password, + int time_offset, + time_t *expire_time, + time_t *renew_till_time, + const char *cache_name, + bool request_pac, + bool add_netbios_addr, + time_t renewable_time, + NTSTATUS *ntstatus); +int ads_kinit_password(ADS_STRUCT *ads); +int ads_kdestroy(const char *cc_name); +char* kerberos_standard_des_salt( void ); +bool kerberos_secrets_store_des_salt( const char* salt ); +char* kerberos_secrets_fetch_des_salt( void ); +char *kerberos_get_default_realm_from_ccache( void ); +bool kerberos_secrets_store_salting_principal(const char *service, + int enctype, + const char *principal); +int kerberos_kinit_password(const char *principal, + const char *password, + int time_offset, + const char *cache_name); +bool create_local_private_krb5_conf_for_domain(const char *realm, + const char *domain, + const char *sitename, + struct sockaddr_storage *pss); + +/* The following definitions come from libads/kerberos_keytab.c */ + +int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc); +int ads_keytab_flush(ADS_STRUCT *ads); +int ads_keytab_create_default(ADS_STRUCT *ads); +int ads_keytab_list(const char *keytab_name); + +/* The following definitions come from libads/kerberos_verify.c */ + +NTSTATUS ads_verify_ticket(TALLOC_CTX *mem_ctx, + const char *realm, + time_t time_offset, + const DATA_BLOB *ticket, + char **principal, + struct PAC_DATA **pac_data, + DATA_BLOB *ap_rep, + DATA_BLOB *session_key, + bool use_replay_cache); + +/* The following definitions come from libads/krb5_errs.c */ + + +/* The following definitions come from libads/krb5_setpw.c */ + +ADS_STATUS ads_krb5_set_password(const char *kdc_host, const char *princ, + const char *newpw, int time_offset); +ADS_STATUS kerberos_set_password(const char *kpasswd_server, + const char *auth_principal, const char *auth_password, + const char *target_principal, const char *new_password, + int time_offset); +ADS_STATUS ads_set_machine_password(ADS_STRUCT *ads, + const char *machine_account, + const char *password); + +/* The following definitions come from libads/ldap.c */ + +bool ads_sitename_match(ADS_STRUCT *ads); +bool ads_closest_dc(ADS_STRUCT *ads); +ADS_STATUS ads_connect(ADS_STRUCT *ads); +ADS_STATUS ads_connect_user_creds(ADS_STRUCT *ads); +ADS_STATUS ads_connect_gc(ADS_STRUCT *ads); +void ads_disconnect(ADS_STRUCT *ads); +ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path, + int scope, const char *expr, const char **attrs, + bool (*fn)(ADS_STRUCT *, char *, void **, void *), + void *data_area); +void ads_memfree(ADS_STRUCT *ads, void *mem); +char *ads_parent_dn(const char *dn); +ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx); +ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods, + const char *name, const char *val); +ADS_STATUS ads_mod_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods, + const char *name, const char **vals); +ADS_STATUS ads_gen_mod(ADS_STRUCT *ads, const char *mod_dn, ADS_MODLIST mods); +ADS_STATUS ads_gen_add(ADS_STRUCT *ads, const char *new_dn, ADS_MODLIST mods); +ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn); +char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit); +char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid); +ADS_STATUS ads_add_strlist(TALLOC_CTX *ctx, ADS_MODLIST *mods, + const char *name, const char **vals); +uint32 ads_get_kvno(ADS_STRUCT *ads, const char *account_name); +uint32_t ads_get_machine_kvno(ADS_STRUCT *ads, const char *machine_name); +ADS_STATUS ads_clear_service_principal_names(ADS_STRUCT *ads, const char *machine_name); +ADS_STATUS ads_add_service_principal_name(ADS_STRUCT *ads, const char *machine_name, + const char *my_fqdn, const char *spn); +ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads, const char *machine_name, + const char *org_unit); +ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name, + const char *org_unit, bool *moved); +int ads_count_replies(ADS_STRUCT *ads, void *res); +ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn); +ADS_STATUS ads_current_time(ADS_STRUCT *ads); +ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val); +ADS_STATUS ads_domain_sid(ADS_STRUCT *ads, DOM_SID *sid); +ADS_STATUS ads_site_dn(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char **site_name); +ADS_STATUS ads_site_dn_for_machine(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const char *computer_name, const char **site_dn); +ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char ***suffixes, size_t *num_suffixes); +ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + char ***ous, + size_t *num_ous); +bool ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx, + const char *extended_dn, + enum ads_extended_dn_flags flags, + DOM_SID *sid); +char* ads_get_dnshostname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name ); +char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name ); +char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name ); +ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name, + uint32 account_type, const char *org_unit); +ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname); +ADS_STATUS ads_find_samaccount(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *samaccountname, + uint32 *uac_ret, + const char **dn_ret); +ADS_STATUS ads_config_path(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + char **config_path); +const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads, + const char *config_path, + TALLOC_CTX *mem_ctx, + const struct GUID *rights_guid); +ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx, + ADS_STRUCT *ads, + const char **account_ou); + +/* The following definitions come from libads/ldap_printer.c */ + +ADS_STATUS ads_mod_printer_entry(ADS_STRUCT *ads, char *prt_dn, + TALLOC_CTX *ctx, const ADS_MODLIST *mods); +ADS_STATUS ads_add_printer_entry(ADS_STRUCT *ads, char *prt_dn, + TALLOC_CTX *ctx, ADS_MODLIST *mods); +WERROR get_remote_printer_publishing_data(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + ADS_MODLIST *mods, + const char *printer); +bool get_local_printer_publishing_data(TALLOC_CTX *mem_ctx, + ADS_MODLIST *mods, + NT_PRINTER_DATA *data); + +/* The following definitions come from libads/ldap_schema.c */ + +ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, + const char *schema_path, + const char **OIDs, size_t num_OIDs, + char ***OIDs_out, char ***names, size_t *count); +const char *ads_get_attrname_by_guid(ADS_STRUCT *ads, + const char *schema_path, + TALLOC_CTX *mem_ctx, + const struct GUID *schema_guid); +const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, const char *schema_path, TALLOC_CTX *mem_ctx, const char * OID); +ADS_STATUS ads_schema_path(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, char **schema_path); +ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx, + ADS_STRUCT *ads, + enum wb_posix_mapping map_type, + struct posix_schema **s ) ; + +/* The following definitions come from libads/ldap_user.c */ + +ADS_STATUS ads_add_user_acct(ADS_STRUCT *ads, const char *user, + const char *container, const char *fullname); +ADS_STATUS ads_add_group_acct(ADS_STRUCT *ads, const char *group, + const char *container, const char *comment); + +/* The following definitions come from libads/ldap_utils.c */ + +ADS_STATUS ads_ranged_search(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + int scope, + const char *base, + const char *filter, + void *args, + const char *range_attr, + char ***strings, + size_t *num_strings); +ADS_STATUS ads_ranged_search_internal(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + int scope, + const char *base, + const char *filter, + const char **attrs, + void *args, + const char *range_attr, + char ***strings, + size_t *num_strings, + uint32 *first_usn, + int *num_retries, + bool *more_values); + +/* The following definitions come from libads/ndr.c */ + +void ndr_print_ads_auth_flags(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r); + +/* The following definitions come from libads/sasl.c */ + +ADS_STATUS ads_sasl_bind(ADS_STRUCT *ads); + +/* The following definitions come from libads/sasl_wrapping.c */ + +ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads, + const struct ads_saslwrap_ops *ops, + void *private_data); +ADS_STATUS ads_setup_sasl_wrapping(ADS_STRUCT *ads, + const struct ads_saslwrap_ops *ops, + void *private_data); + +/* The following definitions come from libads/util.c */ + +ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_principal); +ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads, + char **returned_principal); + +/* The following definitions come from libcli/nbt/nbtname.c */ + +_PUBLIC_ void ndr_print_nbt_string(struct ndr_print *ndr, const char *name, const char *s); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r); +_PUBLIC_ NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname); +_PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name); +_PUBLIC_ NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name); +_PUBLIC_ void nbt_choose_called_name(TALLOC_CTX *mem_ctx, + struct nbt_name *n, const char *name, int type); +_PUBLIC_ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name); +_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, const struct nbt_name **_r); +_PUBLIC_ enum ndr_err_code ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r); +_PUBLIC_ void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r); + +/* The following definitions come from libgpo/gpext/gpext.c */ + +struct gp_extension *get_gp_extension_list(void); +NTSTATUS unregister_gp_extension(const char *name); +NTSTATUS register_gp_extension(TALLOC_CTX *gpext_ctx, + int version, + const char *name, + const char *guid, + struct gp_extension_methods *methods); +NTSTATUS gp_ext_info_add_entry(TALLOC_CTX *mem_ctx, + const char *module, + const char *ext_guid, + struct gp_extension_reg_table *table, + struct gp_extension_reg_info *info); +NTSTATUS shutdown_gp_extensions(void); +NTSTATUS init_gp_extensions(TALLOC_CTX *mem_ctx); +NTSTATUS free_gp_extensions(void); +void debug_gpext_header(int lvl, + const char *name, + uint32_t flags, + struct GROUP_POLICY_OBJECT *gpo, + const char *extension_guid, + const char *snapin_guid); +NTSTATUS process_gpo_list_with_extension(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + uint32_t flags, + const struct nt_user_token *token, + struct GROUP_POLICY_OBJECT *gpo_list, + const char *extension_guid, + const char *snapin_guid); +NTSTATUS gpext_process_extension(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + uint32_t flags, + const struct nt_user_token *token, + struct registry_key *root_key, + struct GROUP_POLICY_OBJECT *gpo, + const char *extension_guid, + const char *snapin_guid); + +/* The following definitions come from libgpo/gpo_fetch.c */ + +NTSTATUS gpo_explode_filesyspath(TALLOC_CTX *mem_ctx, + const char *file_sys_path, + char **server, + char **service, + char **nt_path, + char **unix_path); +NTSTATUS gpo_fetch_files(TALLOC_CTX *mem_ctx, + struct cli_state *cli, + struct GROUP_POLICY_OBJECT *gpo); +NTSTATUS gpo_get_sysvol_gpt_version(TALLOC_CTX *mem_ctx, + const char *unix_path, + uint32_t *sysvol_version, + char **display_name); + +/* The following definitions come from libgpo/gpo_filesync.c */ + +NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx, + struct cli_state *cli, + const char *nt_path, + const char *unix_path); +NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx, + struct cli_state *cli, + const char *nt_path, + const char *local_path); + +/* The following definitions come from libgpo/gpo_ini.c */ + +NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx, + const char *filename, + uint32_t *version, + char **display_name); + +/* The following definitions come from libgpo/gpo_ldap.c */ + +bool ads_parse_gp_ext(TALLOC_CTX *mem_ctx, + const char *extension_raw, + struct GP_EXT **gp_ext); +ADS_STATUS ads_get_gpo_link(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *link_dn, + struct GP_LINK *gp_link_struct); +ADS_STATUS ads_add_gpo_link(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *link_dn, + const char *gpo_dn, + uint32_t gpo_opt); +ADS_STATUS ads_delete_gpo_link(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *link_dn, + const char *gpo_dn); +ADS_STATUS ads_get_gpo(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *gpo_dn, + const char *display_name, + const char *guid_name, + struct GROUP_POLICY_OBJECT *gpo); +ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *dn, + struct nt_user_token **token); +ADS_STATUS ads_get_gpo_list(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *dn, + uint32_t flags, + const struct nt_user_token *token, + struct GROUP_POLICY_OBJECT **gpo_list); + +/* The following definitions come from libgpo/gpo_reg.c */ + +struct nt_user_token *registry_create_system_token(TALLOC_CTX *mem_ctx); +WERROR gp_init_reg_ctx(TALLOC_CTX *mem_ctx, + const char *initial_path, + uint32_t desired_access, + const struct nt_user_token *token, + struct gp_registry_context **reg_ctx); +void gp_free_reg_ctx(struct gp_registry_context *reg_ctx); +WERROR gp_store_reg_subkey(TALLOC_CTX *mem_ctx, + const char *subkeyname, + struct registry_key *curr_key, + struct registry_key **new_key); +WERROR gp_read_reg_subkey(TALLOC_CTX *mem_ctx, + struct gp_registry_context *reg_ctx, + const char *subkeyname, + struct registry_key **key); +WERROR gp_store_reg_val_sz(TALLOC_CTX *mem_ctx, + struct registry_key *key, + const char *val_name, + const char *val); +WERROR gp_read_reg_val_sz(TALLOC_CTX *mem_ctx, + struct registry_key *key, + const char *val_name, + const char **val); +WERROR gp_reg_state_store(TALLOC_CTX *mem_ctx, + uint32_t flags, + const char *dn, + const struct nt_user_token *token, + struct GROUP_POLICY_OBJECT *gpo_list); +WERROR gp_reg_state_read(TALLOC_CTX *mem_ctx, + uint32_t flags, + const DOM_SID *sid, + struct GROUP_POLICY_OBJECT **gpo_list); +WERROR gp_secure_key(TALLOC_CTX *mem_ctx, + uint32_t flags, + struct registry_key *key, + const DOM_SID *sid); +void dump_reg_val(int lvl, const char *direction, + const char *key, const char *subkey, + struct registry_value *val); +void dump_reg_entry(uint32_t flags, + const char *dir, + struct gp_registry_entry *entry); +void dump_reg_entries(uint32_t flags, + const char *dir, + struct gp_registry_entry *entries, + size_t num_entries); +bool add_gp_registry_entry_to_array(TALLOC_CTX *mem_ctx, + struct gp_registry_entry *entry, + struct gp_registry_entry **entries, + size_t *num); +WERROR reg_apply_registry_entry(TALLOC_CTX *mem_ctx, + struct registry_key *root_key, + struct gp_registry_context *reg_ctx, + struct gp_registry_entry *entry, + const struct nt_user_token *token, + uint32_t flags); + +/* The following definitions come from libgpo/gpo_sec.c */ + +NTSTATUS gpo_apply_security_filtering(const struct GROUP_POLICY_OBJECT *gpo, + const struct nt_user_token *token); + +/* The following definitions come from libgpo/gpo_util.c */ + +const char *cse_gpo_guid_string_to_name(const char *guid); +const char *cse_gpo_name_to_guid_string(const char *name); +const char *cse_snapin_gpo_guid_string_to_name(const char *guid); +void dump_gp_ext(struct GP_EXT *gp_ext, int debuglevel); +void dump_gpo(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + struct GROUP_POLICY_OBJECT *gpo, + int debuglevel); +void dump_gpo_list(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + struct GROUP_POLICY_OBJECT *gpo_list, + int debuglevel); +void dump_gplink(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, struct GP_LINK *gp_link); +ADS_STATUS gpo_process_a_gpo(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const struct nt_user_token *token, + struct registry_key *root_key, + struct GROUP_POLICY_OBJECT *gpo, + const char *extension_guid_filter, + uint32_t flags); +ADS_STATUS gpo_process_gpo_list(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const struct nt_user_token *token, + struct GROUP_POLICY_OBJECT *gpo_list, + const char *extensions_guid_filter, + uint32_t flags); +NTSTATUS check_refresh_gpo(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + uint32_t flags, + struct GROUP_POLICY_OBJECT *gpo, + struct cli_state **cli_out); +NTSTATUS check_refresh_gpo_list(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + uint32_t flags, + struct GROUP_POLICY_OBJECT *gpo_list); +NTSTATUS gpo_get_unix_path(TALLOC_CTX *mem_ctx, + struct GROUP_POLICY_OBJECT *gpo, + char **unix_path); +char *gpo_flag_str(uint32_t flags); +NTSTATUS gp_find_file(TALLOC_CTX *mem_ctx, + uint32_t flags, + const char *filename, + const char *suffix, + const char **filename_out); +ADS_STATUS gp_get_machine_token(ADS_STRUCT *ads, + TALLOC_CTX *mem_ctx, + const char *dn, + struct nt_user_token **token); + +/* The following definitions come from librpc/gen_ndr/ndr_dfs.c */ + +_PUBLIC_ void ndr_print_dfs_ManagerVersion(struct ndr_print *ndr, const char *name, enum dfs_ManagerVersion r); +_PUBLIC_ void ndr_print_dfs_Info0(struct ndr_print *ndr, const char *name, const struct dfs_Info0 *r); +_PUBLIC_ void ndr_print_dfs_Info1(struct ndr_print *ndr, const char *name, const struct dfs_Info1 *r); +_PUBLIC_ enum ndr_err_code ndr_push_dfs_VolumeState(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_dfs_VolumeState(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_dfs_VolumeState(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_dfs_Info2(struct ndr_print *ndr, const char *name, const struct dfs_Info2 *r); +_PUBLIC_ enum ndr_err_code ndr_push_dfs_StorageState(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_dfs_StorageState(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_dfs_StorageState(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_dfs_StorageInfo(struct ndr_print *ndr, const char *name, const struct dfs_StorageInfo *r); +_PUBLIC_ void ndr_print_dfs_Info3(struct ndr_print *ndr, const char *name, const struct dfs_Info3 *r); +_PUBLIC_ void ndr_print_dfs_Info4(struct ndr_print *ndr, const char *name, const struct dfs_Info4 *r); +_PUBLIC_ enum ndr_err_code ndr_push_dfs_PropertyFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_dfs_PropertyFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_dfs_PropertyFlags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_dfs_Info5(struct ndr_print *ndr, const char *name, const struct dfs_Info5 *r); +_PUBLIC_ void ndr_print_dfs_Target_PriorityClass(struct ndr_print *ndr, const char *name, enum dfs_Target_PriorityClass r); +_PUBLIC_ void ndr_print_dfs_Target_Priority(struct ndr_print *ndr, const char *name, const struct dfs_Target_Priority *r); +_PUBLIC_ void ndr_print_dfs_StorageInfo2(struct ndr_print *ndr, const char *name, const struct dfs_StorageInfo2 *r); +_PUBLIC_ void ndr_print_dfs_Info6(struct ndr_print *ndr, const char *name, const struct dfs_Info6 *r); +_PUBLIC_ void ndr_print_dfs_Info7(struct ndr_print *ndr, const char *name, const struct dfs_Info7 *r); +_PUBLIC_ void ndr_print_dfs_Info100(struct ndr_print *ndr, const char *name, const struct dfs_Info100 *r); +_PUBLIC_ void ndr_print_dfs_Info101(struct ndr_print *ndr, const char *name, const struct dfs_Info101 *r); +_PUBLIC_ void ndr_print_dfs_Info102(struct ndr_print *ndr, const char *name, const struct dfs_Info102 *r); +_PUBLIC_ void ndr_print_dfs_Info103(struct ndr_print *ndr, const char *name, const struct dfs_Info103 *r); +_PUBLIC_ void ndr_print_dfs_Info104(struct ndr_print *ndr, const char *name, const struct dfs_Info104 *r); +_PUBLIC_ void ndr_print_dfs_Info105(struct ndr_print *ndr, const char *name, const struct dfs_Info105 *r); +_PUBLIC_ void ndr_print_dfs_Info106(struct ndr_print *ndr, const char *name, const struct dfs_Info106 *r); +_PUBLIC_ void ndr_print_dfs_Info200(struct ndr_print *ndr, const char *name, const struct dfs_Info200 *r); +_PUBLIC_ void ndr_print_dfs_VolumeFlavor(struct ndr_print *ndr, const char *name, enum dfs_VolumeFlavor r); +_PUBLIC_ void ndr_print_dfs_Info300(struct ndr_print *ndr, const char *name, const struct dfs_Info300 *r); +_PUBLIC_ void ndr_print_dfs_Info(struct ndr_print *ndr, const char *name, const union dfs_Info *r); +_PUBLIC_ void ndr_print_dfs_EnumArray1(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray1 *r); +_PUBLIC_ void ndr_print_dfs_EnumArray2(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray2 *r); +_PUBLIC_ void ndr_print_dfs_EnumArray3(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray3 *r); +_PUBLIC_ void ndr_print_dfs_EnumArray4(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray4 *r); +_PUBLIC_ void ndr_print_dfs_EnumArray5(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray5 *r); +_PUBLIC_ void ndr_print_dfs_EnumArray6(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray6 *r); +_PUBLIC_ void ndr_print_dfs_EnumArray200(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray200 *r); +_PUBLIC_ void ndr_print_dfs_EnumArray300(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray300 *r); +_PUBLIC_ void ndr_print_dfs_EnumInfo(struct ndr_print *ndr, const char *name, const union dfs_EnumInfo *r); +_PUBLIC_ void ndr_print_dfs_EnumStruct(struct ndr_print *ndr, const char *name, const struct dfs_EnumStruct *r); +_PUBLIC_ void ndr_print_dfs_UnknownStruct(struct ndr_print *ndr, const char *name, const struct dfs_UnknownStruct *r); +_PUBLIC_ enum ndr_err_code ndr_push_dfs_GetManagerVersion(struct ndr_push *ndr, int flags, const struct dfs_GetManagerVersion *r); +_PUBLIC_ enum ndr_err_code ndr_pull_dfs_GetManagerVersion(struct ndr_pull *ndr, int flags, struct dfs_GetManagerVersion *r); +_PUBLIC_ void ndr_print_dfs_GetManagerVersion(struct ndr_print *ndr, const char *name, int flags, const struct dfs_GetManagerVersion *r); +_PUBLIC_ void ndr_print_dfs_Add(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Add *r); +_PUBLIC_ void ndr_print_dfs_Remove(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Remove *r); +_PUBLIC_ void ndr_print_dfs_SetInfo(struct ndr_print *ndr, const char *name, int flags, const struct dfs_SetInfo *r); +_PUBLIC_ void ndr_print_dfs_GetInfo(struct ndr_print *ndr, const char *name, int flags, const struct dfs_GetInfo *r); +_PUBLIC_ void ndr_print_dfs_Enum(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Enum *r); +_PUBLIC_ void ndr_print_dfs_Rename(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Rename *r); +_PUBLIC_ void ndr_print_dfs_Move(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Move *r); +_PUBLIC_ void ndr_print_dfs_ManagerGetConfigInfo(struct ndr_print *ndr, const char *name, int flags, const struct dfs_ManagerGetConfigInfo *r); +_PUBLIC_ void ndr_print_dfs_ManagerSendSiteInfo(struct ndr_print *ndr, const char *name, int flags, const struct dfs_ManagerSendSiteInfo *r); +_PUBLIC_ void ndr_print_dfs_AddFtRoot(struct ndr_print *ndr, const char *name, int flags, const struct dfs_AddFtRoot *r); +_PUBLIC_ void ndr_print_dfs_RemoveFtRoot(struct ndr_print *ndr, const char *name, int flags, const struct dfs_RemoveFtRoot *r); +_PUBLIC_ void ndr_print_dfs_AddStdRoot(struct ndr_print *ndr, const char *name, int flags, const struct dfs_AddStdRoot *r); +_PUBLIC_ void ndr_print_dfs_RemoveStdRoot(struct ndr_print *ndr, const char *name, int flags, const struct dfs_RemoveStdRoot *r); +_PUBLIC_ void ndr_print_dfs_ManagerInitialize(struct ndr_print *ndr, const char *name, int flags, const struct dfs_ManagerInitialize *r); +_PUBLIC_ void ndr_print_dfs_AddStdRootForced(struct ndr_print *ndr, const char *name, int flags, const struct dfs_AddStdRootForced *r); +_PUBLIC_ void ndr_print_dfs_GetDcAddress(struct ndr_print *ndr, const char *name, int flags, const struct dfs_GetDcAddress *r); +_PUBLIC_ void ndr_print_dfs_SetDcAddress(struct ndr_print *ndr, const char *name, int flags, const struct dfs_SetDcAddress *r); +_PUBLIC_ void ndr_print_dfs_FlushFtTable(struct ndr_print *ndr, const char *name, int flags, const struct dfs_FlushFtTable *r); +_PUBLIC_ void ndr_print_dfs_Add2(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Add2 *r); +_PUBLIC_ void ndr_print_dfs_Remove2(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Remove2 *r); +_PUBLIC_ enum ndr_err_code ndr_push_dfs_EnumEx(struct ndr_push *ndr, int flags, const struct dfs_EnumEx *r); +_PUBLIC_ enum ndr_err_code ndr_pull_dfs_EnumEx(struct ndr_pull *ndr, int flags, struct dfs_EnumEx *r); +_PUBLIC_ void ndr_print_dfs_EnumEx(struct ndr_print *ndr, const char *name, int flags, const struct dfs_EnumEx *r); +_PUBLIC_ void ndr_print_dfs_SetInfo2(struct ndr_print *ndr, const char *name, int flags, const struct dfs_SetInfo2 *r); + +/* The following definitions come from librpc/gen_ndr/ndr_dssetup.c */ + +_PUBLIC_ void ndr_print_dssetup_DsRole(struct ndr_print *ndr, const char *name, enum dssetup_DsRole r); +_PUBLIC_ void ndr_print_dssetup_DsRoleFlags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_print *ndr, const char *name, const struct dssetup_DsRolePrimaryDomInfoBasic *r); +_PUBLIC_ void ndr_print_dssetup_DsUpgrade(struct ndr_print *ndr, const char *name, enum dssetup_DsUpgrade r); +_PUBLIC_ void ndr_print_dssetup_DsPrevious(struct ndr_print *ndr, const char *name, enum dssetup_DsPrevious r); +_PUBLIC_ void ndr_print_dssetup_DsRoleUpgradeStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleUpgradeStatus *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleOp(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleOp r); +_PUBLIC_ void ndr_print_dssetup_DsRoleOpStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleOpStatus *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleInfoLevel(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleInfoLevel r); +_PUBLIC_ void ndr_print_dssetup_DsRoleInfo(struct ndr_print *ndr, const char *name, const union dssetup_DsRoleInfo *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetPrimaryDomainInformation *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleDnsNameToFlatName(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDnsNameToFlatName *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleDcAsDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsDc *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleDcAsReplica(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsReplica *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleDemoteDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDemoteDc *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleGetDcOperationProgress(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationProgress *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleGetDcOperationResults(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationResults *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleCancel(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleCancel *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleServerSaveStateForUpgrade *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleUpgradeDownlevelServer *r); +_PUBLIC_ void ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleAbortDownlevelServerUpgrade *r); + +/* The following definitions come from librpc/gen_ndr/ndr_echo.c */ + +_PUBLIC_ void ndr_print_echo_info1(struct ndr_print *ndr, const char *name, const struct echo_info1 *r); +_PUBLIC_ void ndr_print_echo_info2(struct ndr_print *ndr, const char *name, const struct echo_info2 *r); +_PUBLIC_ void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, const struct echo_info3 *r); +_PUBLIC_ void ndr_print_STRUCT_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r); +_PUBLIC_ void ndr_print_echo_info5(struct ndr_print *ndr, const char *name, const struct echo_info5 *r); +_PUBLIC_ void ndr_print_echo_info6(struct ndr_print *ndr, const char *name, const struct echo_info6 *r); +_PUBLIC_ void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, const struct echo_info7 *r); +_PUBLIC_ void ndr_print_echo_Info(struct ndr_print *ndr, const char *name, const union echo_Info *r); +_PUBLIC_ void ndr_print_echo_Enum1(struct ndr_print *ndr, const char *name, enum echo_Enum1 r); +_PUBLIC_ void ndr_print_echo_Enum1_32(struct ndr_print *ndr, const char *name, enum echo_Enum1_32 r); +_PUBLIC_ void ndr_print_echo_Enum2(struct ndr_print *ndr, const char *name, const struct echo_Enum2 *r); +_PUBLIC_ void ndr_print_echo_Enum3(struct ndr_print *ndr, const char *name, const union echo_Enum3 *r); +_PUBLIC_ void ndr_print_echo_Surrounding(struct ndr_print *ndr, const char *name, const struct echo_Surrounding *r); +_PUBLIC_ void ndr_print_echo_AddOne(struct ndr_print *ndr, const char *name, int flags, const struct echo_AddOne *r); +_PUBLIC_ void ndr_print_echo_EchoData(struct ndr_print *ndr, const char *name, int flags, const struct echo_EchoData *r); +_PUBLIC_ void ndr_print_echo_SinkData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SinkData *r); +_PUBLIC_ void ndr_print_echo_SourceData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SourceData *r); +_PUBLIC_ void ndr_print_echo_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall *r); +_PUBLIC_ void ndr_print_echo_TestCall2(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall2 *r); +_PUBLIC_ void ndr_print_echo_TestSleep(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSleep *r); +_PUBLIC_ void ndr_print_echo_TestEnum(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestEnum *r); +_PUBLIC_ void ndr_print_echo_TestSurrounding(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSurrounding *r); +_PUBLIC_ void ndr_print_echo_TestDoublePointer(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestDoublePointer *r); + +/* The following definitions come from librpc/gen_ndr/ndr_eventlog.c */ + +_PUBLIC_ void ndr_print_eventlog_OpenUnknown0(struct ndr_print *ndr, const char *name, const struct eventlog_OpenUnknown0 *r); +_PUBLIC_ enum ndr_err_code ndr_push_eventlog_Record(struct ndr_push *ndr, int ndr_flags, const struct eventlog_Record *r); +_PUBLIC_ enum ndr_err_code ndr_pull_eventlog_Record(struct ndr_pull *ndr, int ndr_flags, struct eventlog_Record *r); +_PUBLIC_ void ndr_print_eventlog_Record(struct ndr_print *ndr, const char *name, const struct eventlog_Record *r); +_PUBLIC_ void ndr_print_eventlog_ClearEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ClearEventLogW *r); +_PUBLIC_ void ndr_print_eventlog_BackupEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_BackupEventLogW *r); +_PUBLIC_ void ndr_print_eventlog_CloseEventLog(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_CloseEventLog *r); +_PUBLIC_ void ndr_print_eventlog_DeregisterEventSource(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_DeregisterEventSource *r); +_PUBLIC_ void ndr_print_eventlog_GetNumRecords(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetNumRecords *r); +_PUBLIC_ void ndr_print_eventlog_GetOldestRecord(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetOldestRecord *r); +_PUBLIC_ void ndr_print_eventlog_ChangeNotify(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ChangeNotify *r); +_PUBLIC_ void ndr_print_eventlog_OpenEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_OpenEventLogW *r); +_PUBLIC_ void ndr_print_eventlog_RegisterEventSourceW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_RegisterEventSourceW *r); +_PUBLIC_ void ndr_print_eventlog_OpenBackupEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_OpenBackupEventLogW *r); +_PUBLIC_ void ndr_print_eventlog_ReadEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReadEventLogW *r); +_PUBLIC_ void ndr_print_eventlog_ReportEventW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReportEventW *r); +_PUBLIC_ void ndr_print_eventlog_ClearEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ClearEventLogA *r); +_PUBLIC_ void ndr_print_eventlog_BackupEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_BackupEventLogA *r); +_PUBLIC_ void ndr_print_eventlog_OpenEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_OpenEventLogA *r); +_PUBLIC_ void ndr_print_eventlog_RegisterEventSourceA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_RegisterEventSourceA *r); +_PUBLIC_ void ndr_print_eventlog_OpenBackupEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_OpenBackupEventLogA *r); +_PUBLIC_ void ndr_print_eventlog_ReadEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReadEventLogA *r); +_PUBLIC_ void ndr_print_eventlog_ReportEventA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReportEventA *r); +_PUBLIC_ void ndr_print_eventlog_RegisterClusterSvc(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_RegisterClusterSvc *r); +_PUBLIC_ void ndr_print_eventlog_DeregisterClusterSvc(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_DeregisterClusterSvc *r); +_PUBLIC_ void ndr_print_eventlog_WriteClusterEvents(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_WriteClusterEvents *r); +_PUBLIC_ void ndr_print_eventlog_GetLogIntormation(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetLogIntormation *r); +_PUBLIC_ void ndr_print_eventlog_FlushEventLog(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_FlushEventLog *r); + +/* The following definitions come from librpc/gen_ndr/ndr_initshutdown.c */ + +_PUBLIC_ void ndr_print_initshutdown_String_sub(struct ndr_print *ndr, const char *name, const struct initshutdown_String_sub *r); +_PUBLIC_ enum ndr_err_code ndr_push_initshutdown_String(struct ndr_push *ndr, int ndr_flags, const struct initshutdown_String *r); +_PUBLIC_ enum ndr_err_code ndr_pull_initshutdown_String(struct ndr_pull *ndr, int ndr_flags, struct initshutdown_String *r); +_PUBLIC_ void ndr_print_initshutdown_String(struct ndr_print *ndr, const char *name, const struct initshutdown_String *r); +_PUBLIC_ void ndr_print_initshutdown_Init(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Init *r); +_PUBLIC_ void ndr_print_initshutdown_Abort(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Abort *r); +_PUBLIC_ void ndr_print_initshutdown_InitEx(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_InitEx *r); + +/* The following definitions come from librpc/gen_ndr/ndr_krb5pac.c */ + +_PUBLIC_ void ndr_print_PAC_LOGON_NAME(struct ndr_print *ndr, const char *name, const struct PAC_LOGON_NAME *r); +_PUBLIC_ enum ndr_err_code ndr_push_PAC_SIGNATURE_DATA(struct ndr_push *ndr, int ndr_flags, const struct PAC_SIGNATURE_DATA *r); +_PUBLIC_ enum ndr_err_code ndr_pull_PAC_SIGNATURE_DATA(struct ndr_pull *ndr, int ndr_flags, struct PAC_SIGNATURE_DATA *r); +_PUBLIC_ void ndr_print_PAC_SIGNATURE_DATA(struct ndr_print *ndr, const char *name, const struct PAC_SIGNATURE_DATA *r); +_PUBLIC_ void ndr_print_PAC_LOGON_INFO(struct ndr_print *ndr, const char *name, const struct PAC_LOGON_INFO *r); +_PUBLIC_ enum ndr_err_code ndr_push_PAC_LOGON_INFO_CTR(struct ndr_push *ndr, int ndr_flags, const struct PAC_LOGON_INFO_CTR *r); +_PUBLIC_ enum ndr_err_code ndr_pull_PAC_LOGON_INFO_CTR(struct ndr_pull *ndr, int ndr_flags, struct PAC_LOGON_INFO_CTR *r); +_PUBLIC_ void ndr_print_PAC_LOGON_INFO_CTR(struct ndr_print *ndr, const char *name, const struct PAC_LOGON_INFO_CTR *r); +_PUBLIC_ enum ndr_err_code ndr_push_PAC_TYPE(struct ndr_push *ndr, int ndr_flags, enum PAC_TYPE r); +_PUBLIC_ enum ndr_err_code ndr_pull_PAC_TYPE(struct ndr_pull *ndr, int ndr_flags, enum PAC_TYPE *r); +_PUBLIC_ void ndr_print_PAC_TYPE(struct ndr_print *ndr, const char *name, enum PAC_TYPE r); +_PUBLIC_ void ndr_print_DATA_BLOB_REM(struct ndr_print *ndr, const char *name, const struct DATA_BLOB_REM *r); +_PUBLIC_ enum ndr_err_code ndr_push_PAC_INFO(struct ndr_push *ndr, int ndr_flags, const union PAC_INFO *r); +_PUBLIC_ enum ndr_err_code ndr_pull_PAC_INFO(struct ndr_pull *ndr, int ndr_flags, union PAC_INFO *r); +_PUBLIC_ void ndr_print_PAC_INFO(struct ndr_print *ndr, const char *name, const union PAC_INFO *r); +_PUBLIC_ size_t ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags); +_PUBLIC_ enum ndr_err_code ndr_push_PAC_DATA(struct ndr_push *ndr, int ndr_flags, const struct PAC_DATA *r); +_PUBLIC_ enum ndr_err_code ndr_pull_PAC_DATA(struct ndr_pull *ndr, int ndr_flags, struct PAC_DATA *r); +_PUBLIC_ void ndr_print_PAC_DATA(struct ndr_print *ndr, const char *name, const struct PAC_DATA *r); +_PUBLIC_ enum ndr_err_code ndr_push_PAC_BUFFER_RAW(struct ndr_push *ndr, int ndr_flags, const struct PAC_BUFFER_RAW *r); +_PUBLIC_ enum ndr_err_code ndr_pull_PAC_BUFFER_RAW(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUFFER_RAW *r); +_PUBLIC_ void ndr_print_PAC_BUFFER_RAW(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER_RAW *r); +_PUBLIC_ enum ndr_err_code ndr_push_PAC_DATA_RAW(struct ndr_push *ndr, int ndr_flags, const struct PAC_DATA_RAW *r); +_PUBLIC_ enum ndr_err_code ndr_pull_PAC_DATA_RAW(struct ndr_pull *ndr, int ndr_flags, struct PAC_DATA_RAW *r); +_PUBLIC_ void ndr_print_PAC_DATA_RAW(struct ndr_print *ndr, const char *name, const struct PAC_DATA_RAW *r); +_PUBLIC_ enum ndr_err_code ndr_push_netsamlogoncache_entry(struct ndr_push *ndr, int ndr_flags, const struct netsamlogoncache_entry *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netsamlogoncache_entry(struct ndr_pull *ndr, int ndr_flags, struct netsamlogoncache_entry *r); +_PUBLIC_ void ndr_print_netsamlogoncache_entry(struct ndr_print *ndr, const char *name, const struct netsamlogoncache_entry *r); +_PUBLIC_ void ndr_print_decode_pac(struct ndr_print *ndr, const char *name, int flags, const struct decode_pac *r); +_PUBLIC_ void ndr_print_decode_pac_raw(struct ndr_print *ndr, const char *name, int flags, const struct decode_pac_raw *r); +_PUBLIC_ void ndr_print_decode_login_info(struct ndr_print *ndr, const char *name, int flags, const struct decode_login_info *r); + +/* The following definitions come from librpc/gen_ndr/ndr_lsa.c */ + +_PUBLIC_ enum ndr_err_code ndr_push_lsa_String(struct ndr_push *ndr, int ndr_flags, const struct lsa_String *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_String(struct ndr_pull *ndr, int ndr_flags, struct lsa_String *r); +_PUBLIC_ void ndr_print_lsa_String(struct ndr_print *ndr, const char *name, const struct lsa_String *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_StringLarge(struct ndr_push *ndr, int ndr_flags, const struct lsa_StringLarge *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_StringLarge(struct ndr_pull *ndr, int ndr_flags, struct lsa_StringLarge *r); +_PUBLIC_ void ndr_print_lsa_StringLarge(struct ndr_print *ndr, const char *name, const struct lsa_StringLarge *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_Strings(struct ndr_push *ndr, int ndr_flags, const struct lsa_Strings *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_Strings(struct ndr_pull *ndr, int ndr_flags, struct lsa_Strings *r); +_PUBLIC_ void ndr_print_lsa_Strings(struct ndr_print *ndr, const char *name, const struct lsa_Strings *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_AsciiString(struct ndr_push *ndr, int ndr_flags, const struct lsa_AsciiString *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_AsciiString(struct ndr_pull *ndr, int ndr_flags, struct lsa_AsciiString *r); +_PUBLIC_ void ndr_print_lsa_AsciiString(struct ndr_print *ndr, const char *name, const struct lsa_AsciiString *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_AsciiStringLarge(struct ndr_push *ndr, int ndr_flags, const struct lsa_AsciiStringLarge *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_AsciiStringLarge(struct ndr_pull *ndr, int ndr_flags, struct lsa_AsciiStringLarge *r); +_PUBLIC_ void ndr_print_lsa_AsciiStringLarge(struct ndr_print *ndr, const char *name, const struct lsa_AsciiStringLarge *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_BinaryString(struct ndr_push *ndr, int ndr_flags, const struct lsa_BinaryString *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_BinaryString(struct ndr_pull *ndr, int ndr_flags, struct lsa_BinaryString *r); +_PUBLIC_ void ndr_print_lsa_BinaryString(struct ndr_print *ndr, const char *name, const struct lsa_BinaryString *r); +_PUBLIC_ void ndr_print_lsa_LUID(struct ndr_print *ndr, const char *name, const struct lsa_LUID *r); +_PUBLIC_ void ndr_print_lsa_PrivEntry(struct ndr_print *ndr, const char *name, const struct lsa_PrivEntry *r); +_PUBLIC_ void ndr_print_lsa_PrivArray(struct ndr_print *ndr, const char *name, const struct lsa_PrivArray *r); +_PUBLIC_ void ndr_print_lsa_QosInfo(struct ndr_print *ndr, const char *name, const struct lsa_QosInfo *r); +_PUBLIC_ void ndr_print_lsa_ObjectAttribute(struct ndr_print *ndr, const char *name, const struct lsa_ObjectAttribute *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_PolicyAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_PolicyAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_lsa_PolicyAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditLogInfo *r); +_PUBLIC_ void ndr_print_lsa_PolicyAuditPolicy(struct ndr_print *ndr, const char *name, enum lsa_PolicyAuditPolicy r); +_PUBLIC_ void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditEventsInfo *r); +_PUBLIC_ void ndr_print_lsa_DomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfo *r); +_PUBLIC_ void ndr_print_lsa_PDAccountInfo(struct ndr_print *ndr, const char *name, const struct lsa_PDAccountInfo *r); +_PUBLIC_ void ndr_print_lsa_ServerRole(struct ndr_print *ndr, const char *name, const struct lsa_ServerRole *r); +_PUBLIC_ void ndr_print_lsa_ReplicaSourceInfo(struct ndr_print *ndr, const char *name, const struct lsa_ReplicaSourceInfo *r); +_PUBLIC_ void ndr_print_lsa_DefaultQuotaInfo(struct ndr_print *ndr, const char *name, const struct lsa_DefaultQuotaInfo *r); +_PUBLIC_ void ndr_print_lsa_ModificationInfo(struct ndr_print *ndr, const char *name, const struct lsa_ModificationInfo *r); +_PUBLIC_ void ndr_print_lsa_AuditFullSetInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullSetInfo *r); +_PUBLIC_ void ndr_print_lsa_AuditFullQueryInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullQueryInfo *r); +_PUBLIC_ void ndr_print_lsa_DnsDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DnsDomainInfo *r); +_PUBLIC_ void ndr_print_lsa_PolicyInfo(struct ndr_print *ndr, const char *name, enum lsa_PolicyInfo r); +_PUBLIC_ void ndr_print_lsa_PolicyInformation(struct ndr_print *ndr, const char *name, const union lsa_PolicyInformation *r); +_PUBLIC_ void ndr_print_lsa_SidPtr(struct ndr_print *ndr, const char *name, const struct lsa_SidPtr *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, const struct lsa_SidArray *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_SidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidArray *r); +_PUBLIC_ void ndr_print_lsa_SidArray(struct ndr_print *ndr, const char *name, const struct lsa_SidArray *r); +_PUBLIC_ void ndr_print_lsa_DomainList(struct ndr_print *ndr, const char *name, const struct lsa_DomainList *r); +_PUBLIC_ void ndr_print_lsa_SidType(struct ndr_print *ndr, const char *name, enum lsa_SidType r); +_PUBLIC_ void ndr_print_lsa_TranslatedSid(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid *r); +_PUBLIC_ void ndr_print_lsa_TransSidArray(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray *r); +_PUBLIC_ void ndr_print_lsa_RefDomainList(struct ndr_print *ndr, const char *name, const struct lsa_RefDomainList *r); +_PUBLIC_ void ndr_print_lsa_LookupNamesLevel(struct ndr_print *ndr, const char *name, enum lsa_LookupNamesLevel r); +_PUBLIC_ void ndr_print_lsa_TranslatedName(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedName *r); +_PUBLIC_ void ndr_print_lsa_TransNameArray(struct ndr_print *ndr, const char *name, const struct lsa_TransNameArray *r); +_PUBLIC_ void ndr_print_lsa_LUIDAttribute(struct ndr_print *ndr, const char *name, const struct lsa_LUIDAttribute *r); +_PUBLIC_ void ndr_print_lsa_PrivilegeSet(struct ndr_print *ndr, const char *name, const struct lsa_PrivilegeSet *r); +_PUBLIC_ void ndr_print_lsa_DATA_BUF(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF *r); +_PUBLIC_ void ndr_print_lsa_DATA_BUF2(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF2 *r); +_PUBLIC_ void ndr_print_lsa_TrustDomInfoEnum(struct ndr_print *ndr, const char *name, enum lsa_TrustDomInfoEnum r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoName(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoName *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoPosixOffset(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoPosixOffset *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoPassword(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoPassword *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoBasic(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoBasic *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoEx(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoEx *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoBuffer(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoBuffer *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoAuthInfo(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoAuthInfo *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoFullInfo(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfo *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfo11(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfo11 *r); +_PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoAll(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoAll *r); +_PUBLIC_ void ndr_print_lsa_TrustedDomainInfo(struct ndr_print *ndr, const char *name, const union lsa_TrustedDomainInfo *r); +_PUBLIC_ void ndr_print_lsa_DATA_BUF_PTR(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF_PTR *r); +_PUBLIC_ void ndr_print_lsa_RightSet(struct ndr_print *ndr, const char *name, const struct lsa_RightSet *r); +_PUBLIC_ void ndr_print_lsa_DomainListEx(struct ndr_print *ndr, const char *name, const struct lsa_DomainListEx *r); +_PUBLIC_ void ndr_print_lsa_DomainInfoKerberos(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfoKerberos *r); +_PUBLIC_ void ndr_print_lsa_DomainInfoEfs(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfoEfs *r); +_PUBLIC_ void ndr_print_lsa_DomainInformationPolicy(struct ndr_print *ndr, const char *name, const union lsa_DomainInformationPolicy *r); +_PUBLIC_ void ndr_print_lsa_TranslatedName2(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedName2 *r); +_PUBLIC_ void ndr_print_lsa_TransNameArray2(struct ndr_print *ndr, const char *name, const struct lsa_TransNameArray2 *r); +_PUBLIC_ void ndr_print_lsa_TranslatedSid2(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid2 *r); +_PUBLIC_ void ndr_print_lsa_TransSidArray2(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray2 *r); +_PUBLIC_ void ndr_print_lsa_TranslatedSid3(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid3 *r); +_PUBLIC_ void ndr_print_lsa_TransSidArray3(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray3 *r); +_PUBLIC_ void ndr_print_lsa_ForestTrustBinaryData(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustBinaryData *r); +_PUBLIC_ void ndr_print_lsa_ForestTrustDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustDomainInfo *r); +_PUBLIC_ void ndr_print_lsa_ForestTrustData(struct ndr_print *ndr, const char *name, const union lsa_ForestTrustData *r); +_PUBLIC_ void ndr_print_lsa_ForestTrustRecordType(struct ndr_print *ndr, const char *name, enum lsa_ForestTrustRecordType r); +_PUBLIC_ void ndr_print_lsa_ForestTrustRecord(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustRecord *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_ForestTrustInformation(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustInformation *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_ForestTrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustInformation *r); +_PUBLIC_ void ndr_print_lsa_ForestTrustInformation(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustInformation *r); +_PUBLIC_ void ndr_print_lsa_Close(struct ndr_print *ndr, const char *name, int flags, const struct lsa_Close *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, const struct lsa_Delete *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_Delete(struct ndr_pull *ndr, int flags, struct lsa_Delete *r); +_PUBLIC_ void ndr_print_lsa_Delete(struct ndr_print *ndr, const char *name, int flags, const struct lsa_Delete *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags, const struct lsa_EnumPrivs *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flags, struct lsa_EnumPrivs *r); +_PUBLIC_ void ndr_print_lsa_EnumPrivs(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumPrivs *r); +_PUBLIC_ void ndr_print_lsa_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QuerySecurity *r); +_PUBLIC_ void ndr_print_lsa_SetSecObj(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSecObj *r); +_PUBLIC_ void ndr_print_lsa_ChangePassword(struct ndr_print *ndr, const char *name, int flags, const struct lsa_ChangePassword *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy *r); +_PUBLIC_ void ndr_print_lsa_OpenPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenPolicy *r); +_PUBLIC_ void ndr_print_lsa_QueryInfoPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryInfoPolicy *r); +_PUBLIC_ void ndr_print_lsa_SetInfoPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInfoPolicy *r); +_PUBLIC_ void ndr_print_lsa_ClearAuditLog(struct ndr_print *ndr, const char *name, int flags, const struct lsa_ClearAuditLog *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int flags, const struct lsa_CreateAccount *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r); +_PUBLIC_ void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateAccount *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int flags, const struct lsa_EnumAccounts *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int flags, struct lsa_EnumAccounts *r); +_PUBLIC_ void ndr_print_lsa_EnumAccounts(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumAccounts *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomain *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomain *r); +_PUBLIC_ void ndr_print_lsa_CreateTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomain *r); +_PUBLIC_ void ndr_print_lsa_EnumTrustDom(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumTrustDom *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flags, const struct lsa_LookupNames *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flags, struct lsa_LookupNames *r); +_PUBLIC_ void ndr_print_lsa_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags, const struct lsa_LookupSids *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, int flags, struct lsa_LookupSids *r); +_PUBLIC_ void ndr_print_lsa_LookupSids(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int flags, const struct lsa_CreateSecret *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int flags, struct lsa_CreateSecret *r); +_PUBLIC_ void ndr_print_lsa_CreateSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateSecret *r); +_PUBLIC_ void ndr_print_lsa_OpenAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenAccount *r); +_PUBLIC_ void ndr_print_lsa_EnumPrivsAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumPrivsAccount *r); +_PUBLIC_ void ndr_print_lsa_AddPrivilegesToAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_AddPrivilegesToAccount *r); +_PUBLIC_ void ndr_print_lsa_RemovePrivilegesFromAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_RemovePrivilegesFromAccount *r); +_PUBLIC_ void ndr_print_lsa_GetQuotasForAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_GetQuotasForAccount *r); +_PUBLIC_ void ndr_print_lsa_SetQuotasForAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetQuotasForAccount *r); +_PUBLIC_ void ndr_print_lsa_GetSystemAccessAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_GetSystemAccessAccount *r); +_PUBLIC_ void ndr_print_lsa_SetSystemAccessAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSystemAccessAccount *r); +_PUBLIC_ void ndr_print_lsa_OpenTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenTrustedDomain *r); +_PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryTrustedDomainInfo *r); +_PUBLIC_ void ndr_print_lsa_SetInformationTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInformationTrustedDomain *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags, const struct lsa_OpenSecret *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int flags, struct lsa_OpenSecret *r); +_PUBLIC_ void ndr_print_lsa_OpenSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenSecret *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags, const struct lsa_SetSecret *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_SetSecret(struct ndr_pull *ndr, int flags, struct lsa_SetSecret *r); +_PUBLIC_ void ndr_print_lsa_SetSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSecret *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flags, const struct lsa_QuerySecret *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_QuerySecret(struct ndr_pull *ndr, int flags, struct lsa_QuerySecret *r); +_PUBLIC_ void ndr_print_lsa_QuerySecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QuerySecret *r); +_PUBLIC_ void ndr_print_lsa_LookupPrivValue(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivValue *r); +_PUBLIC_ void ndr_print_lsa_LookupPrivName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivName *r); +_PUBLIC_ void ndr_print_lsa_LookupPrivDisplayName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivDisplayName *r); +_PUBLIC_ void ndr_print_lsa_DeleteObject(struct ndr_print *ndr, const char *name, int flags, const struct lsa_DeleteObject *r); +_PUBLIC_ void ndr_print_lsa_EnumAccountsWithUserRight(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumAccountsWithUserRight *r); +_PUBLIC_ void ndr_print_lsa_EnumAccountRights(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumAccountRights *r); +_PUBLIC_ void ndr_print_lsa_AddAccountRights(struct ndr_print *ndr, const char *name, int flags, const struct lsa_AddAccountRights *r); +_PUBLIC_ void ndr_print_lsa_RemoveAccountRights(struct ndr_print *ndr, const char *name, int flags, const struct lsa_RemoveAccountRights *r); +_PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfoBySid(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryTrustedDomainInfoBySid *r); +_PUBLIC_ void ndr_print_lsa_SetTrustedDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetTrustedDomainInfo *r); +_PUBLIC_ void ndr_print_lsa_DeleteTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_DeleteTrustedDomain *r); +_PUBLIC_ void ndr_print_lsa_StorePrivateData(struct ndr_print *ndr, const char *name, int flags, const struct lsa_StorePrivateData *r); +_PUBLIC_ void ndr_print_lsa_RetrievePrivateData(struct ndr_print *ndr, const char *name, int flags, const struct lsa_RetrievePrivateData *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy2 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy2 *r); +_PUBLIC_ void ndr_print_lsa_OpenPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenPolicy2 *r); +_PUBLIC_ void ndr_print_lsa_GetUserName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_GetUserName *r); +_PUBLIC_ void ndr_print_lsa_QueryInfoPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryInfoPolicy2 *r); +_PUBLIC_ void ndr_print_lsa_SetInfoPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInfoPolicy2 *r); +_PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfoByName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryTrustedDomainInfoByName *r); +_PUBLIC_ void ndr_print_lsa_SetTrustedDomainInfoByName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetTrustedDomainInfoByName *r); +_PUBLIC_ void ndr_print_lsa_EnumTrustedDomainsEx(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumTrustedDomainsEx *r); +_PUBLIC_ void ndr_print_lsa_CreateTrustedDomainEx(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomainEx *r); +_PUBLIC_ void ndr_print_lsa_CloseTrustedDomainEx(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CloseTrustedDomainEx *r); +_PUBLIC_ void ndr_print_lsa_QueryDomainInformationPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryDomainInformationPolicy *r); +_PUBLIC_ void ndr_print_lsa_SetDomainInformationPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetDomainInformationPolicy *r); +_PUBLIC_ void ndr_print_lsa_OpenTrustedDomainByName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenTrustedDomainByName *r); +_PUBLIC_ void ndr_print_lsa_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct lsa_TestCall *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flags, const struct lsa_LookupSids2 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids2(struct ndr_pull *ndr, int flags, struct lsa_LookupSids2 *r); +_PUBLIC_ void ndr_print_lsa_LookupSids2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids2 *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int flags, const struct lsa_LookupNames2 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int flags, struct lsa_LookupNames2 *r); +_PUBLIC_ void ndr_print_lsa_LookupNames2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames2 *r); +_PUBLIC_ void ndr_print_lsa_CreateTrustedDomainEx2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomainEx2 *r); +_PUBLIC_ void ndr_print_lsa_CREDRWRITE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRWRITE *r); +_PUBLIC_ void ndr_print_lsa_CREDRREAD(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRREAD *r); +_PUBLIC_ void ndr_print_lsa_CREDRENUMERATE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRENUMERATE *r); +_PUBLIC_ void ndr_print_lsa_CREDRWRITEDOMAINCREDENTIALS(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRWRITEDOMAINCREDENTIALS *r); +_PUBLIC_ void ndr_print_lsa_CREDRREADDOMAINCREDENTIALS(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRREADDOMAINCREDENTIALS *r); +_PUBLIC_ void ndr_print_lsa_CREDRDELETE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRDELETE *r); +_PUBLIC_ void ndr_print_lsa_CREDRGETTARGETINFO(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRGETTARGETINFO *r); +_PUBLIC_ void ndr_print_lsa_CREDRPROFILELOADED(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRPROFILELOADED *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int flags, const struct lsa_LookupNames3 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int flags, struct lsa_LookupNames3 *r); +_PUBLIC_ void ndr_print_lsa_LookupNames3(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames3 *r); +_PUBLIC_ void ndr_print_lsa_CREDRGETSESSIONTYPES(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRGETSESSIONTYPES *r); +_PUBLIC_ void ndr_print_lsa_LSARREGISTERAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARREGISTERAUDITEVENT *r); +_PUBLIC_ void ndr_print_lsa_LSARGENAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARGENAUDITEVENT *r); +_PUBLIC_ void ndr_print_lsa_LSARUNREGISTERAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARUNREGISTERAUDITEVENT *r); +_PUBLIC_ void ndr_print_lsa_lsaRQueryForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct lsa_lsaRQueryForestTrustInformation *r); +_PUBLIC_ void ndr_print_lsa_LSARSETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARSETFORESTTRUSTINFORMATION *r); +_PUBLIC_ void ndr_print_lsa_CREDRRENAME(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRRENAME *r); +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flags, const struct lsa_LookupSids3 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids3(struct ndr_pull *ndr, int flags, struct lsa_LookupSids3 *r); +_PUBLIC_ void ndr_print_lsa_LookupSids3(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids3 *r); +_PUBLIC_ void ndr_print_lsa_LookupNames4(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames4 *r); +_PUBLIC_ void ndr_print_lsa_LSAROPENPOLICYSCE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSAROPENPOLICYSCE *r); +_PUBLIC_ void ndr_print_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r); +_PUBLIC_ void ndr_print_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r); +_PUBLIC_ void ndr_print_lsa_LSARADTREPORTSECURITYEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARADTREPORTSECURITYEVENT *r); + +/* The following definitions come from librpc/gen_ndr/ndr_misc.c */ + +_PUBLIC_ enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r); +_PUBLIC_ enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r); +_PUBLIC_ size_t ndr_size_GUID(const struct GUID *r, int flags); +_PUBLIC_ enum ndr_err_code ndr_push_ndr_syntax_id(struct ndr_push *ndr, int ndr_flags, const struct ndr_syntax_id *r); +_PUBLIC_ enum ndr_err_code ndr_pull_ndr_syntax_id(struct ndr_pull *ndr, int ndr_flags, struct ndr_syntax_id *r); +_PUBLIC_ void ndr_print_ndr_syntax_id(struct ndr_print *ndr, const char *name, const struct ndr_syntax_id *r); +_PUBLIC_ enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r); +_PUBLIC_ enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r); +_PUBLIC_ void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int ndr_flags, enum netr_SchannelType r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_SchannelType(struct ndr_pull *ndr, int ndr_flags, enum netr_SchannelType *r); +_PUBLIC_ void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *name, enum netr_SchannelType r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_SamDatabaseID(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamDatabaseID(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID *r); +_PUBLIC_ void ndr_print_netr_SamDatabaseID(struct ndr_print *ndr, const char *name, enum netr_SamDatabaseID r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_RejectReason(struct ndr_push *ndr, int ndr_flags, enum samr_RejectReason r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_RejectReason(struct ndr_pull *ndr, int ndr_flags, enum samr_RejectReason *r); +_PUBLIC_ void ndr_print_samr_RejectReason(struct ndr_print *ndr, const char *name, enum samr_RejectReason r); + +/* The following definitions come from librpc/gen_ndr/ndr_nbt.c */ + +_PUBLIC_ void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r); +_PUBLIC_ void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r); +_PUBLIC_ void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r); +_PUBLIC_ void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r); +_PUBLIC_ void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r); +_PUBLIC_ void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r); +_PUBLIC_ void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r); +_PUBLIC_ void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r); +_PUBLIC_ void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r); +_PUBLIC_ void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r); +_PUBLIC_ void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r); +_PUBLIC_ void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r); +_PUBLIC_ void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r); +_PUBLIC_ void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r); +_PUBLIC_ void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r); +_PUBLIC_ void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r); +_PUBLIC_ void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r); +_PUBLIC_ void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r); +_PUBLIC_ void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r); +_PUBLIC_ void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r); +_PUBLIC_ void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r); +_PUBLIC_ enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r); +_PUBLIC_ enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r); +_PUBLIC_ void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r); +_PUBLIC_ void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r); +_PUBLIC_ void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r); +_PUBLIC_ void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r); +_PUBLIC_ void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r); +_PUBLIC_ void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r); +_PUBLIC_ void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r); +_PUBLIC_ void ndr_print_nbt_netlogon_version(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r); +_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r); +_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r); +_PUBLIC_ void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_nbt_dc_sock_addr(struct ndr_print *ndr, const char *name, const struct nbt_dc_sock_addr *r); +_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r); +_PUBLIC_ void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r); +_PUBLIC_ void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r); +_PUBLIC_ void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r); +_PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r); +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r); +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_5(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_5 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_5(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_5 *r); +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r); +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_15(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_15 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_15(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_15 *r); +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_15(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_15 *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_29(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_29 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_29(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_29 *r); +_PUBLIC_ void ndr_print_nbt_cldap_netlogon_29(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_29 *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r); +_PUBLIC_ void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r); +_PUBLIC_ void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r); +_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r); +_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r); +_PUBLIC_ void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *r); +_PUBLIC_ void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r); +_PUBLIC_ void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r); +_PUBLIC_ void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r); +_PUBLIC_ void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r); +_PUBLIC_ void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r); +_PUBLIC_ void ndr_print_nbt_browse_backup_list_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_request *r); +_PUBLIC_ void ndr_print_nbt_browse_backup_list_response(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_response *r); +_PUBLIC_ void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r); +_PUBLIC_ void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r); +_PUBLIC_ void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r); +_PUBLIC_ void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r); +_PUBLIC_ void ndr_print_nbt_browse_local_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_local_master_announcement *r); +_PUBLIC_ void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r); +_PUBLIC_ enum ndr_err_code ndr_push_nbt_browse_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_packet *r); +_PUBLIC_ enum ndr_err_code ndr_pull_nbt_browse_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_packet *r); +_PUBLIC_ void ndr_print_nbt_browse_packet(struct ndr_print *ndr, const char *name, const struct nbt_browse_packet *r); + +/* The following definitions come from librpc/gen_ndr/ndr_netlogon.c */ + +_PUBLIC_ void ndr_print_netr_UasInfo(struct ndr_print *ndr, const char *name, const struct netr_UasInfo *r); +_PUBLIC_ void ndr_print_netr_UasLogoffInfo(struct ndr_print *ndr, const char *name, const struct netr_UasLogoffInfo *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_AcctLockStr(struct ndr_push *ndr, int ndr_flags, const struct netr_AcctLockStr *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_AcctLockStr(struct ndr_pull *ndr, int ndr_flags, struct netr_AcctLockStr *r); +_PUBLIC_ void ndr_print_netr_AcctLockStr(struct ndr_print *ndr, const char *name, const struct netr_AcctLockStr *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_LogonParameterControl(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonParameterControl(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_netr_LogonParameterControl(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_netr_IdentityInfo(struct ndr_print *ndr, const char *name, const struct netr_IdentityInfo *r); +_PUBLIC_ void ndr_print_netr_PasswordInfo(struct ndr_print *ndr, const char *name, const struct netr_PasswordInfo *r); +_PUBLIC_ void ndr_print_netr_ChallengeResponse(struct ndr_print *ndr, const char *name, const struct netr_ChallengeResponse *r); +_PUBLIC_ void ndr_print_netr_NetworkInfo(struct ndr_print *ndr, const char *name, const struct netr_NetworkInfo *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_LogonInfo(struct ndr_push *ndr, int ndr_flags, const union netr_LogonInfo *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr_flags, union netr_LogonInfo *r); +_PUBLIC_ void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name, const union netr_LogonInfo *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_UserSessionKey(struct ndr_push *ndr, int ndr_flags, const struct netr_UserSessionKey *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_UserSessionKey(struct ndr_pull *ndr, int ndr_flags, struct netr_UserSessionKey *r); +_PUBLIC_ void ndr_print_netr_UserSessionKey(struct ndr_print *ndr, const char *name, const struct netr_UserSessionKey *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_LMSessionKey(struct ndr_push *ndr, int ndr_flags, const struct netr_LMSessionKey *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_LMSessionKey(struct ndr_pull *ndr, int ndr_flags, struct netr_LMSessionKey *r); +_PUBLIC_ void ndr_print_netr_LMSessionKey(struct ndr_print *ndr, const char *name, const struct netr_LMSessionKey *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_UserFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_UserFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_netr_UserFlags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_netr_SamBaseInfo(struct ndr_print *ndr, const char *name, const struct netr_SamBaseInfo *r); +_PUBLIC_ void ndr_print_netr_SamInfo2(struct ndr_print *ndr, const char *name, const struct netr_SamInfo2 *r); +_PUBLIC_ void ndr_print_netr_SidAttr(struct ndr_print *ndr, const char *name, const struct netr_SidAttr *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_SamInfo3(struct ndr_push *ndr, int ndr_flags, const struct netr_SamInfo3 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamInfo3(struct ndr_pull *ndr, int ndr_flags, struct netr_SamInfo3 *r); +_PUBLIC_ void ndr_print_netr_SamInfo3(struct ndr_print *ndr, const char *name, const struct netr_SamInfo3 *r); +_PUBLIC_ void ndr_print_netr_SamInfo6(struct ndr_print *ndr, const char *name, const struct netr_SamInfo6 *r); +_PUBLIC_ void ndr_print_netr_PacInfo(struct ndr_print *ndr, const char *name, const struct netr_PacInfo *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_Validation(struct ndr_push *ndr, int ndr_flags, const union netr_Validation *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int ndr_flags, union netr_Validation *r); +_PUBLIC_ void ndr_print_netr_Validation(struct ndr_print *ndr, const char *name, const union netr_Validation *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_Credential(struct ndr_push *ndr, int ndr_flags, const struct netr_Credential *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_Credential(struct ndr_pull *ndr, int ndr_flags, struct netr_Credential *r); +_PUBLIC_ void ndr_print_netr_Credential(struct ndr_print *ndr, const char *name, const struct netr_Credential *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_Authenticator(struct ndr_push *ndr, int ndr_flags, const struct netr_Authenticator *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_Authenticator(struct ndr_pull *ndr, int ndr_flags, struct netr_Authenticator *r); +_PUBLIC_ void ndr_print_netr_Authenticator(struct ndr_print *ndr, const char *name, const struct netr_Authenticator *r); +_PUBLIC_ void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name, enum netr_LogonLevel r); +_PUBLIC_ void ndr_print_netr_DELTA_DELETE_USER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_USER *r); +_PUBLIC_ void ndr_print_netr_USER_KEY16(struct ndr_print *ndr, const char *name, const struct netr_USER_KEY16 *r); +_PUBLIC_ void ndr_print_netr_PasswordHistory(struct ndr_print *ndr, const char *name, const struct netr_PasswordHistory *r); +_PUBLIC_ void ndr_print_netr_USER_KEYS2(struct ndr_print *ndr, const char *name, const struct netr_USER_KEYS2 *r); +_PUBLIC_ void ndr_print_netr_USER_KEY_UNION(struct ndr_print *ndr, const char *name, const struct netr_USER_KEY_UNION *r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_USER_KEYS(struct ndr_push *ndr, int ndr_flags, const struct netr_USER_KEYS *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_USER_KEYS(struct ndr_pull *ndr, int ndr_flags, struct netr_USER_KEYS *r); +_PUBLIC_ void ndr_print_netr_USER_KEYS(struct ndr_print *ndr, const char *name, const struct netr_USER_KEYS *r); +_PUBLIC_ void ndr_print_netr_USER_PRIVATE_INFO(struct ndr_print *ndr, const char *name, const struct netr_USER_PRIVATE_INFO *r); +_PUBLIC_ void ndr_print_netr_DELTA_USER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_USER *r); +_PUBLIC_ void ndr_print_netr_DELTA_DOMAIN(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DOMAIN *r); +_PUBLIC_ void ndr_print_netr_DELTA_GROUP(struct ndr_print *ndr, const char *name, const struct netr_DELTA_GROUP *r); +_PUBLIC_ void ndr_print_netr_DELTA_RENAME(struct ndr_print *ndr, const char *name, const struct netr_DELTA_RENAME *r); +_PUBLIC_ void ndr_print_netr_DELTA_GROUP_MEMBER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_GROUP_MEMBER *r); +_PUBLIC_ void ndr_print_netr_DELTA_ALIAS(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ALIAS *r); +_PUBLIC_ void ndr_print_netr_DELTA_ALIAS_MEMBER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ALIAS_MEMBER *r); +_PUBLIC_ void ndr_print_netr_QUOTA_LIMITS(struct ndr_print *ndr, const char *name, const struct netr_QUOTA_LIMITS *r); +_PUBLIC_ void ndr_print_netr_DELTA_POLICY(struct ndr_print *ndr, const char *name, const struct netr_DELTA_POLICY *r); +_PUBLIC_ void ndr_print_netr_DELTA_TRUSTED_DOMAIN(struct ndr_print *ndr, const char *name, const struct netr_DELTA_TRUSTED_DOMAIN *r); +_PUBLIC_ void ndr_print_netr_DELTA_DELETE_TRUST(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_TRUST *r); +_PUBLIC_ void ndr_print_netr_DELTA_ACCOUNT(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ACCOUNT *r); +_PUBLIC_ void ndr_print_netr_DELTA_DELETE_ACCOUNT(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_ACCOUNT *r); +_PUBLIC_ void ndr_print_netr_DELTA_DELETE_SECRET(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_SECRET *r); +_PUBLIC_ void ndr_print_netr_CIPHER_VALUE(struct ndr_print *ndr, const char *name, const struct netr_CIPHER_VALUE *r); +_PUBLIC_ void ndr_print_netr_DELTA_SECRET(struct ndr_print *ndr, const char *name, const struct netr_DELTA_SECRET *r); +_PUBLIC_ void ndr_print_netr_DeltaEnum(struct ndr_print *ndr, const char *name, enum netr_DeltaEnum r); +_PUBLIC_ void ndr_print_netr_DELTA_UNION(struct ndr_print *ndr, const char *name, const union netr_DELTA_UNION *r); +_PUBLIC_ void ndr_print_netr_DELTA_ID_UNION(struct ndr_print *ndr, const char *name, const union netr_DELTA_ID_UNION *r); +_PUBLIC_ void ndr_print_netr_DELTA_ENUM(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ENUM *r); +_PUBLIC_ void ndr_print_netr_DELTA_ENUM_ARRAY(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ENUM_ARRAY *r); +_PUBLIC_ void ndr_print_netr_UAS_INFO_0(struct ndr_print *ndr, const char *name, const struct netr_UAS_INFO_0 *r); +_PUBLIC_ void ndr_print_netr_AccountBuffer(struct ndr_print *ndr, const char *name, const struct netr_AccountBuffer *r); +_PUBLIC_ void ndr_print_netr_InfoFlags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_netr_NETLOGON_INFO_1(struct ndr_print *ndr, const char *name, const struct netr_NETLOGON_INFO_1 *r); +_PUBLIC_ void ndr_print_netr_NETLOGON_INFO_2(struct ndr_print *ndr, const char *name, const struct netr_NETLOGON_INFO_2 *r); +_PUBLIC_ void ndr_print_netr_NETLOGON_INFO_3(struct ndr_print *ndr, const char *name, const struct netr_NETLOGON_INFO_3 *r); +_PUBLIC_ void ndr_print_netr_CONTROL_QUERY_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_QUERY_INFORMATION *r); +_PUBLIC_ void ndr_print_netr_LogonControlCode(struct ndr_print *ndr, const char *name, enum netr_LogonControlCode r); +_PUBLIC_ void ndr_print_netr_CONTROL_DATA_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_DATA_INFORMATION *r); +_PUBLIC_ void ndr_print_netr_NegotiateFlags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_netr_Blob(struct ndr_print *ndr, const char *name, const struct netr_Blob *r); +_PUBLIC_ void ndr_print_netr_DsRGetDCName_flags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo_AddressType(struct ndr_print *ndr, const char *name, enum netr_DsRGetDCNameInfo_AddressType r); +_PUBLIC_ void ndr_print_netr_DsR_DcFlags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_push_netr_DsRGetDCNameInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRGetDCNameInfo *r); +_PUBLIC_ enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRGetDCNameInfo *r); +_PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char *name, const struct netr_DsRGetDCNameInfo *r); +_PUBLIC_ void ndr_print_netr_BinaryString(struct ndr_print *ndr, const char *name, const struct netr_BinaryString *r); +_PUBLIC_ void ndr_print_netr_DomainQuery1(struct ndr_print *ndr, const char *name, const struct netr_DomainQuery1 *r); +_PUBLIC_ void ndr_print_netr_DomainQuery(struct ndr_print *ndr, const char *name, const union netr_DomainQuery *r); +_PUBLIC_ void ndr_print_netr_DomainTrustInfo(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustInfo *r); +_PUBLIC_ void ndr_print_netr_DomainInfo1(struct ndr_print *ndr, const char *name, const struct netr_DomainInfo1 *r); +_PUBLIC_ void ndr_print_netr_DomainInfo(struct ndr_print *ndr, const char *name, const union netr_DomainInfo *r); +_PUBLIC_ void ndr_print_netr_CryptPassword(struct ndr_print *ndr, const char *name, const struct netr_CryptPassword *r); +_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesWCtr *r); +_PUBLIC_ void ndr_print_netr_DsRAddress(struct ndr_print *ndr, const char *name, const struct netr_DsRAddress *r); +_PUBLIC_ void ndr_print_netr_TrustFlags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_netr_TrustType(struct ndr_print *ndr, const char *name, enum netr_TrustType r); +_PUBLIC_ void ndr_print_netr_TrustAttributes(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_netr_DomainTrust(struct ndr_print *ndr, const char *name, const struct netr_DomainTrust *r); +_PUBLIC_ void ndr_print_netr_DomainTrustList(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustList *r); +_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesExWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesExWCtr *r); +_PUBLIC_ void ndr_print_DcSitesCtr(struct ndr_print *ndr, const char *name, const struct DcSitesCtr *r); +_PUBLIC_ void ndr_print_netr_LogonUasLogon(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonUasLogon *r); +_PUBLIC_ void ndr_print_netr_LogonUasLogoff(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonUasLogoff *r); +_PUBLIC_ void ndr_print_netr_LogonSamLogon(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogon *r); +_PUBLIC_ void ndr_print_netr_LogonSamLogoff(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogoff *r); +_PUBLIC_ void ndr_print_netr_ServerReqChallenge(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerReqChallenge *r); +_PUBLIC_ void ndr_print_netr_ServerAuthenticate(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate *r); +_PUBLIC_ void ndr_print_netr_ServerPasswordSet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordSet *r); +_PUBLIC_ void ndr_print_netr_DatabaseDeltas(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseDeltas *r); +_PUBLIC_ void ndr_print_netr_DatabaseSync(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseSync *r); +_PUBLIC_ void ndr_print_netr_AccountDeltas(struct ndr_print *ndr, const char *name, int flags, const struct netr_AccountDeltas *r); +_PUBLIC_ void ndr_print_netr_AccountSync(struct ndr_print *ndr, const char *name, int flags, const struct netr_AccountSync *r); +_PUBLIC_ void ndr_print_netr_GetDcName(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetDcName *r); +_PUBLIC_ void ndr_print_netr_LogonControl(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonControl *r); +_PUBLIC_ void ndr_print_netr_GetAnyDCName(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetAnyDCName *r); +_PUBLIC_ void ndr_print_netr_LogonControl2(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonControl2 *r); +_PUBLIC_ void ndr_print_netr_ServerAuthenticate2(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate2 *r); +_PUBLIC_ void ndr_print_netr_DatabaseSync2(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseSync2 *r); +_PUBLIC_ void ndr_print_netr_DatabaseRedo(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseRedo *r); +_PUBLIC_ void ndr_print_netr_LogonControl2Ex(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonControl2Ex *r); +_PUBLIC_ void ndr_print_netr_NetrEnumerateTrustedDomains(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomains *r); +_PUBLIC_ void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCName *r); +_PUBLIC_ void ndr_print_netr_NETRLOGONDUMMYROUTINE1(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONDUMMYROUTINE1 *r); +_PUBLIC_ void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSETSERVICEBITS *r); +_PUBLIC_ void ndr_print_netr_LogonGetTrustRid(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetTrustRid *r); +_PUBLIC_ void ndr_print_netr_NETRLOGONCOMPUTESERVERDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTESERVERDIGEST *r); +_PUBLIC_ void ndr_print_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r); +_PUBLIC_ void ndr_print_netr_ServerAuthenticate3(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate3 *r); +_PUBLIC_ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCNameEx *r); +_PUBLIC_ void ndr_print_netr_DsRGetSiteName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetSiteName *r); +_PUBLIC_ void ndr_print_netr_LogonGetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetDomainInfo *r); +_PUBLIC_ void ndr_print_netr_ServerPasswordSet2(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordSet2 *r); +_PUBLIC_ void ndr_print_netr_ServerPasswordGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordGet *r); +_PUBLIC_ void ndr_print_netr_NETRLOGONSENDTOSAM(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSENDTOSAM *r); +_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesW *r); +_PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCNameEx2 *r); +_PUBLIC_ void ndr_print_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r); +_PUBLIC_ void ndr_print_netr_NetrEnumerateTrustedDomainsEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomainsEx *r); +_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesExW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesExW *r); +_PUBLIC_ void ndr_print_netr_DsrGetDcSiteCoverageW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrGetDcSiteCoverageW *r); +_PUBLIC_ void ndr_print_netr_LogonSamLogonEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonEx *r); +_PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrEnumerateDomainTrusts *r); +_PUBLIC_ void ndr_print_netr_DsrDeregisterDNSHostRecords(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrDeregisterDNSHostRecords *r); +_PUBLIC_ void ndr_print_netr_ServerTrustPasswordsGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerTrustPasswordsGet *r); +_PUBLIC_ void ndr_print_netr_DsRGetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetForestTrustInformation *r); +_PUBLIC_ void ndr_print_netr_GetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetForestTrustInformation *r); +_PUBLIC_ void ndr_print_netr_LogonSamLogonWithFlags(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonWithFlags *r); +_PUBLIC_ void ndr_print_netr_NETRSERVERGETTRUSTINFO(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERGETTRUSTINFO *r); + +/* The following definitions come from librpc/gen_ndr/ndr_notify.c */ + +_PUBLIC_ enum ndr_err_code ndr_push_notify_entry(struct ndr_push *ndr, int ndr_flags, const struct notify_entry *r); +_PUBLIC_ enum ndr_err_code ndr_pull_notify_entry(struct ndr_pull *ndr, int ndr_flags, struct notify_entry *r); +_PUBLIC_ void ndr_print_notify_entry(struct ndr_print *ndr, const char *name, const struct notify_entry *r); +_PUBLIC_ void ndr_print_notify_depth(struct ndr_print *ndr, const char *name, const struct notify_depth *r); +_PUBLIC_ enum ndr_err_code ndr_push_notify_array(struct ndr_push *ndr, int ndr_flags, const struct notify_array *r); +_PUBLIC_ enum ndr_err_code ndr_pull_notify_array(struct ndr_pull *ndr, int ndr_flags, struct notify_array *r); +_PUBLIC_ void ndr_print_notify_array(struct ndr_print *ndr, const char *name, const struct notify_array *r); +_PUBLIC_ enum ndr_err_code ndr_push_notify_event(struct ndr_push *ndr, int ndr_flags, const struct notify_event *r); +_PUBLIC_ enum ndr_err_code ndr_pull_notify_event(struct ndr_pull *ndr, int ndr_flags, struct notify_event *r); +_PUBLIC_ void ndr_print_notify_event(struct ndr_print *ndr, const char *name, const struct notify_event *r); + +/* The following definitions come from librpc/gen_ndr/ndr_ntsvcs.c */ + +_PUBLIC_ void ndr_print_PNP_HwProfInfo(struct ndr_print *ndr, const char *name, const struct PNP_HwProfInfo *r); +_PUBLIC_ void ndr_print_PNP_Disconnect(struct ndr_print *ndr, const char *name, int flags, const struct PNP_Disconnect *r); +_PUBLIC_ void ndr_print_PNP_Connect(struct ndr_print *ndr, const char *name, int flags, const struct PNP_Connect *r); +_PUBLIC_ void ndr_print_PNP_GetVersion(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetVersion *r); +_PUBLIC_ void ndr_print_PNP_GetGlobalState(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetGlobalState *r); +_PUBLIC_ void ndr_print_PNP_InitDetection(struct ndr_print *ndr, const char *name, int flags, const struct PNP_InitDetection *r); +_PUBLIC_ void ndr_print_PNP_ReportLogOn(struct ndr_print *ndr, const char *name, int flags, const struct PNP_ReportLogOn *r); +_PUBLIC_ void ndr_print_PNP_ValidateDeviceInstance(struct ndr_print *ndr, const char *name, int flags, const struct PNP_ValidateDeviceInstance *r); +_PUBLIC_ void ndr_print_PNP_GetRootDeviceInstance(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetRootDeviceInstance *r); +_PUBLIC_ void ndr_print_PNP_GetRelatedDeviceInstance(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetRelatedDeviceInstance *r); +_PUBLIC_ void ndr_print_PNP_EnumerateSubKeys(struct ndr_print *ndr, const char *name, int flags, const struct PNP_EnumerateSubKeys *r); +_PUBLIC_ void ndr_print_PNP_GetDeviceList(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceList *r); +_PUBLIC_ void ndr_print_PNP_GetDeviceListSize(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceListSize *r); +_PUBLIC_ void ndr_print_PNP_GetDepth(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDepth *r); +_PUBLIC_ void ndr_print_PNP_GetDeviceRegProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceRegProp *r); +_PUBLIC_ void ndr_print_PNP_SetDeviceRegProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_SetDeviceRegProp *r); +_PUBLIC_ void ndr_print_PNP_GetClassInstance(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetClassInstance *r); +_PUBLIC_ void ndr_print_PNP_CreateKey(struct ndr_print *ndr, const char *name, int flags, const struct PNP_CreateKey *r); +_PUBLIC_ void ndr_print_PNP_DeleteRegistryKey(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DeleteRegistryKey *r); +_PUBLIC_ void ndr_print_PNP_GetClassCount(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetClassCount *r); +_PUBLIC_ void ndr_print_PNP_GetClassName(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetClassName *r); +_PUBLIC_ void ndr_print_PNP_DeleteClassKey(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DeleteClassKey *r); +_PUBLIC_ void ndr_print_PNP_GetInterfaceDeviceAlias(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetInterfaceDeviceAlias *r); +_PUBLIC_ void ndr_print_PNP_GetInterfaceDeviceList(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetInterfaceDeviceList *r); +_PUBLIC_ void ndr_print_PNP_GetInterfaceDeviceListSize(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetInterfaceDeviceListSize *r); +_PUBLIC_ void ndr_print_PNP_RegisterDeviceClassAssociation(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RegisterDeviceClassAssociation *r); +_PUBLIC_ void ndr_print_PNP_UnregisterDeviceClassAssociation(struct ndr_print *ndr, const char *name, int flags, const struct PNP_UnregisterDeviceClassAssociation *r); +_PUBLIC_ void ndr_print_PNP_GetClassRegProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetClassRegProp *r); +_PUBLIC_ void ndr_print_PNP_SetClassRegProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_SetClassRegProp *r); +_PUBLIC_ void ndr_print_PNP_CreateDevInst(struct ndr_print *ndr, const char *name, int flags, const struct PNP_CreateDevInst *r); +_PUBLIC_ void ndr_print_PNP_DeviceInstanceAction(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DeviceInstanceAction *r); +_PUBLIC_ void ndr_print_PNP_GetDeviceStatus(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceStatus *r); +_PUBLIC_ void ndr_print_PNP_SetDeviceProblem(struct ndr_print *ndr, const char *name, int flags, const struct PNP_SetDeviceProblem *r); +_PUBLIC_ void ndr_print_PNP_DisableDevInst(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DisableDevInst *r); +_PUBLIC_ void ndr_print_PNP_UninstallDevInst(struct ndr_print *ndr, const char *name, int flags, const struct PNP_UninstallDevInst *r); +_PUBLIC_ void ndr_print_PNP_AddID(struct ndr_print *ndr, const char *name, int flags, const struct PNP_AddID *r); +_PUBLIC_ void ndr_print_PNP_RegisterDriver(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RegisterDriver *r); +_PUBLIC_ void ndr_print_PNP_QueryRemove(struct ndr_print *ndr, const char *name, int flags, const struct PNP_QueryRemove *r); +_PUBLIC_ void ndr_print_PNP_RequestDeviceEject(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RequestDeviceEject *r); +_PUBLIC_ void ndr_print_PNP_IsDockStationPresent(struct ndr_print *ndr, const char *name, int flags, const struct PNP_IsDockStationPresent *r); +_PUBLIC_ void ndr_print_PNP_RequestEjectPC(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RequestEjectPC *r); +_PUBLIC_ void ndr_print_PNP_HwProfFlags(struct ndr_print *ndr, const char *name, int flags, const struct PNP_HwProfFlags *r); +_PUBLIC_ void ndr_print_PNP_GetHwProfInfo(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetHwProfInfo *r); +_PUBLIC_ void ndr_print_PNP_AddEmptyLogConf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_AddEmptyLogConf *r); +_PUBLIC_ void ndr_print_PNP_FreeLogConf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_FreeLogConf *r); +_PUBLIC_ void ndr_print_PNP_GetFirstLogConf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetFirstLogConf *r); +_PUBLIC_ void ndr_print_PNP_GetNextLogConf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetNextLogConf *r); +_PUBLIC_ void ndr_print_PNP_GetLogConfPriority(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetLogConfPriority *r); +_PUBLIC_ void ndr_print_PNP_AddResDes(struct ndr_print *ndr, const char *name, int flags, const struct PNP_AddResDes *r); +_PUBLIC_ void ndr_print_PNP_FreeResDes(struct ndr_print *ndr, const char *name, int flags, const struct PNP_FreeResDes *r); +_PUBLIC_ void ndr_print_PNP_GetNextResDes(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetNextResDes *r); +_PUBLIC_ void ndr_print_PNP_GetResDesData(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetResDesData *r); +_PUBLIC_ void ndr_print_PNP_GetResDesDataSize(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetResDesDataSize *r); +_PUBLIC_ void ndr_print_PNP_ModifyResDes(struct ndr_print *ndr, const char *name, int flags, const struct PNP_ModifyResDes *r); +_PUBLIC_ void ndr_print_PNP_DetectResourceLimit(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DetectResourceLimit *r); +_PUBLIC_ void ndr_print_PNP_QueryResConfList(struct ndr_print *ndr, const char *name, int flags, const struct PNP_QueryResConfList *r); +_PUBLIC_ void ndr_print_PNP_SetHwProf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_SetHwProf *r); +_PUBLIC_ void ndr_print_PNP_QueryArbitratorFreeData(struct ndr_print *ndr, const char *name, int flags, const struct PNP_QueryArbitratorFreeData *r); +_PUBLIC_ void ndr_print_PNP_QueryArbitratorFreeSize(struct ndr_print *ndr, const char *name, int flags, const struct PNP_QueryArbitratorFreeSize *r); +_PUBLIC_ void ndr_print_PNP_RunDetection(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RunDetection *r); +_PUBLIC_ void ndr_print_PNP_RegisterNotification(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RegisterNotification *r); +_PUBLIC_ void ndr_print_PNP_UnregisterNotification(struct ndr_print *ndr, const char *name, int flags, const struct PNP_UnregisterNotification *r); +_PUBLIC_ void ndr_print_PNP_GetCustomDevProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetCustomDevProp *r); +_PUBLIC_ void ndr_print_PNP_GetVersionInternal(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetVersionInternal *r); +_PUBLIC_ void ndr_print_PNP_GetBlockedDriverInfo(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetBlockedDriverInfo *r); +_PUBLIC_ void ndr_print_PNP_GetServerSideDeviceInstallFlags(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetServerSideDeviceInstallFlags *r); + +/* The following definitions come from librpc/gen_ndr/ndr_samr.c */ + +_PUBLIC_ enum ndr_err_code ndr_push_samr_AcctFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_AcctFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_samr_AcctFlags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_ConnectAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_UserAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_DomainAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_GroupAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_AliasAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_SamEntry(struct ndr_print *ndr, const char *name, const struct samr_SamEntry *r); +_PUBLIC_ void ndr_print_samr_SamArray(struct ndr_print *ndr, const char *name, const struct samr_SamArray *r); +_PUBLIC_ void ndr_print_samr_Role(struct ndr_print *ndr, const char *name, enum samr_Role r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_PasswordProperties(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_PasswordProperties(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_samr_PasswordProperties(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_DomInfo1(struct ndr_print *ndr, const char *name, const struct samr_DomInfo1 *r); +_PUBLIC_ void ndr_print_samr_DomInfo2(struct ndr_print *ndr, const char *name, const struct samr_DomInfo2 *r); +_PUBLIC_ void ndr_print_samr_DomInfo3(struct ndr_print *ndr, const char *name, const struct samr_DomInfo3 *r); +_PUBLIC_ void ndr_print_samr_DomInfo4(struct ndr_print *ndr, const char *name, const struct samr_DomInfo4 *r); +_PUBLIC_ void ndr_print_samr_DomInfo5(struct ndr_print *ndr, const char *name, const struct samr_DomInfo5 *r); +_PUBLIC_ void ndr_print_samr_DomInfo6(struct ndr_print *ndr, const char *name, const struct samr_DomInfo6 *r); +_PUBLIC_ void ndr_print_samr_DomInfo7(struct ndr_print *ndr, const char *name, const struct samr_DomInfo7 *r); +_PUBLIC_ void ndr_print_samr_DomInfo8(struct ndr_print *ndr, const char *name, const struct samr_DomInfo8 *r); +_PUBLIC_ void ndr_print_samr_DomInfo9(struct ndr_print *ndr, const char *name, const struct samr_DomInfo9 *r); +_PUBLIC_ void ndr_print_samr_DomInfo11(struct ndr_print *ndr, const char *name, const struct samr_DomInfo11 *r); +_PUBLIC_ void ndr_print_samr_DomInfo12(struct ndr_print *ndr, const char *name, const struct samr_DomInfo12 *r); +_PUBLIC_ void ndr_print_samr_DomInfo13(struct ndr_print *ndr, const char *name, const struct samr_DomInfo13 *r); +_PUBLIC_ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, const union samr_DomainInfo *r); +_PUBLIC_ void ndr_print_samr_Ids(struct ndr_print *ndr, const char *name, const struct samr_Ids *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_GroupAttrs(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_GroupAttrs(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_samr_GroupAttrs(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_GroupInfoAll(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAll *r); +_PUBLIC_ void ndr_print_samr_GroupInfoAttributes(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAttributes *r); +_PUBLIC_ void ndr_print_samr_GroupInfoEnum(struct ndr_print *ndr, const char *name, enum samr_GroupInfoEnum r); +_PUBLIC_ void ndr_print_samr_GroupInfo(struct ndr_print *ndr, const char *name, const union samr_GroupInfo *r); +_PUBLIC_ void ndr_print_samr_RidTypeArray(struct ndr_print *ndr, const char *name, const struct samr_RidTypeArray *r); +_PUBLIC_ void ndr_print_samr_AliasInfoAll(struct ndr_print *ndr, const char *name, const struct samr_AliasInfoAll *r); +_PUBLIC_ void ndr_print_samr_AliasInfoEnum(struct ndr_print *ndr, const char *name, enum samr_AliasInfoEnum r); +_PUBLIC_ void ndr_print_samr_AliasInfo(struct ndr_print *ndr, const char *name, const union samr_AliasInfo *r); +_PUBLIC_ void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, const struct samr_UserInfo1 *r); +_PUBLIC_ void ndr_print_samr_UserInfo2(struct ndr_print *ndr, const char *name, const struct samr_UserInfo2 *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_LogonHours(struct ndr_push *ndr, int ndr_flags, const struct samr_LogonHours *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_LogonHours(struct ndr_pull *ndr, int ndr_flags, struct samr_LogonHours *r); +_PUBLIC_ void ndr_print_samr_LogonHours(struct ndr_print *ndr, const char *name, const struct samr_LogonHours *r); +_PUBLIC_ void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, const struct samr_UserInfo3 *r); +_PUBLIC_ void ndr_print_samr_UserInfo4(struct ndr_print *ndr, const char *name, const struct samr_UserInfo4 *r); +_PUBLIC_ void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, const struct samr_UserInfo5 *r); +_PUBLIC_ void ndr_print_samr_UserInfo6(struct ndr_print *ndr, const char *name, const struct samr_UserInfo6 *r); +_PUBLIC_ void ndr_print_samr_UserInfo7(struct ndr_print *ndr, const char *name, const struct samr_UserInfo7 *r); +_PUBLIC_ void ndr_print_samr_UserInfo8(struct ndr_print *ndr, const char *name, const struct samr_UserInfo8 *r); +_PUBLIC_ void ndr_print_samr_UserInfo9(struct ndr_print *ndr, const char *name, const struct samr_UserInfo9 *r); +_PUBLIC_ void ndr_print_samr_UserInfo10(struct ndr_print *ndr, const char *name, const struct samr_UserInfo10 *r); +_PUBLIC_ void ndr_print_samr_UserInfo11(struct ndr_print *ndr, const char *name, const struct samr_UserInfo11 *r); +_PUBLIC_ void ndr_print_samr_UserInfo12(struct ndr_print *ndr, const char *name, const struct samr_UserInfo12 *r); +_PUBLIC_ void ndr_print_samr_UserInfo13(struct ndr_print *ndr, const char *name, const struct samr_UserInfo13 *r); +_PUBLIC_ void ndr_print_samr_UserInfo14(struct ndr_print *ndr, const char *name, const struct samr_UserInfo14 *r); +_PUBLIC_ void ndr_print_samr_UserInfo16(struct ndr_print *ndr, const char *name, const struct samr_UserInfo16 *r); +_PUBLIC_ void ndr_print_samr_UserInfo17(struct ndr_print *ndr, const char *name, const struct samr_UserInfo17 *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_Password(struct ndr_push *ndr, int ndr_flags, const struct samr_Password *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_Password(struct ndr_pull *ndr, int ndr_flags, struct samr_Password *r); +_PUBLIC_ void ndr_print_samr_Password(struct ndr_print *ndr, const char *name, const struct samr_Password *r); +_PUBLIC_ void ndr_print_samr_UserInfo18(struct ndr_print *ndr, const char *name, const struct samr_UserInfo18 *r); +_PUBLIC_ void ndr_print_samr_UserInfo20(struct ndr_print *ndr, const char *name, const struct samr_UserInfo20 *r); +_PUBLIC_ void ndr_print_samr_FieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_UserInfo21(struct ndr_print *ndr, const char *name, const struct samr_UserInfo21 *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_CryptPassword(struct ndr_push *ndr, int ndr_flags, const struct samr_CryptPassword *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_CryptPassword(struct ndr_pull *ndr, int ndr_flags, struct samr_CryptPassword *r); +_PUBLIC_ void ndr_print_samr_CryptPassword(struct ndr_print *ndr, const char *name, const struct samr_CryptPassword *r); +_PUBLIC_ void ndr_print_samr_UserInfo23(struct ndr_print *ndr, const char *name, const struct samr_UserInfo23 *r); +_PUBLIC_ void ndr_print_samr_UserInfo24(struct ndr_print *ndr, const char *name, const struct samr_UserInfo24 *r); +_PUBLIC_ void ndr_print_samr_CryptPasswordEx(struct ndr_print *ndr, const char *name, const struct samr_CryptPasswordEx *r); +_PUBLIC_ void ndr_print_samr_UserInfo25(struct ndr_print *ndr, const char *name, const struct samr_UserInfo25 *r); +_PUBLIC_ void ndr_print_samr_UserInfo26(struct ndr_print *ndr, const char *name, const struct samr_UserInfo26 *r); +_PUBLIC_ void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, const union samr_UserInfo *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_RidWithAttribute(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttribute *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_RidWithAttribute(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttribute *r); +_PUBLIC_ void ndr_print_samr_RidWithAttribute(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttribute *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_RidWithAttributeArray(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttributeArray *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_RidWithAttributeArray(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttributeArray *r); +_PUBLIC_ void ndr_print_samr_RidWithAttributeArray(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttributeArray *r); +_PUBLIC_ void ndr_print_samr_DispEntryGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispEntryGeneral *r); +_PUBLIC_ void ndr_print_samr_DispInfoGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispInfoGeneral *r); +_PUBLIC_ void ndr_print_samr_DispEntryFull(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFull *r); +_PUBLIC_ void ndr_print_samr_DispInfoFull(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFull *r); +_PUBLIC_ void ndr_print_samr_DispEntryFullGroup(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFullGroup *r); +_PUBLIC_ void ndr_print_samr_DispInfoFullGroups(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFullGroups *r); +_PUBLIC_ void ndr_print_samr_DispEntryAscii(struct ndr_print *ndr, const char *name, const struct samr_DispEntryAscii *r); +_PUBLIC_ void ndr_print_samr_DispInfoAscii(struct ndr_print *ndr, const char *name, const struct samr_DispInfoAscii *r); +_PUBLIC_ void ndr_print_samr_DispInfo(struct ndr_print *ndr, const char *name, const union samr_DispInfo *r); +_PUBLIC_ void ndr_print_samr_PwInfo(struct ndr_print *ndr, const char *name, const struct samr_PwInfo *r); +_PUBLIC_ void ndr_print_samr_ConnectVersion(struct ndr_print *ndr, const char *name, enum samr_ConnectVersion r); +_PUBLIC_ void ndr_print_samr_ChangeReject(struct ndr_print *ndr, const char *name, const struct samr_ChangeReject *r); +_PUBLIC_ void ndr_print_samr_ConnectInfo1(struct ndr_print *ndr, const char *name, const struct samr_ConnectInfo1 *r); +_PUBLIC_ void ndr_print_samr_ConnectInfo(struct ndr_print *ndr, const char *name, const union samr_ConnectInfo *r); +_PUBLIC_ void ndr_print_samr_ValidateFieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_samr_ValidatePasswordLevel(struct ndr_print *ndr, const char *name, enum samr_ValidatePasswordLevel r); +_PUBLIC_ void ndr_print_samr_ValidationStatus(struct ndr_print *ndr, const char *name, enum samr_ValidationStatus r); +_PUBLIC_ void ndr_print_samr_ValidationBlob(struct ndr_print *ndr, const char *name, const struct samr_ValidationBlob *r); +_PUBLIC_ void ndr_print_samr_ValidatePasswordInfo(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordInfo *r); +_PUBLIC_ void ndr_print_samr_ValidatePasswordRepCtr(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordRepCtr *r); +_PUBLIC_ void ndr_print_samr_ValidatePasswordRep(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordRep *r); +_PUBLIC_ void ndr_print_samr_ValidatePasswordReq3(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq3 *r); +_PUBLIC_ void ndr_print_samr_ValidatePasswordReq2(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq2 *r); +_PUBLIC_ void ndr_print_samr_ValidatePasswordReq1(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq1 *r); +_PUBLIC_ void ndr_print_samr_ValidatePasswordReq(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordReq *r); +_PUBLIC_ void ndr_print_samr_Connect(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_Close(struct ndr_push *ndr, int flags, const struct samr_Close *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_Close(struct ndr_pull *ndr, int flags, struct samr_Close *r); +_PUBLIC_ void ndr_print_samr_Close(struct ndr_print *ndr, const char *name, int flags, const struct samr_Close *r); +_PUBLIC_ void ndr_print_samr_SetSecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetSecurity *r); +_PUBLIC_ void ndr_print_samr_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_QuerySecurity *r); +_PUBLIC_ void ndr_print_samr_Shutdown(struct ndr_print *ndr, const char *name, int flags, const struct samr_Shutdown *r); +_PUBLIC_ void ndr_print_samr_LookupDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupDomain *r); +_PUBLIC_ void ndr_print_samr_EnumDomains(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomains *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_OpenDomain(struct ndr_push *ndr, int flags, const struct samr_OpenDomain *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_OpenDomain(struct ndr_pull *ndr, int flags, struct samr_OpenDomain *r); +_PUBLIC_ void ndr_print_samr_OpenDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenDomain *r); +_PUBLIC_ void ndr_print_samr_QueryDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo *r); +_PUBLIC_ void ndr_print_samr_SetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDomainInfo *r); +_PUBLIC_ void ndr_print_samr_CreateDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomainGroup *r); +_PUBLIC_ void ndr_print_samr_EnumDomainGroups(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainGroups *r); +_PUBLIC_ void ndr_print_samr_CreateUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser *r); +_PUBLIC_ void ndr_print_samr_EnumDomainUsers(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainUsers *r); +_PUBLIC_ void ndr_print_samr_CreateDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomAlias *r); +_PUBLIC_ void ndr_print_samr_EnumDomainAliases(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainAliases *r); +_PUBLIC_ void ndr_print_samr_GetAliasMembership(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetAliasMembership *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_LookupNames(struct ndr_push *ndr, int flags, const struct samr_LookupNames *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_LookupNames(struct ndr_pull *ndr, int flags, struct samr_LookupNames *r); +_PUBLIC_ void ndr_print_samr_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupNames *r); +_PUBLIC_ void ndr_print_samr_LookupRids(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupRids *r); +_PUBLIC_ void ndr_print_samr_OpenGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenGroup *r); +_PUBLIC_ void ndr_print_samr_QueryGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupInfo *r); +_PUBLIC_ void ndr_print_samr_SetGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetGroupInfo *r); +_PUBLIC_ void ndr_print_samr_AddGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddGroupMember *r); +_PUBLIC_ void ndr_print_samr_DeleteDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomainGroup *r); +_PUBLIC_ void ndr_print_samr_DeleteGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteGroupMember *r); +_PUBLIC_ void ndr_print_samr_QueryGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupMember *r); +_PUBLIC_ void ndr_print_samr_SetMemberAttributesOfGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetMemberAttributesOfGroup *r); +_PUBLIC_ void ndr_print_samr_OpenAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenAlias *r); +_PUBLIC_ void ndr_print_samr_QueryAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryAliasInfo *r); +_PUBLIC_ void ndr_print_samr_SetAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetAliasInfo *r); +_PUBLIC_ void ndr_print_samr_DeleteDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomAlias *r); +_PUBLIC_ void ndr_print_samr_AddAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddAliasMember *r); +_PUBLIC_ void ndr_print_samr_DeleteAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteAliasMember *r); +_PUBLIC_ void ndr_print_samr_GetMembersInAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetMembersInAlias *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_OpenUser(struct ndr_push *ndr, int flags, const struct samr_OpenUser *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_OpenUser(struct ndr_pull *ndr, int flags, struct samr_OpenUser *r); +_PUBLIC_ void ndr_print_samr_OpenUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenUser *r); +_PUBLIC_ void ndr_print_samr_DeleteUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteUser *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_QueryUserInfo(struct ndr_push *ndr, int flags, const struct samr_QueryUserInfo *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, int flags, struct samr_QueryUserInfo *r); +_PUBLIC_ void ndr_print_samr_QueryUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_SetUserInfo(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_SetUserInfo(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo *r); +_PUBLIC_ void ndr_print_samr_SetUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo *r); +_PUBLIC_ void ndr_print_samr_ChangePasswordUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser *r); +_PUBLIC_ void ndr_print_samr_GetGroupsForUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetGroupsForUser *r); +_PUBLIC_ void ndr_print_samr_QueryDisplayInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo *r); +_PUBLIC_ void ndr_print_samr_GetDisplayEnumerationIndex(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex *r); +_PUBLIC_ void ndr_print_samr_TestPrivateFunctionsDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsDomain *r); +_PUBLIC_ void ndr_print_samr_TestPrivateFunctionsUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsUser *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_GetUserPwInfo(struct ndr_push *ndr, int flags, const struct samr_GetUserPwInfo *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_GetUserPwInfo(struct ndr_pull *ndr, int flags, struct samr_GetUserPwInfo *r); +_PUBLIC_ void ndr_print_samr_GetUserPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetUserPwInfo *r); +_PUBLIC_ void ndr_print_samr_RemoveMemberFromForeignDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMemberFromForeignDomain *r); +_PUBLIC_ void ndr_print_samr_QueryDomainInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo2 *r); +_PUBLIC_ void ndr_print_samr_QueryUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo2 *r); +_PUBLIC_ void ndr_print_samr_QueryDisplayInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo2 *r); +_PUBLIC_ void ndr_print_samr_GetDisplayEnumerationIndex2(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex2 *r); +_PUBLIC_ void ndr_print_samr_CreateUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser2 *r); +_PUBLIC_ void ndr_print_samr_QueryDisplayInfo3(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo3 *r); +_PUBLIC_ void ndr_print_samr_AddMultipleMembersToAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddMultipleMembersToAlias *r); +_PUBLIC_ void ndr_print_samr_RemoveMultipleMembersFromAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMultipleMembersFromAlias *r); +_PUBLIC_ void ndr_print_samr_OemChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_OemChangePasswordUser2 *r); +_PUBLIC_ void ndr_print_samr_ChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser2 *r); +_PUBLIC_ void ndr_print_samr_GetDomPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDomPwInfo *r); +_PUBLIC_ void ndr_print_samr_Connect2(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect2 *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_SetUserInfo2(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo2 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_SetUserInfo2(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo2 *r); +_PUBLIC_ void ndr_print_samr_SetUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo2 *r); +_PUBLIC_ void ndr_print_samr_SetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetBootKeyInformation *r); +_PUBLIC_ void ndr_print_samr_GetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetBootKeyInformation *r); +_PUBLIC_ void ndr_print_samr_Connect3(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect3 *r); +_PUBLIC_ void ndr_print_samr_Connect4(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect4 *r); +_PUBLIC_ void ndr_print_samr_ChangePasswordUser3(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser3 *r); +_PUBLIC_ enum ndr_err_code ndr_push_samr_Connect5(struct ndr_push *ndr, int flags, const struct samr_Connect5 *r); +_PUBLIC_ enum ndr_err_code ndr_pull_samr_Connect5(struct ndr_pull *ndr, int flags, struct samr_Connect5 *r); +_PUBLIC_ void ndr_print_samr_Connect5(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect5 *r); +_PUBLIC_ void ndr_print_samr_RidToSid(struct ndr_print *ndr, const char *name, int flags, const struct samr_RidToSid *r); +_PUBLIC_ void ndr_print_samr_SetDsrmPassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDsrmPassword *r); +_PUBLIC_ void ndr_print_samr_ValidatePassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_ValidatePassword *r); + +/* The following definitions come from librpc/gen_ndr/ndr_security.c */ + +_PUBLIC_ void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r); +_PUBLIC_ void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r); +_PUBLIC_ void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r); +_PUBLIC_ void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r); +_PUBLIC_ void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r); +_PUBLIC_ void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r); +_PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r); +_PUBLIC_ enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r); +_PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r); +_PUBLIC_ void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r); +_PUBLIC_ enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r); +_PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r); +_PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r); +_PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r); +_PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r); +_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r); +_PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r); +_PUBLIC_ void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r); +_PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r); +_PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r); +_PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r); +_PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r); +_PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r); +_PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r); +_PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r); + +/* The following definitions come from librpc/gen_ndr/ndr_srvsvc.c */ + +_PUBLIC_ void ndr_print_srvsvc_NetCharDevInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevInfo0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevCtr0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevInfo1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevCtr1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQInfo0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQCtr0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQInfo1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQCtr1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevQInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevQCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetConnInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnInfo0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetConnCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnCtr0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetConnInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnInfo1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetConnCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnCtr1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetConnCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetConnCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetConnInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnInfoCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileInfo2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileInfo2 *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileCtr2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileCtr2 *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileInfo3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileInfo3 *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileCtr3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileCtr3 *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetFileInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetFileCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileInfoCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessInfo2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo2 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessCtr2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr2 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessInfo10(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo10 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessCtr10(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr10 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessInfo502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo502 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessCtr502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr502 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetSessCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfoCtr *r); +_PUBLIC_ void ndr_print_srvsvc_ShareType(struct ndr_print *ndr, const char *name, enum srvsvc_ShareType r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo2 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr2 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo501(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo501 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr501(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr501 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo502 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr502 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1004(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1004 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1004(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1004 *r); +_PUBLIC_ void ndr_print_NetShareInfo1005Flags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1005(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1005 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1005(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1005 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1006(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1006 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1006(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1006 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1007(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1007 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1007(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1007 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1501(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1501 *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetShareInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetShareCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfoCtr *r); +_PUBLIC_ enum ndr_err_code ndr_push_srvsvc_PlatformId(struct ndr_push *ndr, int ndr_flags, enum srvsvc_PlatformId r); +_PUBLIC_ enum ndr_err_code ndr_pull_srvsvc_PlatformId(struct ndr_pull *ndr, int ndr_flags, enum srvsvc_PlatformId *r); +_PUBLIC_ void ndr_print_srvsvc_PlatformId(struct ndr_print *ndr, const char *name, enum srvsvc_PlatformId r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo100(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo100 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo101(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo101 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo102(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo102 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo402(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo402 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo403(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo403 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo502 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo503(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo503 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo599(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo599 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1005(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1005 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1010(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1010 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1016(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1016 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1017(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1017 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1018(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1018 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1107(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1107 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1501(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1501 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1502 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1503(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1503 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1506(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1506 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1509(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1509 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1510(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1510 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1511(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1511 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1512(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1512 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1513(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1513 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1514(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1514 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1515(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1515 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1516(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1516 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1518(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1518 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1520(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1520 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1521(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1521 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1522(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1522 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1523(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1523 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1524(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1524 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1525(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1525 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1528(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1528 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1529(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1529 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1530(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1530 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1533(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1533 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1534(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1534 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1535(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1535 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1536(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1536 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1537(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1537 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1538(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1538 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1539(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1539 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1540(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1540 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1541(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1541 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1542(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1542 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1543(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1543 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1544(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1544 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1545(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1545 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1546(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1546 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1547(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1547 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1548(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1548 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1549(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1549 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1550(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1550 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1552(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1552 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1553(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1553 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1554(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1554 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1555(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1555 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1556(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1556 *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetSrvInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetDiskInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetDiskInfo0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetDiskInfo(struct ndr_print *ndr, const char *name, const struct srvsvc_NetDiskInfo *r); +_PUBLIC_ void ndr_print_srvsvc_Statistics(struct ndr_print *ndr, const char *name, const struct srvsvc_Statistics *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr0 *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr1 *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo2 *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr2 *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo3 *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr3 *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetTransportCtr *r); +_PUBLIC_ void ndr_print_srvsvc_NetRemoteTODInfo(struct ndr_print *ndr, const char *name, const struct srvsvc_NetRemoteTODInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetTransportInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevEnum *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevGetInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevControl(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevControl *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQEnum *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQGetInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQSetInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQPurge(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQPurge *r); +_PUBLIC_ void ndr_print_srvsvc_NetCharDevQPurgeSelf(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQPurgeSelf *r); +_PUBLIC_ void ndr_print_srvsvc_NetConnEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetConnEnum *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetFileEnum *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetFileGetInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetFileClose(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetFileClose *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSessEnum *r); +_PUBLIC_ void ndr_print_srvsvc_NetSessDel(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSessDel *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareAdd(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareAdd *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareEnumAll(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareEnumAll *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareGetInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareSetInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareDel(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareDel *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareDelSticky(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareDelSticky *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareCheck(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareCheck *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSrvGetInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetSrvSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSrvSetInfo *r); +_PUBLIC_ void ndr_print_srvsvc_NetDiskEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetDiskEnum *r); +_PUBLIC_ void ndr_print_srvsvc_NetServerStatisticsGet(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetServerStatisticsGet *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportAdd(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetTransportAdd *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetTransportEnum *r); +_PUBLIC_ void ndr_print_srvsvc_NetTransportDel(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetTransportDel *r); +_PUBLIC_ void ndr_print_srvsvc_NetRemoteTOD(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetRemoteTOD *r); +_PUBLIC_ void ndr_print_srvsvc_NetSetServiceBits(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSetServiceBits *r); +_PUBLIC_ void ndr_print_srvsvc_NetPathType(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetPathType *r); +_PUBLIC_ void ndr_print_srvsvc_NetPathCanonicalize(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetPathCanonicalize *r); +_PUBLIC_ void ndr_print_srvsvc_NetPathCompare(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetPathCompare *r); +_PUBLIC_ void ndr_print_srvsvc_NetNameValidate(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetNameValidate *r); +_PUBLIC_ void ndr_print_srvsvc_NETRPRNAMECANONICALIZE(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRPRNAMECANONICALIZE *r); +_PUBLIC_ void ndr_print_srvsvc_NetPRNameCompare(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetPRNameCompare *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareEnum *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareDelStart(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareDelStart *r); +_PUBLIC_ void ndr_print_srvsvc_NetShareDelCommit(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareDelCommit *r); +_PUBLIC_ void ndr_print_srvsvc_NetGetFileSecurity(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetGetFileSecurity *r); +_PUBLIC_ void ndr_print_srvsvc_NetSetFileSecurity(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSetFileSecurity *r); +_PUBLIC_ void ndr_print_srvsvc_NetServerTransportAddEx(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetServerTransportAddEx *r); +_PUBLIC_ void ndr_print_srvsvc_NetServerSetServiceBitsEx(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetServerSetServiceBitsEx *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSGETVERSION(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSGETVERSION *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSCREATELOCALPARTITION(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSCREATELOCALPARTITION *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSDELETELOCALPARTITION(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSDELETELOCALPARTITION *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSSETSERVERINFO(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSSETSERVERINFO *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSCREATEEXITPOINT(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSCREATEEXITPOINT *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSDELETEEXITPOINT(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSDELETEEXITPOINT *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSMODIFYPREFIX(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSMODIFYPREFIX *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSFIXLOCALVOLUME(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSFIXLOCALVOLUME *r); +_PUBLIC_ void ndr_print_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r); +_PUBLIC_ void ndr_print_srvsvc_NETRSERVERTRANSPORTDELEX(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRSERVERTRANSPORTDELEX *r); + +/* The following definitions come from librpc/gen_ndr/ndr_svcctl.c */ + +_PUBLIC_ void ndr_print_SERVICE_LOCK_STATUS(struct ndr_print *ndr, const char *name, const struct SERVICE_LOCK_STATUS *r); +_PUBLIC_ void ndr_print_SERVICE_STATUS(struct ndr_print *ndr, const char *name, const struct SERVICE_STATUS *r); +_PUBLIC_ void ndr_print_ENUM_SERVICE_STATUS(struct ndr_print *ndr, const char *name, const struct ENUM_SERVICE_STATUS *r); +_PUBLIC_ enum ndr_err_code ndr_push_svcctl_ServerType(struct ndr_push *ndr, int ndr_flags, uint32_t r); +_PUBLIC_ enum ndr_err_code ndr_pull_svcctl_ServerType(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +_PUBLIC_ void ndr_print_svcctl_ServerType(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_svcctl_MgrAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_svcctl_ServiceAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_svcctl_CloseServiceHandle(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CloseServiceHandle *r); +_PUBLIC_ void ndr_print_svcctl_ControlService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ControlService *r); +_PUBLIC_ void ndr_print_svcctl_DeleteService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_DeleteService *r); +_PUBLIC_ void ndr_print_svcctl_LockServiceDatabase(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_LockServiceDatabase *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceObjectSecurity(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceObjectSecurity *r); +_PUBLIC_ void ndr_print_svcctl_SetServiceObjectSecurity(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SetServiceObjectSecurity *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceStatus *r); +_PUBLIC_ void ndr_print_svcctl_SetServiceStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SetServiceStatus *r); +_PUBLIC_ void ndr_print_svcctl_UnlockServiceDatabase(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_UnlockServiceDatabase *r); +_PUBLIC_ void ndr_print_svcctl_NotifyBootConfigStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_NotifyBootConfigStatus *r); +_PUBLIC_ void ndr_print_svcctl_SCSetServiceBitsW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SCSetServiceBitsW *r); +_PUBLIC_ void ndr_print_svcctl_ChangeServiceConfigW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfigW *r); +_PUBLIC_ void ndr_print_svcctl_CreateServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CreateServiceW *r); +_PUBLIC_ void ndr_print_svcctl_EnumDependentServicesW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumDependentServicesW *r); +_PUBLIC_ void ndr_print_svcctl_EnumServicesStatusW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumServicesStatusW *r); +_PUBLIC_ void ndr_print_svcctl_OpenSCManagerW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenSCManagerW *r); +_PUBLIC_ void ndr_print_svcctl_OpenServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenServiceW *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceConfigW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfigW *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceLockStatusW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceLockStatusW *r); +_PUBLIC_ void ndr_print_svcctl_StartServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_StartServiceW *r); +_PUBLIC_ void ndr_print_svcctl_GetServiceDisplayNameW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetServiceDisplayNameW *r); +_PUBLIC_ void ndr_print_svcctl_GetServiceKeyNameW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetServiceKeyNameW *r); +_PUBLIC_ void ndr_print_svcctl_SCSetServiceBitsA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SCSetServiceBitsA *r); +_PUBLIC_ void ndr_print_svcctl_ChangeServiceConfigA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfigA *r); +_PUBLIC_ void ndr_print_svcctl_CreateServiceA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CreateServiceA *r); +_PUBLIC_ void ndr_print_svcctl_EnumDependentServicesA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumDependentServicesA *r); +_PUBLIC_ void ndr_print_svcctl_EnumServicesStatusA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumServicesStatusA *r); +_PUBLIC_ void ndr_print_svcctl_OpenSCManagerA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenSCManagerA *r); +_PUBLIC_ void ndr_print_svcctl_OpenServiceA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenServiceA *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceConfigA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfigA *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceLockStatusA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceLockStatusA *r); +_PUBLIC_ void ndr_print_svcctl_StartServiceA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_StartServiceA *r); +_PUBLIC_ void ndr_print_svcctl_GetServiceDisplayNameA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetServiceDisplayNameA *r); +_PUBLIC_ void ndr_print_svcctl_GetServiceKeyNameA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetServiceKeyNameA *r); +_PUBLIC_ void ndr_print_svcctl_GetCurrentGroupeStateW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetCurrentGroupeStateW *r); +_PUBLIC_ void ndr_print_svcctl_EnumServiceGroupW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumServiceGroupW *r); +_PUBLIC_ void ndr_print_svcctl_ChangeServiceConfig2A(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfig2A *r); +_PUBLIC_ void ndr_print_svcctl_ChangeServiceConfig2W(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfig2W *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceConfig2A(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfig2A *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceConfig2W(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfig2W *r); +_PUBLIC_ void ndr_print_svcctl_QueryServiceStatusEx(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceStatusEx *r); +_PUBLIC_ void ndr_print_EnumServicesStatusExA(struct ndr_print *ndr, const char *name, int flags, const struct EnumServicesStatusExA *r); +_PUBLIC_ void ndr_print_EnumServicesStatusExW(struct ndr_print *ndr, const char *name, int flags, const struct EnumServicesStatusExW *r); +_PUBLIC_ void ndr_print_svcctl_SCSendTSMessage(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SCSendTSMessage *r); + +/* The following definitions come from librpc/gen_ndr/ndr_winreg.c */ + +_PUBLIC_ void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r); +_PUBLIC_ enum ndr_err_code ndr_push_winreg_String(struct ndr_push *ndr, int ndr_flags, const struct winreg_String *r); +_PUBLIC_ enum ndr_err_code ndr_pull_winreg_String(struct ndr_pull *ndr, int ndr_flags, struct winreg_String *r); +_PUBLIC_ void ndr_print_winreg_String(struct ndr_print *ndr, const char *name, const struct winreg_String *r); +_PUBLIC_ void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const struct KeySecurityData *r); +_PUBLIC_ void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r); +_PUBLIC_ void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r); +_PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r); +_PUBLIC_ void ndr_print_winreg_ValNameBuf(struct ndr_print *ndr, const char *name, const struct winreg_ValNameBuf *r); +_PUBLIC_ void ndr_print_KeySecurityAttribute(struct ndr_print *ndr, const char *name, const struct KeySecurityAttribute *r); +_PUBLIC_ void ndr_print_QueryMultipleValue(struct ndr_print *ndr, const char *name, const struct QueryMultipleValue *r); +_PUBLIC_ void ndr_print_winreg_OpenHKCR(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCR *r); +_PUBLIC_ void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCU *r); +_PUBLIC_ void ndr_print_winreg_OpenHKLM(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKLM *r); +_PUBLIC_ void ndr_print_winreg_OpenHKPD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPD *r); +_PUBLIC_ void ndr_print_winreg_OpenHKU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKU *r); +_PUBLIC_ void ndr_print_winreg_CloseKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CloseKey *r); +_PUBLIC_ void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CreateKey *r); +_PUBLIC_ void ndr_print_winreg_DeleteKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteKey *r); +_PUBLIC_ void ndr_print_winreg_DeleteValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteValue *r); +_PUBLIC_ void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumKey *r); +_PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumValue *r); +_PUBLIC_ void ndr_print_winreg_FlushKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_FlushKey *r); +_PUBLIC_ void ndr_print_winreg_GetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetKeySecurity *r); +_PUBLIC_ void ndr_print_winreg_LoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_LoadKey *r); +_PUBLIC_ void ndr_print_winreg_NotifyChangeKeyValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_NotifyChangeKeyValue *r); +_PUBLIC_ void ndr_print_winreg_OpenKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenKey *r); +_PUBLIC_ void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryInfoKey *r); +_PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryValue *r); +_PUBLIC_ void ndr_print_winreg_ReplaceKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_ReplaceKey *r); +_PUBLIC_ void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_RestoreKey *r); +_PUBLIC_ void ndr_print_winreg_SaveKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKey *r); +_PUBLIC_ void ndr_print_winreg_SetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetKeySecurity *r); +_PUBLIC_ void ndr_print_winreg_SetValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetValue *r); +_PUBLIC_ void ndr_print_winreg_UnLoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_UnLoadKey *r); +_PUBLIC_ void ndr_print_winreg_InitiateSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdown *r); +_PUBLIC_ void ndr_print_winreg_AbortSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_AbortSystemShutdown *r); +_PUBLIC_ void ndr_print_winreg_GetVersion(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetVersion *r); +_PUBLIC_ void ndr_print_winreg_OpenHKCC(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCC *r); +_PUBLIC_ void ndr_print_winreg_OpenHKDD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKDD *r); +_PUBLIC_ void ndr_print_winreg_QueryMultipleValues(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues *r); +_PUBLIC_ void ndr_print_winreg_InitiateSystemShutdownEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdownEx *r); +_PUBLIC_ void ndr_print_winreg_SaveKeyEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKeyEx *r); +_PUBLIC_ void ndr_print_winreg_OpenHKPT(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPT *r); +_PUBLIC_ void ndr_print_winreg_OpenHKPN(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPN *r); +_PUBLIC_ void ndr_print_winreg_QueryMultipleValues2(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues2 *r); + +/* The following definitions come from librpc/gen_ndr/ndr_wkssvc.c */ + +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo100(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo100 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo101(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo101 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo102(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo102 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo502(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo502 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1010(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1010 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1011(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1011 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1012(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1012 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1013(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1013 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1018(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1018 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1023(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1023 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1027(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1027 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1028(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1028 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1032(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1032 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1033(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1033 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1041(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1041 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1042(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1042 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1043(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1043 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1044(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1044 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1045(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1045 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1046(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1046 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1047(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1047 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1048(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1048 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1049(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1049 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1050(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1050 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1051(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1051 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1052(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1052 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1053(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1053 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1054(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1054 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1055(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1055 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1056(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1056 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1057(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1057 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1058(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1058 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1059(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1059 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1060(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1060 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1061(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1061 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1062(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1062 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo(struct ndr_print *ndr, const char *name, const union wkssvc_NetWkstaInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserInfo0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrWkstaUserInfo0 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsersCtr0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaEnumUsersCtr0 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserInfo1(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrWkstaUserInfo1 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsersCtr1(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaEnumUsersCtr1 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsersCtr(struct ndr_print *ndr, const char *name, const union wkssvc_NetWkstaEnumUsersCtr *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsersInfo(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaEnumUsersInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserInfo1101(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrWkstaUserInfo1101 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserInfo(struct ndr_print *ndr, const char *name, const union wkssvc_NetrWkstaUserInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportInfo0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaTransportInfo0 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportCtr0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaTransportCtr0 *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportCtr(struct ndr_print *ndr, const char *name, const union wkssvc_NetWkstaTransportCtr *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportInfo(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaTransportInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseInfo3(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseInfo3 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseInfo2(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseInfo2 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseInfo1(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseInfo1 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseInfo0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseInfo0 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseGetInfoCtr(struct ndr_print *ndr, const char *name, const union wkssvc_NetrUseGetInfoCtr *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumCtr2(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseEnumCtr2 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumCtr1(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseEnumCtr1 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumCtr0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseEnumCtr0 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumCtr(struct ndr_print *ndr, const char *name, const union wkssvc_NetrUseEnumCtr *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumInfo(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseEnumInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWorkstationStatistics(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrWorkstationStatistics *r); +_PUBLIC_ void ndr_print_wkssvc_renameflags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_wkssvc_NetValidateNameType(struct ndr_print *ndr, const char *name, enum wkssvc_NetValidateNameType r); +_PUBLIC_ void ndr_print_wkssvc_NetJoinStatus(struct ndr_print *ndr, const char *name, enum wkssvc_NetJoinStatus r); +_PUBLIC_ void ndr_print_wkssvc_PasswordBuffer(struct ndr_print *ndr, const char *name, const struct wkssvc_PasswordBuffer *r); +_PUBLIC_ void ndr_print_wkssvc_joinflags(struct ndr_print *ndr, const char *name, uint32_t r); +_PUBLIC_ void ndr_print_wkssvc_ComputerNameType(struct ndr_print *ndr, const char *name, enum wkssvc_ComputerNameType r); +_PUBLIC_ void ndr_print_wkssvc_ComputerNamesCtr(struct ndr_print *ndr, const char *name, const struct wkssvc_ComputerNamesCtr *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetWkstaGetInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetWkstaSetInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsers(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetWkstaEnumUsers *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWkstaUserGetInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWkstaUserSetInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportEnum(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetWkstaTransportEnum *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWkstaTransportAdd(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWkstaTransportAdd *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWkstaTransportDel(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWkstaTransportDel *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseAdd(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUseAdd *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUseGetInfo *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseDel(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUseDel *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUseEnum(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUseEnum *r); +_PUBLIC_ void ndr_print_wkssvc_NetrMessageBufferSend(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrMessageBufferSend *r); +_PUBLIC_ void ndr_print_wkssvc_NetrWorkstationStatisticsGet(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWorkstationStatisticsGet *r); +_PUBLIC_ void ndr_print_wkssvc_NetrLogonDomainNameAdd(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrLogonDomainNameAdd *r); +_PUBLIC_ void ndr_print_wkssvc_NetrLogonDomainNameDel(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrLogonDomainNameDel *r); +_PUBLIC_ void ndr_print_wkssvc_NetrJoinDomain(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrJoinDomain *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUnjoinDomain(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUnjoinDomain *r); +_PUBLIC_ void ndr_print_wkssvc_NetrRenameMachineInDomain(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrRenameMachineInDomain *r); +_PUBLIC_ void ndr_print_wkssvc_NetrValidateName(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrValidateName *r); +_PUBLIC_ void ndr_print_wkssvc_NetrGetJoinInformation(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrGetJoinInformation *r); +_PUBLIC_ void ndr_print_wkssvc_NetrGetJoinableOus(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrGetJoinableOus *r); +_PUBLIC_ void ndr_print_wkssvc_NetrJoinDomain2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrJoinDomain2 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrUnjoinDomain2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUnjoinDomain2 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrRenameMachineInDomain2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrRenameMachineInDomain2 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrValidateName2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrValidateName2 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrGetJoinableOus2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrGetJoinableOus2 *r); +_PUBLIC_ void ndr_print_wkssvc_NetrAddAlternateComputerName(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrAddAlternateComputerName *r); +_PUBLIC_ void ndr_print_wkssvc_NetrRemoveAlternateComputerName(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrRemoveAlternateComputerName *r); +_PUBLIC_ void ndr_print_wkssvc_NetrSetPrimaryComputername(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrSetPrimaryComputername *r); +_PUBLIC_ void ndr_print_wkssvc_NetrEnumerateComputerNames(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrEnumerateComputerNames *r); + +/* The following definitions come from librpc/gen_ndr/ndr_xattr.c */ + +_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattr *r); +_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r); +_PUBLIC_ void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *r); +_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r); +_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r); +_PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r); + +/* The following definitions come from librpc/gen_ndr/srv_dfs.c */ + +void netdfs_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_netdfs_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_dssetup.c */ + +void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_dssetup_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_echo.c */ + +void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_rpcecho_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_eventlog.c */ + +void eventlog_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_eventlog_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_initshutdown.c */ + +void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_initshutdown_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_lsa.c */ + +void lsarpc_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_lsarpc_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_netlogon.c */ + +void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_netlogon_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_ntsvcs.c */ + +void ntsvcs_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_ntsvcs_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_samr.c */ + +void samr_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_samr_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_srvsvc.c */ + +void srvsvc_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_srvsvc_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_svcctl.c */ + +void svcctl_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_svcctl_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_winreg.c */ + +void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_winreg_init(void); + +/* The following definitions come from librpc/gen_ndr/srv_wkssvc.c */ + +void wkssvc_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_wkssvc_init(void); + +/* The following definitions come from librpc/ndr/ndr.c */ + +_PUBLIC_ size_t ndr_align_size(uint32_t offset, size_t n); +_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx); +_PUBLIC_ enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size); +_PUBLIC_ void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save); +_PUBLIC_ void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save); +_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx); +_PUBLIC_ DATA_BLOB ndr_push_blob(struct ndr_push *ndr); +_PUBLIC_ enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size); +_PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3); +_PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3); +_PUBLIC_ void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr); +_PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr); +_PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr); +_PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr); +_PUBLIC_ char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr); +_PUBLIC_ char *ndr_print_function_string(TALLOC_CTX *mem_ctx, + ndr_print_function_t fn, const char *name, + int flags, void *ptr); +_PUBLIC_ void ndr_set_flags(uint32_t *pflags, uint32_t new_flags); +NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err); +const char *ndr_errstr(enum ndr_err_code err); +_PUBLIC_ enum ndr_err_code ndr_pull_error(struct ndr_pull *ndr, + enum ndr_err_code ndr_err, + const char *format, ...) _PRINTF_ATTRIBUTE(3,4); +_PUBLIC_ enum ndr_err_code ndr_push_error(struct ndr_push *ndr, + enum ndr_err_code ndr_err, + const char *format, ...) _PRINTF_ATTRIBUTE(3,4); +_PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr, + struct ndr_pull **_subndr, + size_t header_size, + ssize_t size_is); +_PUBLIC_ enum ndr_err_code ndr_pull_subcontext_end(struct ndr_pull *ndr, + struct ndr_pull *subndr, + size_t header_size, + ssize_t size_is); +_PUBLIC_ enum ndr_err_code ndr_push_subcontext_start(struct ndr_push *ndr, + struct ndr_push **_subndr, + size_t header_size, + ssize_t size_is); +_PUBLIC_ enum ndr_err_code ndr_push_subcontext_end(struct ndr_push *ndr, + struct ndr_push *subndr, + size_t header_size, + ssize_t size_is); +_PUBLIC_ enum ndr_err_code ndr_token_store(TALLOC_CTX *mem_ctx, + struct ndr_token_list **list, + const void *key, + uint32_t value); +_PUBLIC_ enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v, + comparison_fn_t _cmp_fn, bool _remove_tok); +_PUBLIC_ enum ndr_err_code ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v); +_PUBLIC_ uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key); +_PUBLIC_ enum ndr_err_code ndr_pull_array_size(struct ndr_pull *ndr, const void *p); +_PUBLIC_ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p); +_PUBLIC_ enum ndr_err_code ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size); +_PUBLIC_ enum ndr_err_code ndr_pull_array_length(struct ndr_pull *ndr, const void *p); +_PUBLIC_ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p); +_PUBLIC_ enum ndr_err_code ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length); +_PUBLIC_ enum ndr_err_code ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val); +_PUBLIC_ enum ndr_err_code ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val); +_PUBLIC_ enum ndr_err_code ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val); +_PUBLIC_ uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p); +_PUBLIC_ uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p); +_PUBLIC_ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p); +_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, + ndr_pull_flags_fn_t fn); +_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, + ndr_pull_flags_fn_t fn); +_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, + uint32_t level, ndr_pull_flags_fn_t fn); +_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, + uint32_t level, ndr_pull_flags_fn_t fn); +_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, + ndr_push_flags_fn_t fn); +_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, + uint32_t level, ndr_push_flags_fn_t fn); +_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push); +_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push); +_PUBLIC_ uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr); +_PUBLIC_ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset); +_PUBLIC_ enum ndr_err_code ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset); +_PUBLIC_ enum ndr_err_code ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p); +_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p); +_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p); +_PUBLIC_ uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr); +_PUBLIC_ void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset); +_PUBLIC_ enum ndr_err_code ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset); +_PUBLIC_ enum ndr_err_code ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p); +_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset); +_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p); + +/* The following definitions come from librpc/ndr/ndr_basic.c */ + +_PUBLIC_ void ndr_check_padding(struct ndr_pull *ndr, size_t n); +_PUBLIC_ enum ndr_err_code ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v); +_PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v); +_PUBLIC_ enum ndr_err_code ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status); +_PUBLIC_ enum ndr_err_code ndr_push_NTSTATUS(struct ndr_push *ndr, int ndr_flags, NTSTATUS status); +_PUBLIC_ void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS r); +_PUBLIC_ enum ndr_err_code ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status); +_PUBLIC_ enum ndr_err_code ndr_push_WERROR(struct ndr_push *ndr, int ndr_flags, WERROR status); +_PUBLIC_ void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR r); +_PUBLIC_ enum ndr_err_code ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n); +_PUBLIC_ enum ndr_err_code ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n); +_PUBLIC_ enum ndr_err_code ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v); +_PUBLIC_ enum ndr_err_code ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v); +_PUBLIC_ enum ndr_err_code ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v); +_PUBLIC_ enum ndr_err_code ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v); +_PUBLIC_ enum ndr_err_code ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v); +_PUBLIC_ enum ndr_err_code ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v); +_PUBLIC_ enum ndr_err_code ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v); +_PUBLIC_ enum ndr_err_code ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v); +_PUBLIC_ enum ndr_err_code ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v); +_PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v); +_PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v); +_PUBLIC_ enum ndr_err_code ndr_push_align(struct ndr_push *ndr, size_t size); +_PUBLIC_ enum ndr_err_code ndr_pull_align(struct ndr_pull *ndr, size_t size); +_PUBLIC_ enum ndr_err_code ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n); +_PUBLIC_ enum ndr_err_code ndr_push_zero(struct ndr_push *ndr, uint32_t n); +_PUBLIC_ enum ndr_err_code ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n); +_PUBLIC_ void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save); +_PUBLIC_ void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save *save); +_PUBLIC_ enum ndr_err_code ndr_push_unique_ptr(struct ndr_push *ndr, const void *p); +_PUBLIC_ enum ndr_err_code ndr_push_full_ptr(struct ndr_push *ndr, const void *p); +_PUBLIC_ enum ndr_err_code ndr_push_ref_ptr(struct ndr_push *ndr); +_PUBLIC_ enum ndr_err_code ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t); +_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t); +_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t); +_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t); +_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t); +_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t); +_PUBLIC_ enum ndr_err_code ndr_push_time_t(struct ndr_push *ndr, int ndr_flags, time_t t); +_PUBLIC_ enum ndr_err_code ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t); +_PUBLIC_ enum ndr_err_code ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address); +_PUBLIC_ enum ndr_err_code ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *address); +_PUBLIC_ void ndr_print_ipv4address(struct ndr_print *ndr, const char *name, + const char *address); +_PUBLIC_ void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type); +_PUBLIC_ void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type, + const char *val, uint32_t value); +_PUBLIC_ void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value); +_PUBLIC_ void ndr_print_int8(struct ndr_print *ndr, const char *name, int8_t v); +_PUBLIC_ void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v); +_PUBLIC_ void ndr_print_int16(struct ndr_print *ndr, const char *name, int16_t v); +_PUBLIC_ void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t v); +_PUBLIC_ void ndr_print_int32(struct ndr_print *ndr, const char *name, int32_t v); +_PUBLIC_ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t v); +_PUBLIC_ void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v); +_PUBLIC_ void ndr_print_udlongr(struct ndr_print *ndr, const char *name, uint64_t v); +_PUBLIC_ void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v); +_PUBLIC_ void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v); +_PUBLIC_ void ndr_print_pointer(struct ndr_print *ndr, const char *name, void *v); +_PUBLIC_ void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p); +_PUBLIC_ void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t); +_PUBLIC_ void ndr_print_NTTIME_1sec(struct ndr_print *ndr, const char *name, NTTIME t); +_PUBLIC_ void ndr_print_NTTIME_hyper(struct ndr_print *ndr, const char *name, NTTIME t); +_PUBLIC_ void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t); +_PUBLIC_ void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type); +_PUBLIC_ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level); +_PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name, + const uint8_t *data, uint32_t count); +_PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r); +_PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob); +_PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob); +_PUBLIC_ uint32_t ndr_size_DATA_BLOB(int ret, const DATA_BLOB *data, int flags); +_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b); +_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss); + +/* The following definitions come from librpc/ndr/ndr_krb5pac.c */ + +enum ndr_err_code ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const struct PAC_BUFFER *r); +enum ndr_err_code ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUFFER *r); +void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER *r); + +/* The following definitions come from librpc/ndr/ndr_misc.c */ + +bool all_zero(const uint8_t *ptr, size_t size); +void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid); +bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1, + const struct ndr_syntax_id *i2); +enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r); +enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r); +void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r); + +/* The following definitions come from librpc/ndr/ndr_sec_helper.c */ + +size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags); +size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags); +size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags); +size_t ndr_size_security_ace(const struct security_ace *ace, int flags); +size_t ndr_size_security_acl(const struct security_acl *acl, int flags); +size_t ndr_size_security_descriptor(const struct security_descriptor *sd, int flags); +void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid); +void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid); +void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid); +void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid); + +/* The following definitions come from librpc/ndr/ndr_string.c */ + +_PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s); +_PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s); +_PUBLIC_ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s); +_PUBLIC_ void ndr_print_string(struct ndr_print *ndr, const char *name, const char *s); +_PUBLIC_ uint32_t ndr_size_string(int ret, const char * const* string, int flags) ; +_PUBLIC_ enum ndr_err_code ndr_pull_string_array(struct ndr_pull *ndr, int ndr_flags, const char ***_a); +_PUBLIC_ enum ndr_err_code ndr_push_string_array(struct ndr_push *ndr, int ndr_flags, const char **a); +_PUBLIC_ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a); +_PUBLIC_ uint32_t ndr_string_length(const void *_var, uint32_t element_size); +_PUBLIC_ enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size); +_PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset); +_PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset); +_PUBLIC_ uint32_t ndr_charset_length(const void *var, charset_t chset); + +/* The following definitions come from librpc/ndr/sid.c */ + +enum ndr_err_code ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *r); +enum ndr_err_code ndr_pull_dom_sid(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *r); +char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid); +enum ndr_err_code ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid); +enum ndr_err_code ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid); +enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid); +enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid); +enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid); +enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid); + +/* The following definitions come from librpc/ndr/uuid.c */ + +_PUBLIC_ NTSTATUS GUID_from_string(const char *s, struct GUID *guid); +_PUBLIC_ NTSTATUS NS_GUID_from_string(const char *s, struct GUID *guid); +struct GUID GUID_random(void); +_PUBLIC_ struct GUID GUID_zero(void); +_PUBLIC_ bool GUID_all_zero(const struct GUID *u); +_PUBLIC_ bool GUID_equal(const struct GUID *u1, const struct GUID *u2); +_PUBLIC_ int GUID_compare(const struct GUID *u1, const struct GUID *u2); +_PUBLIC_ char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid); +_PUBLIC_ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid); +_PUBLIC_ char *NS_GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid); +_PUBLIC_ bool policy_handle_empty(struct policy_handle *h) ; + +/* The following definitions come from librpc/rpc/binding.c */ + +const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor); +_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b); +_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out); +_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax); +const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor); +enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot); +_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower); +_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, + struct epm_tower *tower, + struct dcerpc_binding **b_out); +_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower); + +/* The following definitions come from librpc/rpc/dcerpc.c */ + +struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, const struct GUID *object, + const struct ndr_interface_table *table, uint32_t opnum, + TALLOC_CTX *mem_ctx, void *r); +NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req); +_PUBLIC_ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx, struct dcerpc_pipe **pp, + const char *binding_string, const struct ndr_interface_table *table, + struct cli_credentials *credentials, struct event_context *ev, + struct loadparm_context *lp_ctx); + +/* The following definitions come from libsmb/asn1.c */ + +void asn1_free(ASN1_DATA *data); +bool asn1_write(ASN1_DATA *data, const void *p, int len); +bool asn1_write_uint8(ASN1_DATA *data, uint8 v); +bool asn1_push_tag(ASN1_DATA *data, uint8 tag); +bool asn1_pop_tag(ASN1_DATA *data); +bool asn1_write_Integer(ASN1_DATA *data, int i); +bool asn1_write_OID(ASN1_DATA *data, const char *OID); +bool asn1_write_OctetString(ASN1_DATA *data, const void *p, size_t length); +bool asn1_write_GeneralString(ASN1_DATA *data, const char *s); +bool asn1_write_BOOLEAN(ASN1_DATA *data, bool v); +bool asn1_write_BOOLEAN2(ASN1_DATA *data, bool v); +bool asn1_check_BOOLEAN(ASN1_DATA *data, bool v); +bool asn1_load(ASN1_DATA *data, DATA_BLOB blob); +bool asn1_read(ASN1_DATA *data, void *p, int len); +bool asn1_read_uint8(ASN1_DATA *data, uint8 *v); +bool asn1_check_tag(ASN1_DATA *data, uint8 tag); +bool asn1_start_tag(ASN1_DATA *data, uint8 tag); +bool asn1_end_tag(ASN1_DATA *data); +int asn1_tag_remaining(ASN1_DATA *data); +bool asn1_read_OID(ASN1_DATA *data, char **OID); +bool asn1_check_OID(ASN1_DATA *data, const char *OID); +bool asn1_read_GeneralString(ASN1_DATA *data, char **s); +bool asn1_read_OctetString(ASN1_DATA *data, DATA_BLOB *blob); +bool asn1_read_Integer(ASN1_DATA *data, int *i); +bool asn1_check_enumerated(ASN1_DATA *data, int v); +bool asn1_write_enumerated(ASN1_DATA *data, uint8 v); +bool ber_write_OID_String(DATA_BLOB *blob, const char *OID); +bool ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID); + +/* The following definitions come from libsmb/cliconnect.c */ + +ADS_STATUS cli_session_setup_spnego(struct cli_state *cli, const char *user, + const char *pass, const char *user_domain, + const char * dest_realm); + +NTSTATUS cli_session_setup(struct cli_state *cli, + const char *user, + const char *pass, int passlen, + const char *ntpass, int ntpasslen, + const char *workgroup); +bool cli_ulogoff(struct cli_state *cli); +bool cli_send_tconX(struct cli_state *cli, + const char *share, const char *dev, const char *pass, int passlen); +bool cli_tdis(struct cli_state *cli); +void cli_negprot_send(struct cli_state *cli); +bool cli_negprot(struct cli_state *cli); +bool cli_session_request(struct cli_state *cli, + struct nmb_name *calling, struct nmb_name *called); +NTSTATUS cli_connect(struct cli_state *cli, + const char *host, + struct sockaddr_storage *dest_ss); +NTSTATUS cli_start_connection(struct cli_state **output_cli, + const char *my_name, + const char *dest_host, + struct sockaddr_storage *dest_ss, int port, + int signing_state, int flags, + bool *retry) ; +NTSTATUS cli_full_connection(struct cli_state **output_cli, + const char *my_name, + const char *dest_host, + struct sockaddr_storage *dest_ss, int port, + const char *service, const char *service_type, + const char *user, const char *domain, + const char *password, int flags, + int signing_state, + bool *retry) ; +bool attempt_netbios_session_request(struct cli_state **ppcli, const char *srchost, const char *desthost, + struct sockaddr_storage *pdest_ss); +NTSTATUS cli_raw_tcon(struct cli_state *cli, + const char *service, const char *pass, const char *dev, + uint16 *max_xmit, uint16 *tid); +struct cli_state *get_ipc_connect(char *server, + struct sockaddr_storage *server_ss, + const struct user_auth_info *user_info); +struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx, + struct ip_service *mb_ip, + const struct user_auth_info *user_info, + char **pp_workgroup_out); +struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx, + const struct user_auth_info *user_info, + char **pp_workgroup_out); + +/* The following definitions come from libsmb/clidfs.c */ + +NTSTATUS cli_cm_force_encryption(struct cli_state *c, + const char *username, + const char *password, + const char *domain, + const char *sharename); +const char *cli_cm_get_mntpoint(struct cli_state *c); +struct cli_state *cli_cm_open(TALLOC_CTX *ctx, + struct cli_state *referring_cli, + const char *server, + const char *share, + bool show_hdr, + bool force_encrypt); +void cli_cm_shutdown(void); +void cli_cm_display(void); +void cli_cm_set_credentials(void); +void cli_cm_set_port(int port_number); +void cli_cm_set_dest_name_type(int type); +void cli_cm_set_signing_state(int state); +void cli_cm_set_username(const char *username); +void cli_cm_set_password(const char *newpass); +void cli_cm_set_use_kerberos(void); +void cli_cm_set_fallback_after_kerberos(void); +void cli_cm_set_dest_ss(struct sockaddr_storage *pss); +bool cli_dfs_get_referral(TALLOC_CTX *ctx, + struct cli_state *cli, + const char *path, + CLIENT_DFS_REFERRAL**refs, + size_t *num_refs, + uint16 *consumed); +bool cli_resolve_path(TALLOC_CTX *ctx, + const char *mountpt, + struct cli_state *rootcli, + const char *path, + struct cli_state **targetcli, + char **pp_targetpath); + +/* The following definitions come from libsmb/clidgram.c */ + +bool cli_send_mailslot(struct messaging_context *msg_ctx, + bool unique, const char *mailslot, + uint16 priority, + char *buf, int len, + const char *srcname, int src_type, + const char *dstname, int dest_type, + const struct sockaddr_storage *dest_ss); +bool send_getdc_request(TALLOC_CTX *mem_ctx, + struct messaging_context *msg_ctx, + struct sockaddr_storage *dc_ss, + const char *domain_name, + const DOM_SID *sid, + uint32_t nt_version); +bool receive_getdc_response(TALLOC_CTX *mem_ctx, + struct sockaddr_storage *dc_ss, + const char *domain_name, + uint32_t *nt_version, + const char **dc_name, + union nbt_cldap_netlogon **reply); + +/* The following definitions come from libsmb/clientgen.c */ + +int cli_set_message(char *buf,int num_words,int num_bytes,bool zero); +unsigned int cli_set_timeout(struct cli_state *cli, unsigned int timeout); +int cli_set_port(struct cli_state *cli, int port); +bool cli_receive_smb(struct cli_state *cli); +ssize_t cli_receive_smb_data(struct cli_state *cli, char *buffer, size_t len); +bool cli_receive_smb_readX_header(struct cli_state *cli); +bool cli_send_smb(struct cli_state *cli); +bool cli_send_smb_direct_writeX(struct cli_state *cli, + const char *p, + size_t extradata); +void cli_setup_packet_buf(struct cli_state *cli, char *buf); +void cli_setup_packet(struct cli_state *cli); +void cli_setup_bcc(struct cli_state *cli, void *p); +void cli_init_creds(struct cli_state *cli, const char *username, const char *domain, const char *password); +void cli_setup_signing_state(struct cli_state *cli, int signing_state); +struct cli_state *cli_initialise(void); +void cli_nt_pipes_close(struct cli_state *cli); +void cli_shutdown(struct cli_state *cli); +void cli_sockopt(struct cli_state *cli, const char *options); +uint16 cli_setpid(struct cli_state *cli, uint16 pid); +bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive); +bool cli_send_keepalive(struct cli_state *cli); +struct async_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct cli_state *cli, uint16_t num_echos, + DATA_BLOB data); +NTSTATUS cli_echo_recv(struct async_req *req); +NTSTATUS cli_echo(struct cli_state *cli, uint16_t num_echos, DATA_BLOB data); + +/* The following definitions come from libsmb/clierror.c */ + +const char *cli_errstr(struct cli_state *cli); +NTSTATUS cli_nt_error(struct cli_state *cli); +void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode); +int cli_errno(struct cli_state *cli); +bool cli_is_error(struct cli_state *cli); +bool cli_is_nt_error(struct cli_state *cli); +bool cli_is_dos_error(struct cli_state *cli); +NTSTATUS cli_get_nt_error(struct cli_state *cli); +void cli_set_nt_error(struct cli_state *cli, NTSTATUS status); +void cli_reset_error(struct cli_state *cli); + +/* The following definitions come from libsmb/clifile.c */ + +uint32 unix_perms_to_wire(mode_t perms); +mode_t wire_perms_to_unix(uint32 perms); +bool cli_unix_getfacl(struct cli_state *cli, const char *name, size_t *prb_size, char **retbuf); +bool cli_unix_stat(struct cli_state *cli, const char *name, SMB_STRUCT_STAT *sbuf); +bool cli_unix_symlink(struct cli_state *cli, const char *oldname, const char *newname); +bool cli_unix_hardlink(struct cli_state *cli, const char *oldname, const char *newname); +bool cli_unix_chmod(struct cli_state *cli, const char *fname, mode_t mode); +bool cli_unix_chown(struct cli_state *cli, const char *fname, uid_t uid, gid_t gid); +bool cli_rename(struct cli_state *cli, const char *fname_src, const char *fname_dst); +bool cli_ntrename(struct cli_state *cli, const char *fname_src, const char *fname_dst); +bool cli_nt_hardlink(struct cli_state *cli, const char *fname_src, const char *fname_dst); +bool cli_unlink_full(struct cli_state *cli, const char *fname, uint16 attrs); +bool cli_unlink(struct cli_state *cli, const char *fname); +bool cli_mkdir(struct cli_state *cli, const char *dname); +bool cli_rmdir(struct cli_state *cli, const char *dname); +int cli_nt_delete_on_close(struct cli_state *cli, int fnum, bool flag); +int cli_nt_create_full(struct cli_state *cli, const char *fname, + uint32 CreatFlags, uint32 DesiredAccess, + uint32 FileAttributes, uint32 ShareAccess, + uint32 CreateDisposition, uint32 CreateOptions, + uint8 SecuityFlags); +int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess); +uint8_t *smb_bytes_push_str(uint8_t *buf, bool ucs2, const char *str); +struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct cli_state *cli, + const char *fname, int flags, int share_mode); +NTSTATUS cli_open_recv(struct async_req *req, int *fnum); +int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode); +struct async_req *cli_close_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct cli_state *cli, int fnum); +NTSTATUS cli_close_recv(struct async_req *req); +bool cli_close(struct cli_state *cli, int fnum); +bool cli_ftruncate(struct cli_state *cli, int fnum, uint64_t size); +NTSTATUS cli_locktype(struct cli_state *cli, int fnum, + uint32 offset, uint32 len, + int timeout, unsigned char locktype); +bool cli_lock(struct cli_state *cli, int fnum, + uint32 offset, uint32 len, int timeout, enum brl_type lock_type); +bool cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len); +bool cli_lock64(struct cli_state *cli, int fnum, + SMB_BIG_UINT offset, SMB_BIG_UINT len, int timeout, enum brl_type lock_type); +bool cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len); +bool cli_posix_lock(struct cli_state *cli, int fnum, + SMB_BIG_UINT offset, SMB_BIG_UINT len, + bool wait_lock, enum brl_type lock_type); +bool cli_posix_unlock(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len); +bool cli_posix_getlock(struct cli_state *cli, int fnum, SMB_BIG_UINT *poffset, SMB_BIG_UINT *plen); +bool cli_getattrE(struct cli_state *cli, int fd, + uint16 *attr, SMB_OFF_T *size, + time_t *change_time, + time_t *access_time, + time_t *write_time); +bool cli_getatr(struct cli_state *cli, const char *fname, + uint16 *attr, SMB_OFF_T *size, time_t *write_time); +bool cli_setattrE(struct cli_state *cli, int fd, + time_t change_time, + time_t access_time, + time_t write_time); +bool cli_setatr(struct cli_state *cli, const char *fname, uint16 attr, time_t t); +bool cli_chkpath(struct cli_state *cli, const char *path); +bool cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail); +int cli_ctemp(struct cli_state *cli, const char *path, char **tmp_path); +NTSTATUS cli_raw_ioctl(struct cli_state *cli, int fnum, uint32 code, DATA_BLOB *blob); +bool cli_set_ea_path(struct cli_state *cli, const char *path, const char *ea_name, const char *ea_val, size_t ea_len); +bool cli_set_ea_fnum(struct cli_state *cli, int fnum, const char *ea_name, const char *ea_val, size_t ea_len); +bool cli_get_ea_list_path(struct cli_state *cli, const char *path, + TALLOC_CTX *ctx, + size_t *pnum_eas, + struct ea_struct **pea_list); +bool cli_get_ea_list_fnum(struct cli_state *cli, int fnum, + TALLOC_CTX *ctx, + size_t *pnum_eas, + struct ea_struct **pea_list); +int cli_posix_open(struct cli_state *cli, const char *fname, int flags, mode_t mode); +int cli_posix_mkdir(struct cli_state *cli, const char *fname, mode_t mode); +bool cli_posix_unlink(struct cli_state *cli, const char *fname); +int cli_posix_rmdir(struct cli_state *cli, const char *fname); + +/* The following definitions come from libsmb/clifsinfo.c */ + +bool cli_unix_extensions_version(struct cli_state *cli, uint16 *pmajor, uint16 *pminor, + uint32 *pcaplow, uint32 *pcaphigh); +bool cli_set_unix_extensions_capabilities(struct cli_state *cli, uint16 major, uint16 minor, + uint32 caplow, uint32 caphigh); +bool cli_get_fs_attr_info(struct cli_state *cli, uint32 *fs_attr); +bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number); +bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate); +NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli, + const char *user, + const char *pass, + const char *domain); +NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli); +NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli); +NTSTATUS cli_force_encryption(struct cli_state *c, + const char *username, + const char *password, + const char *domain); + +/* The following definitions come from libsmb/clikrb5.c */ + +bool unwrap_edata_ntstatus(TALLOC_CTX *mem_ctx, + DATA_BLOB *edata, + DATA_BLOB *edata_out); +bool unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data, DATA_BLOB *unwrapped_pac_data); +int cli_krb5_get_ticket(const char *principal, time_t time_offset, + DATA_BLOB *ticket, DATA_BLOB *session_key_krb5, + uint32 extra_ap_opts, const char *ccname, + time_t *tgs_expire); + +/* The following definitions come from libsmb/clilist.c */ + +int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, + void (*fn)(const char *, file_info *, const char *, void *), void *state); +int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, + void (*fn)(const char *, file_info *, const char *, void *), void *state); +int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, + void (*fn)(const char *, file_info *, const char *, void *), void *state); + +/* The following definitions come from libsmb/climessage.c */ + +int cli_message_start_build(struct cli_state *cli, const char *host, const char *username); +bool cli_message_start(struct cli_state *cli, const char *host, const char *username, + int *grp); +int cli_message_text_build(struct cli_state *cli, const char *msg, int len, int grp); +bool cli_message_text(struct cli_state *cli, const char *msg, int len, int grp); +int cli_message_end_build(struct cli_state *cli, int grp); +bool cli_message_end(struct cli_state *cli, int grp); + +/* The following definitions come from libsmb/clioplock.c */ + +bool cli_oplock_ack(struct cli_state *cli, int fnum, unsigned char level); +void cli_oplock_handler(struct cli_state *cli, + bool (*handler)(struct cli_state *, int, unsigned char)); + +/* The following definitions come from libsmb/cliprint.c */ + +int cli_print_queue(struct cli_state *cli, + void (*fn)(struct print_job_info *)); +int cli_printjob_del(struct cli_state *cli, int job); +int cli_spl_open(struct cli_state *cli, const char *fname, int flags, int share_mode); +bool cli_spl_close(struct cli_state *cli, int fnum); + +/* The following definitions come from libsmb/cliquota.c */ + +bool cli_get_quota_handle(struct cli_state *cli, int *quota_fnum); +void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list); +bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt); +bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt); +bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list); +bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt); +bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUCT *pqt); +void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric)); +void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, DOM_SID *sid, bool _numeric)); + +/* The following definitions come from libsmb/clirap.c */ + +bool cli_api_pipe(struct cli_state *cli, const char *pipe_name, + uint16 *setup, uint32 setup_count, uint32 max_setup_count, + char *params, uint32 param_count, uint32 max_param_count, + char *data, uint32 data_count, uint32 max_data_count, + char **rparam, uint32 *rparam_count, + char **rdata, uint32 *rdata_count); +bool cli_api(struct cli_state *cli, + char *param, int prcnt, int mprcnt, + char *data, int drcnt, int mdrcnt, + char **rparam, unsigned int *rprcnt, + char **rdata, unsigned int *rdrcnt); +bool cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation); +int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *, void *), void *state); +bool cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, + void (*fn)(const char *, uint32, const char *, void *), + void *state); +bool cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password, + const char *old_password); +bool cli_qpathinfo(struct cli_state *cli, + const char *fname, + time_t *change_time, + time_t *access_time, + time_t *write_time, + SMB_OFF_T *size, + uint16 *mode); +bool cli_setpathinfo(struct cli_state *cli, const char *fname, + time_t create_time, + time_t access_time, + time_t write_time, + time_t change_time, + uint16 mode); +bool cli_qpathinfo2(struct cli_state *cli, const char *fname, + struct timespec *create_time, + struct timespec *access_time, + struct timespec *write_time, + struct timespec *change_time, + SMB_OFF_T *size, uint16 *mode, + SMB_INO_T *ino); +bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname, + TALLOC_CTX *mem_ctx, + unsigned int *pnum_streams, + struct stream_struct **pstreams); +bool cli_qfilename(struct cli_state *cli, int fnum, char *name, size_t namelen); +bool cli_qfileinfo(struct cli_state *cli, int fnum, + uint16 *mode, SMB_OFF_T *size, + struct timespec *create_time, + struct timespec *access_time, + struct timespec *write_time, + struct timespec *change_time, + SMB_INO_T *ino); +bool cli_qpathinfo_basic( struct cli_state *cli, const char *name, + SMB_STRUCT_STAT *sbuf, uint32 *attributes ); +bool cli_qfileinfo_test(struct cli_state *cli, int fnum, int level, char **poutdata, uint32 *poutlen); +NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstring alt_name); + +/* The following definitions come from libsmb/clirap2.c */ + +int cli_NetGroupDelete(struct cli_state *cli, const char *group_name); +int cli_NetGroupAdd(struct cli_state *cli, RAP_GROUP_INFO_1 *grinfo); +int cli_RNetGroupEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state); +int cli_RNetGroupEnum0(struct cli_state *cli, + void (*fn)(const char *, void *), + void *state); +int cli_NetGroupDelUser(struct cli_state * cli, const char *group_name, const char *user_name); +int cli_NetGroupAddUser(struct cli_state * cli, const char *group_name, const char *user_name); +int cli_NetGroupGetUsers(struct cli_state * cli, const char *group_name, void (*fn)(const char *, void *), void *state ); +int cli_NetUserGetGroups(struct cli_state * cli, const char *user_name, void (*fn)(const char *, void *), void *state ); +int cli_NetUserDelete(struct cli_state *cli, const char * user_name ); +int cli_NetUserAdd(struct cli_state *cli, RAP_USER_INFO_1 * userinfo ); +int cli_RNetUserEnum(struct cli_state *cli, void (*fn)(const char *, const char *, const char *, const char *, void *), void *state); +int cli_RNetUserEnum0(struct cli_state *cli, + void (*fn)(const char *, void *), + void *state); +int cli_NetFileClose(struct cli_state *cli, uint32 file_id ); +int cli_NetFileGetInfo(struct cli_state *cli, uint32 file_id, void (*fn)(const char *, const char *, uint16, uint16, uint32)); +int cli_NetFileEnum(struct cli_state *cli, const char * user, + const char * base_path, + void (*fn)(const char *, const char *, uint16, uint16, + uint32)); +int cli_NetShareAdd(struct cli_state *cli, RAP_SHARE_INFO_2 * sinfo ); +int cli_NetShareDelete(struct cli_state *cli, const char * share_name ); +bool cli_get_pdc_name(struct cli_state *cli, const char *workgroup, char **pdc_name); +bool cli_get_server_domain(struct cli_state *cli); +bool cli_get_server_type(struct cli_state *cli, uint32 *pstype); +bool cli_get_server_name(TALLOC_CTX *mem_ctx, struct cli_state *cli, + char **servername); +bool cli_ns_check_server_type(struct cli_state *cli, char *workgroup, uint32 stype); +bool cli_NetWkstaUserLogoff(struct cli_state *cli, const char *user, const char *workstation); +int cli_NetPrintQEnum(struct cli_state *cli, + void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16), + void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*)); +int cli_NetPrintQGetInfo(struct cli_state *cli, const char *printer, + void (*qfn)(const char*,uint16,uint16,uint16,const char*,const char*,const char*,const char*,const char*,uint16,uint16), + void (*jfn)(uint16,const char*,const char*,const char*,const char*,uint16,uint16,const char*,uint,uint,const char*)); +int cli_RNetServiceEnum(struct cli_state *cli, void (*fn)(const char *, const char *, void *), void *state); +int cli_NetSessionEnum(struct cli_state *cli, void (*fn)(char *, char *, uint16, uint16, uint16, uint, uint, uint, char *)); +int cli_NetSessionGetInfo(struct cli_state *cli, const char *workstation, + void (*fn)(const char *, const char *, uint16, uint16, uint16, uint, uint, uint, const char *)); +int cli_NetSessionDel(struct cli_state *cli, const char *workstation); +int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier, + void (*fn)(uint16_t conid, uint16_t contype, + uint16_t numopens, uint16_t numusers, + uint32_t contime, const char *username, + const char *netname)); + +/* The following definitions come from libsmb/clireadwrite.c */ + +struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, int fnum, + off_t offset, size_t size); +NTSTATUS cli_read_andx_recv(struct async_req *req, ssize_t *received, + uint8_t **rcvbuf); +struct async_req *cli_pull_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, + uint16_t fnum, off_t start_offset, + SMB_OFF_T size, size_t window_size, + NTSTATUS (*sink)(char *buf, size_t n, + void *priv), + void *priv); +NTSTATUS cli_pull_recv(struct async_req *req, SMB_OFF_T *received); +NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum, + off_t start_offset, SMB_OFF_T size, size_t window_size, + NTSTATUS (*sink)(char *buf, size_t n, void *priv), + void *priv, SMB_OFF_T *received); +ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, + off_t offset, size_t size); +ssize_t cli_readraw(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size); +ssize_t cli_write(struct cli_state *cli, + int fnum, uint16 write_mode, + const char *buf, off_t offset, size_t size); +ssize_t cli_smbwrite(struct cli_state *cli, + int fnum, char *buf, off_t offset, size_t size1); + +/* The following definitions come from libsmb/clisecdesc.c */ + +SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum, + TALLOC_CTX *mem_ctx); +bool cli_set_secdesc(struct cli_state *cli, int fnum, SEC_DESC *sd); + +/* The following definitions come from libsmb/clispnego.c */ + +DATA_BLOB spnego_gen_negTokenInit(char guid[16], + const char *OIDs[], + const char *principal); +DATA_BLOB gen_negTokenInit(const char *OID, DATA_BLOB blob); +bool spnego_parse_negTokenInit(DATA_BLOB blob, + char *OIDs[ASN1_MAX_OIDS], + char **principal); +DATA_BLOB gen_negTokenTarg(const char *OIDs[], DATA_BLOB blob); +bool parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *secblob); +DATA_BLOB spnego_gen_krb5_wrap(const DATA_BLOB ticket, const uint8 tok_id[2]); +bool spnego_parse_krb5_wrap(DATA_BLOB blob, DATA_BLOB *ticket, uint8 tok_id[2]); +int spnego_gen_negTokenTarg(const char *principal, int time_offset, + DATA_BLOB *targ, + DATA_BLOB *session_key_krb5, uint32 extra_ap_opts, + time_t *expire_time); +bool spnego_parse_challenge(const DATA_BLOB blob, + DATA_BLOB *chal1, DATA_BLOB *chal2); +DATA_BLOB spnego_gen_auth(DATA_BLOB blob); +bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth); +DATA_BLOB spnego_gen_auth_response(DATA_BLOB *reply, NTSTATUS nt_status, + const char *mechOID); +bool spnego_parse_auth_response(DATA_BLOB blob, NTSTATUS nt_status, + const char *mechOID, + DATA_BLOB *auth); + +/* The following definitions come from libsmb/clistr.c */ + +size_t clistr_push_fn(const char *function, + unsigned int line, + struct cli_state *cli, + void *dest, + const char *src, + int dest_len, + int flags); +size_t clistr_pull_fn(const char *function, + unsigned int line, + struct cli_state *cli, + char *dest, + const void *src, + int dest_len, + int src_len, + int flags); +size_t clistr_pull_talloc_fn(const char *function, + unsigned int line, + TALLOC_CTX *ctx, + struct cli_state *cli, + char **pp_dest, + const void *src, + int src_len, + int flags); +size_t clistr_align_out(struct cli_state *cli, const void *p, int flags); +size_t clistr_align_in(struct cli_state *cli, const void *p, int flags); + +/* The following definitions come from libsmb/clitrans.c */ + +bool cli_send_trans(struct cli_state *cli, int trans, + const char *pipe_name, + int fid, int flags, + uint16 *setup, unsigned int lsetup, unsigned int msetup, + const char *param, unsigned int lparam, unsigned int mparam, + const char *data, unsigned int ldata, unsigned int mdata); +bool cli_receive_trans(struct cli_state *cli,int trans, + char **param, unsigned int *param_len, + char **data, unsigned int *data_len); +bool cli_send_nt_trans(struct cli_state *cli, + int function, + int flags, + uint16 *setup, unsigned int lsetup, unsigned int msetup, + char *param, unsigned int lparam, unsigned int mparam, + char *data, unsigned int ldata, unsigned int mdata); +bool cli_receive_nt_trans(struct cli_state *cli, + char **param, unsigned int *param_len, + char **data, unsigned int *data_len); +struct async_req *cli_trans_send( + TALLOC_CTX *mem_ctx, struct event_context *ev, + struct cli_state *cli, uint8_t trans_cmd, + const char *pipe_name, uint16_t fid, uint16_t function, int flags, + uint16_t *setup, uint8_t num_setup, uint8_t max_setup, + uint8_t *param, uint32_t num_param, uint32_t max_param, + uint8_t *data, uint32_t num_data, uint32_t max_data); +NTSTATUS cli_trans_recv(struct async_req *req, TALLOC_CTX *mem_ctx, + uint16_t **setup, uint8_t *num_setup, + uint8_t **param, uint32_t *num_param, + uint8_t **data, uint32_t *num_data); +NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli, + uint8_t trans_cmd, + const char *pipe_name, uint16_t fid, uint16_t function, + int flags, + uint16_t *setup, uint8_t num_setup, uint8_t max_setup, + uint8_t *param, uint32_t num_param, uint32_t max_param, + uint8_t *data, uint32_t num_data, uint32_t max_data, + uint16_t **rsetup, uint8_t *num_rsetup, + uint8_t **rparam, uint32_t *num_rparam, + uint8_t **rdata, uint32_t *num_rdata); + +/* The following definitions come from libsmb/conncache.c */ + +NTSTATUS check_negative_conn_cache_timeout( const char *domain, const char *server, unsigned int failed_cache_timeout ); +NTSTATUS check_negative_conn_cache( const char *domain, const char *server); +void add_failed_connection_entry(const char *domain, const char *server, NTSTATUS result) ; +void delete_negative_conn_cache(const char *domain, const char *server); +void flush_negative_conn_cache( void ); +void flush_negative_conn_cache_for_domain(const char *domain); + +/* The following definitions come from libsmb/credentials.c */ + +char *credstr(const unsigned char *cred); +void creds_server_init(uint32 neg_flags, + struct dcinfo *dc, + struct netr_Credential *clnt_chal, + struct netr_Credential *srv_chal, + const unsigned char mach_pw[16], + struct netr_Credential *init_chal_out); +bool netlogon_creds_server_check(const struct dcinfo *dc, + const struct netr_Credential *rcv_cli_chal_in); +bool netlogon_creds_server_step(struct dcinfo *dc, + const struct netr_Authenticator *received_cred, + struct netr_Authenticator *cred_out); +void creds_client_init(uint32 neg_flags, + struct dcinfo *dc, + struct netr_Credential *clnt_chal, + struct netr_Credential *srv_chal, + const unsigned char mach_pw[16], + struct netr_Credential *init_chal_out); +bool netlogon_creds_client_check(const struct dcinfo *dc, + const struct netr_Credential *rcv_srv_chal_in); +void netlogon_creds_client_step(struct dcinfo *dc, + struct netr_Authenticator *next_cred_out); + +/* The following definitions come from libsmb/dcerpc_err.c */ + +const char *dcerpc_errstr(uint32 fault_code); + +/* The following definitions come from libsmb/doserr.c */ + +const char *dos_errstr(WERROR werror); +const char *get_friendly_werror_msg(WERROR werror); +const char *win_errstr(WERROR werror); + +/* The following definitions come from libsmb/dsgetdcname.c */ + +void debug_dsdcinfo_flags(int lvl, uint32_t flags); +NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, + struct messaging_context *msg_ctx, + const char *domain_name, + struct GUID *domain_guid, + const char *site_name, + uint32_t flags, + struct netr_DsRGetDCNameInfo **info); + +/* The following definitions come from libsmb/errormap.c */ + +NTSTATUS dos_to_ntstatus(uint8 eclass, uint32 ecode); +void ntstatus_to_dos(NTSTATUS ntstatus, uint8 *eclass, uint32 *ecode); +NTSTATUS werror_to_ntstatus(WERROR error); +WERROR ntstatus_to_werror(NTSTATUS error); +NTSTATUS map_nt_error_from_gss(uint32 gss_maj, uint32 minor); + +/* The following definitions come from libsmb/namecache.c */ + +bool namecache_enable(void); +bool namecache_shutdown(void); +bool namecache_store(const char *name, + int name_type, + int num_names, + struct ip_service *ip_list); +bool namecache_fetch(const char *name, + int name_type, + struct ip_service **ip_list, + int *num_names); +bool namecache_delete(const char *name, int name_type); +void namecache_flush(void); +bool namecache_status_store(const char *keyname, int keyname_type, + int name_type, const struct sockaddr_storage *keyip, + const char *srvname); +bool namecache_status_fetch(const char *keyname, + int keyname_type, + int name_type, + const struct sockaddr_storage *keyip, + char *srvname_out); + +/* The following definitions come from libsmb/namequery.c */ + +bool saf_store( const char *domain, const char *servername ); +bool saf_delete( const char *domain ); +char *saf_fetch( const char *domain ); +NODE_STATUS_STRUCT *node_status_query(int fd, + struct nmb_name *name, + const struct sockaddr_storage *to_ss, + int *num_names, + struct node_status_extra *extra); +bool name_status_find(const char *q_name, + int q_type, + int type, + const struct sockaddr_storage *to_ss, + fstring name); +int ip_service_compare(struct ip_service *ss1, struct ip_service *ss2); +struct sockaddr_storage *name_query(int fd, + const char *name, + int name_type, + bool bcast, + bool recurse, + const struct sockaddr_storage *to_ss, + int *count, + int *flags, + bool *timed_out); +XFILE *startlmhosts(const char *fname); +bool getlmhostsent(TALLOC_CTX *ctx, XFILE *fp, char **pp_name, int *name_type, + struct sockaddr_storage *pss); +void endlmhosts(XFILE *fp); +NTSTATUS name_resolve_bcast(const char *name, + int name_type, + struct ip_service **return_iplist, + int *return_count); +NTSTATUS resolve_wins(const char *name, + int name_type, + struct ip_service **return_iplist, + int *return_count); +NTSTATUS internal_resolve_name(const char *name, + int name_type, + const char *sitename, + struct ip_service **return_iplist, + int *return_count, + const char *resolve_order); +bool resolve_name(const char *name, + struct sockaddr_storage *return_ss, + int name_type); +NTSTATUS resolve_name_list(TALLOC_CTX *ctx, + const char *name, + int name_type, + struct sockaddr_storage **return_ss_arr, + unsigned int *p_num_entries); +bool find_master_ip(const char *group, struct sockaddr_storage *master_ss); +bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss); +NTSTATUS get_sorted_dc_list( const char *domain, + const char *sitename, + struct ip_service **ip_list, + int *count, + bool ads_only ); +NTSTATUS get_kdc_list( const char *realm, + const char *sitename, + struct ip_service **ip_list, + int *count); + +/* The following definitions come from libsmb/namequery_dc.c */ + +bool get_dc_name(const char *domain, + const char *realm, + fstring srv_name, + struct sockaddr_storage *ss_out); + +/* The following definitions come from libsmb/nmblib.c */ + +void debug_nmb_packet(struct packet_struct *p); +void put_name(char *dest, const char *name, int pad, unsigned int name_type); +char *nmb_namestr(const struct nmb_name *n); +struct packet_struct *copy_packet(struct packet_struct *packet); +void free_packet(struct packet_struct *packet); +struct packet_struct *parse_packet(char *buf,int length, + enum packet_type packet_type, + struct in_addr ip, + int port); +struct packet_struct *read_packet(int fd,enum packet_type packet_type); +void make_nmb_name( struct nmb_name *n, const char *name, int type); +bool nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2); +int build_packet(char *buf, size_t buflen, struct packet_struct *p); +bool send_packet(struct packet_struct *p); +struct packet_struct *receive_packet(int fd,enum packet_type type,int t); +struct packet_struct *receive_nmb_packet(int fd, int t, int trn_id); +struct packet_struct *receive_dgram_packet(int fd, int t, + const char *mailslot_name); +bool match_mailslot_name(struct packet_struct *p, const char *mailslot_name); +int matching_len_bits(unsigned char *p1, unsigned char *p2, size_t len); +void sort_query_replies(char *data, int n, struct in_addr ip); +int name_mangle( char *In, char *Out, char name_type ); +int name_extract(char *buf,int ofs, fstring name); +int name_len(char *s1); + +/* The following definitions come from libsmb/nterr.c */ + +const char *nt_errstr(NTSTATUS nt_code); +const char *get_friendly_nt_error_msg(NTSTATUS nt_code); +const char *get_nt_error_c_code(NTSTATUS nt_code); +NTSTATUS nt_status_string_to_code(char *nt_status_str); +NTSTATUS nt_status_squash(NTSTATUS nt_status); + +/* The following definitions come from libsmb/ntlm_check.c */ + +NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, + const DATA_BLOB *challenge, + const DATA_BLOB *lm_response, + const DATA_BLOB *nt_response, + const DATA_BLOB *lm_interactive_pwd, + const DATA_BLOB *nt_interactive_pwd, + const char *username, + const char *client_username, + const char *client_domain, + const uint8 *lm_pw, const uint8 *nt_pw, + DATA_BLOB *user_sess_key, + DATA_BLOB *lm_sess_key); + +/* The following definitions come from libsmb/ntlmssp.c */ + +void debug_ntlmssp_flags(uint32 neg_flags); +NTSTATUS ntlmssp_set_username(NTLMSSP_STATE *ntlmssp_state, const char *user) ; +NTSTATUS ntlmssp_set_hashes(NTLMSSP_STATE *ntlmssp_state, + const unsigned char lm_hash[16], + const unsigned char nt_hash[16]) ; +NTSTATUS ntlmssp_set_password(NTLMSSP_STATE *ntlmssp_state, const char *password) ; +NTSTATUS ntlmssp_set_domain(NTLMSSP_STATE *ntlmssp_state, const char *domain) ; +NTSTATUS ntlmssp_set_workstation(NTLMSSP_STATE *ntlmssp_state, const char *workstation) ; +NTSTATUS ntlmssp_store_response(NTLMSSP_STATE *ntlmssp_state, + DATA_BLOB response) ; +void ntlmssp_want_feature_list(NTLMSSP_STATE *ntlmssp_state, char *feature_list); +void ntlmssp_want_feature(NTLMSSP_STATE *ntlmssp_state, uint32 feature); +NTSTATUS ntlmssp_update(NTLMSSP_STATE *ntlmssp_state, + const DATA_BLOB in, DATA_BLOB *out) ; +void ntlmssp_end(NTLMSSP_STATE **ntlmssp_state); +DATA_BLOB ntlmssp_weaken_keys(NTLMSSP_STATE *ntlmssp_state, TALLOC_CTX *mem_ctx); +NTSTATUS ntlmssp_server_start(NTLMSSP_STATE **ntlmssp_state); +NTSTATUS ntlmssp_client_start(NTLMSSP_STATE **ntlmssp_state); + +/* The following definitions come from libsmb/ntlmssp_parse.c */ + +bool msrpc_gen(DATA_BLOB *blob, + const char *format, ...); +bool msrpc_parse(const DATA_BLOB *blob, + const char *format, ...); + +/* The following definitions come from libsmb/ntlmssp_sign.c */ + +NTSTATUS ntlmssp_sign_packet(NTLMSSP_STATE *ntlmssp_state, + const uchar *data, size_t length, + const uchar *whole_pdu, size_t pdu_length, + DATA_BLOB *sig) ; +NTSTATUS ntlmssp_check_packet(NTLMSSP_STATE *ntlmssp_state, + const uchar *data, size_t length, + const uchar *whole_pdu, size_t pdu_length, + const DATA_BLOB *sig) ; +NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state, + uchar *data, size_t length, + uchar *whole_pdu, size_t pdu_length, + DATA_BLOB *sig); +NTSTATUS ntlmssp_unseal_packet(NTLMSSP_STATE *ntlmssp_state, + uchar *data, size_t length, + uchar *whole_pdu, size_t pdu_length, + DATA_BLOB *sig); +NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state); + +/* The following definitions come from libsmb/passchange.c */ + +NTSTATUS remote_password_change(const char *remote_machine, const char *user_name, + const char *old_passwd, const char *new_passwd, + char **err_str); + +/* The following definitions come from libsmb/pwd_cache.c */ + +void pwd_set_cleartext(struct pwd_info *pwd, const char *clr); +void pwd_get_cleartext(struct pwd_info *pwd, fstring clr); + +/* The following definitions come from libsmb/samlogon_cache.c */ + +bool netsamlogon_cache_init(void); +bool netsamlogon_cache_shutdown(void); +void netsamlogon_clear_cached_user(struct netr_SamInfo3 *info3); +bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3); +struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const DOM_SID *user_sid); +bool netsamlogon_cache_have(const DOM_SID *user_sid); + +/* The following definitions come from libsmb/smb_seal.c */ + +NTSTATUS get_enc_ctx_num(const uint8_t *buf, uint16 *p_enc_ctx_num); +bool common_encryption_on(struct smb_trans_enc_state *es); +NTSTATUS common_ntlm_decrypt_buffer(NTLMSSP_STATE *ntlmssp_state, char *buf); +NTSTATUS common_ntlm_encrypt_buffer(NTLMSSP_STATE *ntlmssp_state, + uint16 enc_ctx_num, + char *buf, + char **ppbuf_out); +NTSTATUS common_encrypt_buffer(struct smb_trans_enc_state *es, char *buffer, char **buf_out); +NTSTATUS common_decrypt_buffer(struct smb_trans_enc_state *es, char *buf); +void common_free_encryption_state(struct smb_trans_enc_state **pp_es); +void common_free_enc_buffer(struct smb_trans_enc_state *es, char *buf); +bool cli_encryption_on(struct cli_state *cli); +void cli_free_encryption_context(struct cli_state *cli); +void cli_free_enc_buffer(struct cli_state *cli, char *buf); +NTSTATUS cli_decrypt_message(struct cli_state *cli); +NTSTATUS cli_encrypt_message(struct cli_state *cli, char *buf, char **buf_out); + +/* The following definitions come from libsmb/smb_signing.c */ + +bool cli_simple_set_signing(struct cli_state *cli, + const DATA_BLOB user_session_key, + const DATA_BLOB response); +bool cli_null_set_signing(struct cli_state *cli); +bool cli_temp_set_signing(struct cli_state *cli); +void cli_free_signing_context(struct cli_state *cli); +void cli_calculate_sign_mac(struct cli_state *cli, char *buf); +bool cli_check_sign_mac(struct cli_state *cli, char *buf); +bool client_set_trans_sign_state_on(struct cli_state *cli, uint16 mid); +bool client_set_trans_sign_state_off(struct cli_state *cli, uint16 mid); +bool client_is_signing_on(struct cli_state *cli); +bool srv_oplock_set_signing(bool onoff); +bool srv_check_sign_mac(const char *inbuf, bool must_be_ok); +void srv_calculate_sign_mac(char *outbuf); +void srv_defer_sign_response(uint16 mid); +void srv_cancel_sign_response(uint16 mid); +void srv_set_signing_negotiated(void); +bool srv_is_signing_active(void); +bool srv_is_signing_negotiated(void); +bool srv_signing_started(void); +void srv_set_signing(const DATA_BLOB user_session_key, const DATA_BLOB response); + +/* The following definitions come from libsmb/smbdes.c */ + +void des_crypt56(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw); +void E_P16(const unsigned char *p14,unsigned char *p16); +void E_P24(const unsigned char *p21, const unsigned char *c8, unsigned char *p24); +void D_P16(const unsigned char *p14, const unsigned char *in, unsigned char *out); +void E_old_pw_hash( unsigned char *p14, const unsigned char *in, unsigned char *out); +void des_crypt128(unsigned char out[8], const unsigned char in[8], const unsigned char key[16]); +void des_crypt64(unsigned char out[8], const unsigned char in[8], const unsigned char key[8]); +void des_crypt112(unsigned char out[8], const unsigned char in[8], const unsigned char key[14], int forw); +void cred_hash3(unsigned char *out, const unsigned char *in, const unsigned char *key, int forw); +void des_crypt112_16(unsigned char out[16], unsigned char in[16], const unsigned char key[14], int forw); +void SamOEMhash( unsigned char *data, const unsigned char key[16], size_t len); +void SamOEMhashBlob( unsigned char *data, size_t len, DATA_BLOB *key); +void sam_pwd_hash(unsigned int rid, const uchar *in, uchar *out, int forw); + +/* The following definitions come from libsmb/smbencrypt.c */ + +void SMBencrypt_hash(const uchar lm_hash[16], const uchar *c8, uchar p24[24]); +bool SMBencrypt(const char *passwd, const uchar *c8, uchar p24[24]); +void E_md4hash(const char *passwd, uchar p16[16]); +void E_md5hash(const uchar salt[16], const uchar nthash[16], uchar hash_out[16]); +bool E_deshash(const char *passwd, uchar p16[16]); +void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar p16[16]); +bool ntv2_owf_gen(const uchar owf[16], + const char *user_in, const char *domain_in, + bool upper_case_domain, /* Transform the domain into UPPER case */ + uchar kr_buf[16]); +void SMBOWFencrypt(const uchar passwd[16], const uchar *c8, uchar p24[24]); +void NTLMSSPOWFencrypt(const uchar passwd[8], const uchar *ntlmchalresp, uchar p24[24]); +void SMBNTencrypt_hash(const uchar nt_hash[16], uchar *c8, uchar *p24); +void SMBNTencrypt(const char *passwd, uchar *c8, uchar *p24); +void SMBOWFencrypt_ntv2(const uchar kr[16], + const DATA_BLOB *srv_chal, + const DATA_BLOB *cli_chal, + uchar resp_buf[16]); +void SMBsesskeygen_ntv2(const uchar kr[16], + const uchar * nt_resp, uint8 sess_key[16]); +void SMBsesskeygen_ntv1(const uchar kr[16], + const uchar * nt_resp, uint8 sess_key[16]); +void SMBsesskeygen_lm_sess_key(const uchar lm_hash[16], + const uchar lm_resp[24], /* only uses 8 */ + uint8 sess_key[16]); +DATA_BLOB NTLMv2_generate_names_blob(const char *hostname, + const char *domain); +bool SMBNTLMv2encrypt_hash(const char *user, const char *domain, const uchar nt_hash[16], + const DATA_BLOB *server_chal, + const DATA_BLOB *names_blob, + DATA_BLOB *lm_response, DATA_BLOB *nt_response, + DATA_BLOB *user_session_key) ; +bool SMBNTLMv2encrypt(const char *user, const char *domain, const char *password, + const DATA_BLOB *server_chal, + const DATA_BLOB *names_blob, + DATA_BLOB *lm_response, DATA_BLOB *nt_response, + DATA_BLOB *user_session_key) ; +bool encode_pw_buffer(uint8 buffer[516], const char *password, int string_flags); +bool decode_pw_buffer(TALLOC_CTX *ctx, + uint8 in_buffer[516], + char **pp_new_pwrd, + uint32 *new_pw_len, + int string_flags); +void encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532], const DATA_BLOB *psession_key); +void sess_crypt_blob(DATA_BLOB *out, const DATA_BLOB *in, const DATA_BLOB *session_key, int forward); +char *decrypt_trustdom_secret(uint8_t nt_hash[16], DATA_BLOB *data_in); +void encode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx, + const char *pwd, + DATA_BLOB *session_key, + struct wkssvc_PasswordBuffer **pwd_buf); +WERROR decode_wkssvc_join_password_buffer(TALLOC_CTX *mem_ctx, + struct wkssvc_PasswordBuffer *pwd_buf, + DATA_BLOB *session_key, + char **pwd); +DATA_BLOB decrypt_drsuapi_blob(TALLOC_CTX *mem_ctx, + const DATA_BLOB *session_key, + bool rcrypt, + uint32_t rid, + const DATA_BLOB *buffer); + +/* The following definitions come from libsmb/smberr.c */ + +const char *smb_dos_err_name(uint8 e_class, uint16 num); +const char *get_dos_error_msg(WERROR result); +const char *smb_dos_err_class(uint8 e_class); +char *smb_dos_errstr(char *inbuf); +WERROR map_werror_from_unix(int error); + +/* The following definitions come from libsmb/spnego.c */ + +ssize_t read_spnego_data(DATA_BLOB data, SPNEGO_DATA *token); +ssize_t write_spnego_data(DATA_BLOB *blob, SPNEGO_DATA *spnego); +bool free_spnego_data(SPNEGO_DATA *spnego); + +/* The following definitions come from libsmb/trustdom_cache.c */ + +bool trustdom_cache_enable(void); +bool trustdom_cache_shutdown(void); +bool trustdom_cache_store(char* name, char* alt_name, const DOM_SID *sid, + time_t timeout); +bool trustdom_cache_fetch(const char* name, DOM_SID* sid); +uint32 trustdom_cache_fetch_timestamp( void ); +bool trustdom_cache_store_timestamp( uint32 t, time_t timeout ); +void trustdom_cache_flush(void); +void update_trustdom_cache( void ); + +/* The following definitions come from libsmb/trusts_util.c */ + +NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *domain, + unsigned char orig_trust_passwd_hash[16], + uint32 sec_channel_type); +NTSTATUS trust_pw_find_change_and_store_it(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *domain) ; +bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain, + char ***domain_names, uint32 *num_domains, + DOM_SID **sids ); + +/* The following definitions come from libsmb/unexpected.c */ + +void unexpected_packet(struct packet_struct *p); +void clear_unexpected(time_t t); +struct packet_struct *receive_unexpected(enum packet_type packet_type, int id, + const char *mailslot_name); + +/* The following definitions come from locking/brlock.c */ + +bool brl_same_context(const struct lock_context *ctx1, + const struct lock_context *ctx2); +void brl_init(bool read_only); +void brl_shutdown(void); +NTSTATUS brl_lock(struct messaging_context *msg_ctx, + struct byte_range_lock *br_lck, + uint32 smbpid, + struct server_id pid, + br_off start, + br_off size, + enum brl_type lock_type, + enum brl_flavour lock_flav, + bool blocking_lock, + uint32 *psmbpid); +bool brl_unlock(struct messaging_context *msg_ctx, + struct byte_range_lock *br_lck, + uint32 smbpid, + struct server_id pid, + br_off start, + br_off size, + enum brl_flavour lock_flav); +bool brl_locktest(struct byte_range_lock *br_lck, + uint32 smbpid, + struct server_id pid, + br_off start, + br_off size, + enum brl_type lock_type, + enum brl_flavour lock_flav); +NTSTATUS brl_lockquery(struct byte_range_lock *br_lck, + uint32 *psmbpid, + struct server_id pid, + br_off *pstart, + br_off *psize, + enum brl_type *plock_type, + enum brl_flavour lock_flav); +bool brl_lock_cancel(struct byte_range_lock *br_lck, + uint32 smbpid, + struct server_id pid, + br_off start, + br_off size, + enum brl_flavour lock_flav); +void brl_close_fnum(struct messaging_context *msg_ctx, + struct byte_range_lock *br_lck); +int brl_forall(void (*fn)(struct file_id id, struct server_id pid, + enum brl_type lock_type, + enum brl_flavour lock_flav, + br_off start, br_off size, + void *private_data), + void *private_data); +struct byte_range_lock *brl_get_locks(TALLOC_CTX *mem_ctx, + files_struct *fsp); +struct byte_range_lock *brl_get_locks_readonly(TALLOC_CTX *mem_ctx, + files_struct *fsp); +void brl_register_msgs(struct messaging_context *msg_ctx); + +/* The following definitions come from locking/locking.c */ + +const char *lock_type_name(enum brl_type lock_type); +const char *lock_flav_name(enum brl_flavour lock_flav); +bool is_locked(files_struct *fsp, + uint32 smbpid, + SMB_BIG_UINT count, + SMB_BIG_UINT offset, + enum brl_type lock_type); +NTSTATUS query_lock(files_struct *fsp, + uint32 *psmbpid, + SMB_BIG_UINT *pcount, + SMB_BIG_UINT *poffset, + enum brl_type *plock_type, + enum brl_flavour lock_flav); +struct byte_range_lock *do_lock(struct messaging_context *msg_ctx, + files_struct *fsp, + uint32 lock_pid, + SMB_BIG_UINT count, + SMB_BIG_UINT offset, + enum brl_type lock_type, + enum brl_flavour lock_flav, + bool blocking_lock, + NTSTATUS *perr, + uint32 *plock_pid); +NTSTATUS do_unlock(struct messaging_context *msg_ctx, + files_struct *fsp, + uint32 lock_pid, + SMB_BIG_UINT count, + SMB_BIG_UINT offset, + enum brl_flavour lock_flav); +NTSTATUS do_lock_cancel(files_struct *fsp, + uint32 lock_pid, + SMB_BIG_UINT count, + SMB_BIG_UINT offset, + enum brl_flavour lock_flav); +void locking_close_file(struct messaging_context *msg_ctx, + files_struct *fsp); +bool locking_init(void); +bool locking_init_readonly(void); +bool locking_end(void); +char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e); +struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx, + const struct file_id id, + const char *servicepath, + const char *fname, + const struct timespec *old_write_time); +struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx, + const struct file_id id, + const char *servicepath, + const char *fname); +bool rename_share_filename(struct messaging_context *msg_ctx, + struct share_mode_lock *lck, + const char *servicepath, + const char *newname); +void get_file_infos(struct file_id id, + bool *delete_on_close, + struct timespec *write_time); +bool is_valid_share_mode_entry(const struct share_mode_entry *e); +bool is_deferred_open_entry(const struct share_mode_entry *e); +bool is_unused_share_mode_entry(const struct share_mode_entry *e); +void set_share_mode(struct share_mode_lock *lck, files_struct *fsp, + uid_t uid, uint16 mid, uint16 op_type, bool initial_delete_on_close_allowed); +void add_deferred_open(struct share_mode_lock *lck, uint16 mid, + struct timeval request_time, + struct file_id id); +bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp); +void del_deferred_open_entry(struct share_mode_lock *lck, uint16 mid); +bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp); +bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp); +NTSTATUS can_set_delete_on_close(files_struct *fsp, bool delete_on_close, + uint32 dosmode); +bool can_set_initial_delete_on_close(const struct share_mode_lock *lck); +void set_delete_on_close_token(struct share_mode_lock *lck, UNIX_USER_TOKEN *tok); +void set_delete_on_close_lck(struct share_mode_lock *lck, bool delete_on_close, UNIX_USER_TOKEN *tok); +bool set_delete_on_close(files_struct *fsp, bool delete_on_close, UNIX_USER_TOKEN *tok); +bool set_allow_initial_delete_on_close(struct share_mode_lock *lck, files_struct *fsp, bool delete_on_close); +bool set_sticky_write_time(struct file_id fileid, struct timespec write_time); +bool set_write_time(struct file_id fileid, struct timespec write_time); +int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *, + const char *, void *), + void *private_data); + +/* The following definitions come from locking/posix.c */ + +bool is_posix_locked(files_struct *fsp, + SMB_BIG_UINT *pu_offset, + SMB_BIG_UINT *pu_count, + enum brl_type *plock_type, + enum brl_flavour lock_flav); +bool posix_locking_init(bool read_only); +bool posix_locking_end(void); +void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount); +int fd_close_posix(struct files_struct *fsp); +bool set_posix_lock_windows_flavour(files_struct *fsp, + SMB_BIG_UINT u_offset, + SMB_BIG_UINT u_count, + enum brl_type lock_type, + const struct lock_context *lock_ctx, + const struct lock_struct *plocks, + int num_locks, + int *errno_ret); +bool release_posix_lock_windows_flavour(files_struct *fsp, + SMB_BIG_UINT u_offset, + SMB_BIG_UINT u_count, + enum brl_type deleted_lock_type, + const struct lock_context *lock_ctx, + const struct lock_struct *plocks, + int num_locks); +bool set_posix_lock_posix_flavour(files_struct *fsp, + SMB_BIG_UINT u_offset, + SMB_BIG_UINT u_count, + enum brl_type lock_type, + int *errno_ret); +bool release_posix_lock_posix_flavour(files_struct *fsp, + SMB_BIG_UINT u_offset, + SMB_BIG_UINT u_count, + const struct lock_context *lock_ctx, + const struct lock_struct *plocks, + int num_locks); + +/* The following definitions come from modules/vfs_default.c */ + +int vfswrap_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); +ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); +ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size); +NTSTATUS vfs_default_init(void); + +/* The following definitions come from nmbd/asyncdns.c */ + +int asyncdns_fd(void); +void kill_async_dns_child(void); +void start_async_dns(void); +void run_dns_queue(void); +bool queue_dns_query(struct packet_struct *p,struct nmb_name *question); +bool queue_dns_query(struct packet_struct *p,struct nmb_name *question); +void kill_async_dns_child(void); + +/* The following definitions come from nmbd/nmbd.c */ + +struct event_context *nmbd_event_context(void); +struct messaging_context *nmbd_messaging_context(void); + +/* The following definitions come from nmbd/nmbd_become_dmb.c */ + +void add_domain_names(time_t t); + +/* The following definitions come from nmbd/nmbd_become_lmb.c */ + +void insert_permanent_name_into_unicast( struct subnet_record *subrec, + struct nmb_name *nmbname, uint16 nb_type ); +void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work, + bool force_new_election); +void become_local_master_browser(struct subnet_record *subrec, struct work_record *work); +void set_workgroup_local_master_browser_name( struct work_record *work, const char *newname); + +/* The following definitions come from nmbd/nmbd_browserdb.c */ + +void update_browser_death_time( struct browse_cache_record *browc ); +struct browse_cache_record *create_browser_in_lmb_cache( const char *work_name, + const char *browser_name, + struct in_addr ip ); +struct browse_cache_record *find_browser_in_lmb_cache( const char *browser_name ); +void expire_lmb_browsers( time_t t ); + +/* The following definitions come from nmbd/nmbd_browsesync.c */ + +void dmb_expire_and_sync_browser_lists(time_t t); +void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec, + struct work_record *work); +void collect_all_workgroup_names_from_wins_server(time_t t); +void sync_all_dmbs(time_t t); + +/* The following definitions come from nmbd/nmbd_elections.c */ + +void check_master_browser_exists(time_t t); +void run_elections(time_t t); +void process_election(struct subnet_record *subrec, struct packet_struct *p, char *buf); +bool check_elections(void); +void nmbd_message_election(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); + +/* The following definitions come from nmbd/nmbd_incomingdgrams.c */ + +void tell_become_backup(void); +void process_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf); +void process_workgroup_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf); +void process_local_master_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf); +void process_master_browser_announce(struct subnet_record *subrec, + struct packet_struct *p,char *buf); +void process_lm_host_announce(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len); +void process_get_backup_list_request(struct subnet_record *subrec, + struct packet_struct *p,char *buf); +void process_reset_browser(struct subnet_record *subrec, + struct packet_struct *p,char *buf); +void process_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf); +void process_lm_announce_request(struct subnet_record *subrec, struct packet_struct *p, char *buf, int len); + +/* The following definitions come from nmbd/nmbd_incomingrequests.c */ + +void process_name_release_request(struct subnet_record *subrec, + struct packet_struct *p); +void process_name_refresh_request(struct subnet_record *subrec, + struct packet_struct *p); +void process_name_registration_request(struct subnet_record *subrec, + struct packet_struct *p); +void process_node_status_request(struct subnet_record *subrec, struct packet_struct *p); +void process_name_query_request(struct subnet_record *subrec, struct packet_struct *p); + +/* The following definitions come from nmbd/nmbd_lmhosts.c */ + +void load_lmhosts_file(const char *fname); +bool find_name_in_lmhosts(struct nmb_name *nmbname, struct name_record **namerecp); + +/* The following definitions come from nmbd/nmbd_logonnames.c */ + +void add_logon_names(void); + +/* The following definitions come from nmbd/nmbd_mynames.c */ + +void register_my_workgroup_one_subnet(struct subnet_record *subrec); +bool register_my_workgroup_and_names(void); +void release_wins_names(void); +void refresh_my_names(time_t t); + +/* The following definitions come from nmbd/nmbd_namelistdb.c */ + +void set_samba_nb_type(void); +void remove_name_from_namelist(struct subnet_record *subrec, + struct name_record *namerec ); +struct name_record *find_name_on_subnet(struct subnet_record *subrec, + const struct nmb_name *nmbname, + bool self_only); +struct name_record *find_name_for_remote_broadcast_subnet(struct nmb_name *nmbname, + bool self_only); +void update_name_ttl( struct name_record *namerec, int ttl ); +bool add_name_to_subnet( struct subnet_record *subrec, + const char *name, + int type, + uint16 nb_flags, + int ttl, + enum name_source source, + int num_ips, + struct in_addr *iplist); +void standard_success_register(struct subnet_record *subrec, + struct userdata_struct *userdata, + struct nmb_name *nmbname, uint16 nb_flags, int ttl, + struct in_addr registered_ip); +void standard_fail_register( struct subnet_record *subrec, + struct nmb_name *nmbname ); +bool find_ip_in_name_record( struct name_record *namerec, struct in_addr ip ); +void add_ip_to_name_record( struct name_record *namerec, struct in_addr new_ip ); +void remove_ip_from_name_record( struct name_record *namerec, + struct in_addr remove_ip ); +void standard_success_release( struct subnet_record *subrec, + struct userdata_struct *userdata, + struct nmb_name *nmbname, + struct in_addr released_ip ); +void expire_names(time_t t); +void add_samba_names_to_subnet( struct subnet_record *subrec ); +void dump_name_record( struct name_record *namerec, XFILE *fp); +void dump_all_namelists(void); + +/* The following definitions come from nmbd/nmbd_namequery.c */ + +bool query_name(struct subnet_record *subrec, const char *name, int type, + query_name_success_function success_fn, + query_name_fail_function fail_fn, + struct userdata_struct *userdata); +bool query_name_from_wins_server(struct in_addr ip_to, + const char *name, int type, + query_name_success_function success_fn, + query_name_fail_function fail_fn, + struct userdata_struct *userdata); + +/* The following definitions come from nmbd/nmbd_nameregister.c */ + +void register_name(struct subnet_record *subrec, + const char *name, int type, uint16 nb_flags, + register_name_success_function success_fn, + register_name_fail_function fail_fn, + struct userdata_struct *userdata); +void wins_refresh_name(struct name_record *namerec); + +/* The following definitions come from nmbd/nmbd_namerelease.c */ + +void release_name(struct subnet_record *subrec, struct name_record *namerec, + release_name_success_function success_fn, + release_name_fail_function fail_fn, + struct userdata_struct *userdata); + +/* The following definitions come from nmbd/nmbd_nodestatus.c */ + +bool node_status(struct subnet_record *subrec, struct nmb_name *nmbname, + struct in_addr send_ip, node_status_success_function success_fn, + node_status_fail_function fail_fn, struct userdata_struct *userdata); + +/* The following definitions come from nmbd/nmbd_packets.c */ + +uint16 get_nb_flags(char *buf); +void set_nb_flags(char *buf, uint16 nb_flags); +struct response_record *queue_register_name( struct subnet_record *subrec, + response_function resp_fn, + timeout_response_function timeout_fn, + register_name_success_function success_fn, + register_name_fail_function fail_fn, + struct userdata_struct *userdata, + struct nmb_name *nmbname, + uint16 nb_flags); +void queue_wins_refresh(struct nmb_name *nmbname, + response_function resp_fn, + timeout_response_function timeout_fn, + uint16 nb_flags, + struct in_addr refresh_ip, + const char *tag); +struct response_record *queue_register_multihomed_name( struct subnet_record *subrec, + response_function resp_fn, + timeout_response_function timeout_fn, + register_name_success_function success_fn, + register_name_fail_function fail_fn, + struct userdata_struct *userdata, + struct nmb_name *nmbname, + uint16 nb_flags, + struct in_addr register_ip, + struct in_addr wins_ip); +struct response_record *queue_release_name( struct subnet_record *subrec, + response_function resp_fn, + timeout_response_function timeout_fn, + release_name_success_function success_fn, + release_name_fail_function fail_fn, + struct userdata_struct *userdata, + struct nmb_name *nmbname, + uint16 nb_flags, + struct in_addr release_ip, + struct in_addr dest_ip); +struct response_record *queue_query_name( struct subnet_record *subrec, + response_function resp_fn, + timeout_response_function timeout_fn, + query_name_success_function success_fn, + query_name_fail_function fail_fn, + struct userdata_struct *userdata, + struct nmb_name *nmbname); +struct response_record *queue_query_name_from_wins_server( struct in_addr to_ip, + response_function resp_fn, + timeout_response_function timeout_fn, + query_name_success_function success_fn, + query_name_fail_function fail_fn, + struct userdata_struct *userdata, + struct nmb_name *nmbname); +struct response_record *queue_node_status( struct subnet_record *subrec, + response_function resp_fn, + timeout_response_function timeout_fn, + node_status_success_function success_fn, + node_status_fail_function fail_fn, + struct userdata_struct *userdata, + struct nmb_name *nmbname, + struct in_addr send_ip); +void reply_netbios_packet(struct packet_struct *orig_packet, + int rcode, enum netbios_reply_type_code rcv_code, int opcode, + int ttl, char *data,int len); +void queue_packet(struct packet_struct *packet); +void run_packet_queue(void); +void retransmit_or_expire_response_records(time_t t); +bool listen_for_packets(bool run_election); +bool send_mailslot(bool unique, const char *mailslot,char *buf, size_t len, + const char *srcname, int src_type, + const char *dstname, int dest_type, + struct in_addr dest_ip,struct in_addr src_ip, + int dest_port); + +/* The following definitions come from nmbd/nmbd_processlogon.c */ + +void process_logon_packet(struct packet_struct *p, char *buf,int len, + const char *mailslot); + +/* The following definitions come from nmbd/nmbd_responserecordsdb.c */ + +void remove_response_record(struct subnet_record *subrec, + struct response_record *rrec); +struct response_record *make_response_record( struct subnet_record *subrec, + struct packet_struct *p, + response_function resp_fn, + timeout_response_function timeout_fn, + success_function success_fn, + fail_function fail_fn, + struct userdata_struct *userdata); +struct response_record *find_response_record(struct subnet_record **ppsubrec, + uint16 id); +bool is_refresh_already_queued(struct subnet_record *subrec, struct name_record *namerec); + +/* The following definitions come from nmbd/nmbd_sendannounce.c */ + +void send_browser_reset(int reset_type, const char *to_name, int to_type, struct in_addr to_ip); +void broadcast_announce_request(struct subnet_record *subrec, struct work_record *work); +void announce_my_server_names(time_t t); +void announce_my_lm_server_names(time_t t); +void reset_announce_timer(void); +void announce_myself_to_domain_master_browser(time_t t); +void announce_my_servers_removed(void); +void announce_remote(time_t t); +void browse_sync_remote(time_t t); + +/* The following definitions come from nmbd/nmbd_serverlistdb.c */ + +void remove_all_servers(struct work_record *work); +struct server_record *find_server_in_workgroup(struct work_record *work, const char *name); +void remove_server_from_workgroup(struct work_record *work, struct server_record *servrec); +struct server_record *create_server_on_workgroup(struct work_record *work, + const char *name,int servertype, + int ttl, const char *comment); +void update_server_ttl(struct server_record *servrec, int ttl); +void expire_servers(struct work_record *work, time_t t); +void write_browse_list_entry(XFILE *fp, const char *name, uint32 rec_type, + const char *local_master_browser_name, const char *description); +void write_browse_list(time_t t, bool force_write); + +/* The following definitions come from nmbd/nmbd_subnetdb.c */ + +void close_subnet(struct subnet_record *subrec); +struct subnet_record *make_normal_subnet(const struct interface *iface); +bool create_subnets(void); +bool we_are_a_wins_client(void); +struct subnet_record *get_next_subnet_maybe_unicast(struct subnet_record *subrec); +struct subnet_record *get_next_subnet_maybe_unicast_or_wins_server(struct subnet_record *subrec); + +/* The following definitions come from nmbd/nmbd_synclists.c */ + +void sync_browse_lists(struct work_record *work, + char *name, int nm_type, + struct in_addr ip, bool local, bool servers); +void sync_check_completion(void); + +/* The following definitions come from nmbd/nmbd_winsproxy.c */ + +void make_wins_proxy_name_query_request( struct subnet_record *subrec, + struct packet_struct *incoming_packet, + struct nmb_name *question_name); + +/* The following definitions come from nmbd/nmbd_winsserver.c */ + +struct name_record *find_name_on_wins_subnet(const struct nmb_name *nmbname, bool self_only); +bool wins_store_changed_namerec(const struct name_record *namerec); +bool add_name_to_wins_subnet(const struct name_record *namerec); +bool remove_name_from_wins_namelist(struct name_record *namerec); +void dump_wins_subnet_namelist(XFILE *fp); +bool packet_is_for_wins_server(struct packet_struct *packet); +bool initialise_wins(void); +void wins_process_name_refresh_request( struct subnet_record *subrec, + struct packet_struct *p ); +void wins_process_name_registration_request(struct subnet_record *subrec, + struct packet_struct *p); +void wins_process_multihomed_name_registration_request( struct subnet_record *subrec, + struct packet_struct *p); +void fetch_all_active_wins_1b_names(void); +void send_wins_name_query_response(int rcode, struct packet_struct *p, + struct name_record *namerec); +void wins_process_name_query_request(struct subnet_record *subrec, + struct packet_struct *p); +void wins_process_name_release_request(struct subnet_record *subrec, + struct packet_struct *p); +void initiate_wins_processing(time_t t); +void wins_write_name_record(struct name_record *namerec, XFILE *fp); +void wins_write_database(time_t t, bool background); +void nmbd_wins_new_entry(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); + +/* The following definitions come from nmbd/nmbd_workgroupdb.c */ + +struct work_record *find_workgroup_on_subnet(struct subnet_record *subrec, + const char *name); +struct work_record *create_workgroup_on_subnet(struct subnet_record *subrec, + const char *name, int ttl); +void update_workgroup_ttl(struct work_record *work, int ttl); +void initiate_myworkgroup_startup(struct subnet_record *subrec, struct work_record *work); +void dump_workgroups(bool force_write); +void expire_workgroups_and_servers(time_t t); + +/* The following definitions come from param/loadparm.c */ + +char *lp_smb_ports(void); +char *lp_dos_charset(void); +char *lp_unix_charset(void); +char *lp_display_charset(void); +char *lp_logfile(void); +char *lp_configfile(void); +char *lp_smb_passwd_file(void); +char *lp_private_dir(void); +char *lp_serverstring(void); +int lp_printcap_cache_time(void); +char *lp_addport_cmd(void); +char *lp_enumports_cmd(void); +char *lp_addprinter_cmd(void); +char *lp_deleteprinter_cmd(void); +char *lp_os2_driver_map(void); +char *lp_lockdir(void); +char *lp_piddir(void); +char *lp_mangling_method(void); +int lp_mangle_prefix(void); +char *lp_utmpdir(void); +char *lp_wtmpdir(void); +bool lp_utmp(void); +char *lp_rootdir(void); +char *lp_defaultservice(void); +char *lp_msg_command(void); +char *lp_get_quota_command(void); +char *lp_set_quota_command(void); +char *lp_auto_services(void); +char *lp_passwd_program(void); +char *lp_passwd_chat(void); +char *lp_passwordserver(void); +char *lp_name_resolve_order(void); +char *lp_realm(void); +const char *lp_afs_username_map(void); +int lp_afs_token_lifetime(void); +char *lp_log_nt_token_command(void); +char *lp_username_map(void); +const char *lp_logon_script(void); +const char *lp_logon_path(void); +const char *lp_logon_drive(void); +const char *lp_logon_home(void); +char *lp_remote_announce(void); +char *lp_remote_browse_sync(void); +const char **lp_wins_server_list(void); +const char **lp_interfaces(void); +char *lp_socket_address(void); +char *lp_nis_home_map_name(void); +const char **lp_netbios_aliases(void); +const char *lp_passdb_backend(void); +const char **lp_preload_modules(void); +char *lp_panic_action(void); +char *lp_adduser_script(void); +char *lp_renameuser_script(void); +char *lp_deluser_script(void); +const char *lp_guestaccount(void); +char *lp_addgroup_script(void); +char *lp_delgroup_script(void); +char *lp_addusertogroup_script(void); +char *lp_deluserfromgroup_script(void); +char *lp_setprimarygroup_script(void); +char *lp_addmachine_script(void); +char *lp_shutdown_script(void); +char *lp_abort_shutdown_script(void); +char *lp_username_map_script(void); +char *lp_check_password_script(void); +char *lp_wins_hook(void); +const char *lp_template_homedir(void); +const char *lp_template_shell(void); +const char *lp_winbind_separator(void); +int lp_acl_compatibility(void); +bool lp_winbind_enum_users(void); +bool lp_winbind_enum_groups(void); +bool lp_winbind_use_default_domain(void); +bool lp_winbind_trusted_domains_only(void); +bool lp_winbind_nested_groups(void); +int lp_winbind_expand_groups(void); +bool lp_winbind_refresh_tickets(void); +bool lp_winbind_offline_logon(void); +bool lp_winbind_normalize_names(void); +bool lp_winbind_rpc_only(void); +const char **lp_idmap_domains(void); +const char *lp_idmap_backend(void); +char *lp_idmap_alloc_backend(void); +int lp_idmap_cache_time(void); +int lp_idmap_negative_cache_time(void); +int lp_keepalive(void); +bool lp_passdb_expand_explicit(void); +char *lp_ldap_suffix(void); +char *lp_ldap_admin_dn(void); +int lp_ldap_ssl(void); +int lp_ldap_passwd_sync(void); +bool lp_ldap_delete_dn(void); +int lp_ldap_replication_sleep(void); +int lp_ldap_timeout(void); +int lp_ldap_connection_timeout(void); +int lp_ldap_page_size(void); +int lp_ldap_debug_level(void); +int lp_ldap_debug_threshold(void); +char *lp_add_share_cmd(void); +char *lp_change_share_cmd(void); +char *lp_delete_share_cmd(void); +char *lp_usershare_path(void); +const char **lp_usershare_prefix_allow_list(void); +const char **lp_usershare_prefix_deny_list(void); +const char **lp_eventlog_list(void); +bool lp_registry_shares(void); +bool lp_usershare_allow_guests(void); +bool lp_usershare_owner_only(void); +bool lp_disable_netbios(void); +bool lp_reset_on_zero_vc(void); +bool lp_ms_add_printer_wizard(void); +bool lp_dns_proxy(void); +bool lp_wins_support(void); +bool lp_we_are_a_wins_server(void); +bool lp_wins_proxy(void); +bool lp_local_master(void); +bool lp_domain_logons(void); +const char **lp_init_logon_delayed_hosts(void); +int lp_init_logon_delay(void); +bool lp_load_printers(void); +bool lp_readraw(void); +bool lp_large_readwrite(void); +bool lp_writeraw(void); +bool lp_null_passwords(void); +bool lp_obey_pam_restrictions(void); +bool lp_encrypted_passwords(void); +bool lp_update_encrypted(void); +int lp_client_schannel(void); +int lp_server_schannel(void); +bool lp_syslog_only(void); +bool lp_timestamp_logs(void); +bool lp_debug_prefix_timestamp(void); +bool lp_debug_hires_timestamp(void); +bool lp_debug_pid(void); +bool lp_debug_uid(void); +bool lp_debug_class(void); +bool lp_enable_core_files(void); +bool lp_browse_list(void); +bool lp_nis_home_map(void); +bool lp_bind_interfaces_only(void); +bool lp_pam_password_change(void); +bool lp_unix_password_sync(void); +bool lp_passwd_chat_debug(void); +int lp_passwd_chat_timeout(void); +bool lp_nt_pipe_support(void); +bool lp_nt_status_support(void); +bool lp_stat_cache(void); +int lp_max_stat_cache_size(void); +bool lp_allow_trusted_domains(void); +int lp_restrict_anonymous(void); +bool lp_lanman_auth(void); +bool lp_ntlm_auth(void); +bool lp_client_plaintext_auth(void); +bool lp_client_lanman_auth(void); +bool lp_client_ntlmv2_auth(void); +bool lp_host_msdfs(void); +bool lp_kernel_oplocks(void); +bool lp_enhanced_browsing(void); +bool lp_use_mmap(void); +bool lp_unix_extensions(void); +bool lp_use_spnego(void); +bool lp_client_use_spnego(void); +bool lp_hostname_lookups(void); +bool lp_change_notify(const struct share_params *p ); +bool lp_kernel_change_notify(const struct share_params *p ); +bool lp_use_kerberos_keytab(void); +bool lp_defer_sharing_violations(void); +bool lp_enable_privileges(void); +bool lp_enable_asu_support(void); +int lp_os_level(void); +int lp_max_ttl(void); +int lp_max_wins_ttl(void); +int lp_min_wins_ttl(void); +int lp_max_log_size(void); +int lp_max_open_files(void); +int lp_open_files_db_hash_size(void); +int lp_maxxmit(void); +int lp_maxmux(void); +int lp_passwordlevel(void); +int lp_usernamelevel(void); +int lp_deadtime(void); +bool lp_getwd_cache(void); +int lp_maxprotocol(void); +int lp_minprotocol(void); +int lp_security(void); +const char **lp_auth_methods(void); +bool lp_paranoid_server_security(void); +int lp_maxdisksize(void); +int lp_lpqcachetime(void); +int lp_max_smbd_processes(void); +bool _lp_disable_spoolss(void); +int lp_syslog(void); +int lp_lm_announce(void); +int lp_lm_interval(void); +int lp_machine_password_timeout(void); +int lp_map_to_guest(void); +int lp_oplock_break_wait_time(void); +int lp_lock_spin_time(void); +int lp_usershare_max_shares(void); +const char *lp_socket_options(void); +int lp_config_backend(void); +char *lp_preexec(int ); +char *lp_postexec(int ); +char *lp_rootpreexec(int ); +char *lp_rootpostexec(int ); +char *lp_servicename(int ); +const char *lp_const_servicename(int ); +char *lp_pathname(int ); +char *lp_dontdescend(int ); +char *lp_username(int ); +const char **lp_invalid_users(int ); +const char **lp_valid_users(int ); +const char **lp_admin_users(int ); +const char **lp_svcctl_list(void); +char *lp_cups_options(int ); +char *lp_cups_server(void); +char *lp_iprint_server(void); +const char *lp_ctdbd_socket(void); +const char **lp_cluster_addresses(void); +bool lp_clustering(void); +char *lp_printcommand(int ); +char *lp_lpqcommand(int ); +char *lp_lprmcommand(int ); +char *lp_lppausecommand(int ); +char *lp_lpresumecommand(int ); +char *lp_queuepausecommand(int ); +char *lp_queueresumecommand(int ); +const char *lp_printjob_username(int ); +const char **lp_hostsallow(int ); +const char **lp_hostsdeny(int ); +char *lp_magicscript(int ); +char *lp_magicoutput(int ); +char *lp_comment(int ); +char *lp_force_user(int ); +char *lp_force_group(int ); +const char **lp_readlist(int ); +const char **lp_writelist(int ); +const char **lp_printer_admin(int ); +char *lp_fstype(int ); +const char **lp_vfs_objects(int ); +char *lp_msdfs_proxy(int ); +char *lp_veto_files(int ); +char *lp_hide_files(int ); +char *lp_veto_oplocks(int ); +bool lp_msdfs_root(int ); +char *lp_aio_write_behind(int ); +char *lp_dfree_command(int ); +bool lp_autoloaded(int ); +bool lp_preexec_close(int ); +bool lp_rootpreexec_close(int ); +int lp_casesensitive(int ); +bool lp_preservecase(int ); +bool lp_shortpreservecase(int ); +bool lp_hide_dot_files(int ); +bool lp_hide_special_files(int ); +bool lp_hideunreadable(int ); +bool lp_hideunwriteable_files(int ); +bool lp_browseable(int ); +bool lp_readonly(int ); +bool lp_no_set_dir(int ); +bool lp_guest_ok(int ); +bool lp_guest_only(int ); +bool lp_administrative_share(int ); +bool lp_print_ok(int ); +bool lp_map_hidden(int ); +bool lp_map_archive(int ); +bool lp_store_dos_attributes(int ); +bool lp_dmapi_support(int ); +bool lp_locking(const struct share_params *p ); +int lp_strict_locking(const struct share_params *p ); +bool lp_posix_locking(const struct share_params *p ); +bool lp_share_modes(int ); +bool lp_oplocks(int ); +bool lp_level2_oplocks(int ); +bool lp_onlyuser(int ); +bool lp_manglednames(const struct share_params *p ); +bool lp_widelinks(int ); +bool lp_symlinks(int ); +bool lp_syncalways(int ); +bool lp_strict_allocate(int ); +bool lp_strict_sync(int ); +bool lp_map_system(int ); +bool lp_delete_readonly(int ); +bool lp_fake_oplocks(int ); +bool lp_recursive_veto_delete(int ); +bool lp_dos_filemode(int ); +bool lp_dos_filetimes(int ); +bool lp_dos_filetime_resolution(int ); +bool lp_fake_dir_create_times(int ); +bool lp_blocking_locks(int ); +bool lp_inherit_perms(int ); +bool lp_inherit_acls(int ); +bool lp_inherit_owner(int ); +bool lp_use_client_driver(int ); +bool lp_default_devmode(int ); +bool lp_force_printername(int ); +bool lp_nt_acl_support(int ); +bool lp_force_unknown_acl_user(int ); +bool lp_ea_support(int ); +bool _lp_use_sendfile(int ); +bool lp_profile_acls(int ); +bool lp_map_acl_inherit(int ); +bool lp_afs_share(int ); +bool lp_acl_check_permissions(int ); +bool lp_acl_group_control(int ); +bool lp_acl_map_full_control(int ); +int lp_create_mask(int ); +int lp_force_create_mode(int ); +int lp_security_mask(int ); +int lp_force_security_mode(int ); +int lp_dir_mask(int ); +int lp_force_dir_mode(int ); +int lp_dir_security_mask(int ); +int lp_force_dir_security_mode(int ); +int lp_max_connections(int ); +int lp_defaultcase(int ); +int lp_minprintspace(int ); +int lp_printing(int ); +int lp_max_reported_jobs(int ); +int lp_oplock_contention_limit(int ); +int lp_csc_policy(int ); +int lp_write_cache_size(int ); +int lp_block_size(int ); +int lp_dfree_cache_time(int ); +int lp_allocation_roundup_size(int ); +int lp_aio_read_size(int ); +int lp_aio_write_size(int ); +int lp_map_readonly(int ); +int lp_directory_name_cache_size(int ); +int lp_smb_encrypt(int ); +char lp_magicchar(const struct share_params *p ); +int lp_winbind_cache_time(void); +int lp_winbind_reconnect_delay(void); +const char **lp_winbind_nss_info(void); +int lp_algorithmic_rid_base(void); +int lp_name_cache_timeout(void); +int lp_client_signing(void); +int lp_server_signing(void); +int lp_client_ldap_sasl_wrapping(void); +char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def); +const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def); +const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def); +int lp_parm_int(int snum, const char *type, const char *option, int def); +unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def); +bool lp_parm_bool(int snum, const char *type, const char *option, bool def); +int lp_parm_enum(int snum, const char *type, const char *option, + const struct enum_list *_enum, int def); +bool lp_add_home(const char *pszHomename, int iDefaultService, + const char *user, const char *pszHomedir); +int lp_add_service(const char *pszService, int iDefaultService); +bool lp_add_printer(const char *pszPrintername, int iDefaultService); +bool lp_parameter_is_valid(const char *pszParmName); +bool lp_parameter_is_global(const char *pszParmName); +bool lp_parameter_is_canonical(const char *parm_name); +bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm, + bool *inverse); +bool lp_canonicalize_parameter_with_value(const char *parm_name, + const char *val, + const char **canon_parm, + const char **canon_val); +void show_parameter_list(void); +bool lp_string_is_valid_boolean(const char *parm_value); +bool lp_invert_boolean(const char *str, const char **inverse_str); +bool lp_canonicalize_boolean(const char *str, const char**canon_str); +bool service_ok(int iService); +bool lp_config_backend_is_registry(void); +bool lp_config_backend_is_file(void); +bool lp_file_list_changed(void); +bool lp_idmap_uid(uid_t *low, uid_t *high); +bool lp_idmap_gid(gid_t *low, gid_t *high); +const char *lp_ldap_machine_suffix(void); +const char *lp_ldap_user_suffix(void); +const char *lp_ldap_group_suffix(void); +const char *lp_ldap_idmap_suffix(void); +void *lp_local_ptr(int snum, void *ptr); +bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue); +void init_locals(void); +bool lp_is_default(int snum, struct parm_struct *parm); +bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal); +struct parm_struct *lp_get_parameter(const char *param_name); +struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters); +bool lp_snum_ok(int iService); +void lp_add_one_printer(char *name, char *comment); +bool lp_loaded(void); +void lp_killunused(bool (*snumused) (int)); +void lp_kill_all_services(void); +void lp_killservice(int iServiceIn); +const char* server_role_str(uint32 role); +enum usershare_err parse_usershare_file(TALLOC_CTX *ctx, + SMB_STRUCT_STAT *psbuf, + const char *servicename, + int snum, + char **lines, + int numlines, + char **pp_sharepath, + char **pp_comment, + SEC_DESC **ppsd, + bool *pallow_guest); +int load_usershare_service(const char *servicename); +int load_usershare_shares(void); +void gfree_loadparm(void); +void lp_set_in_client(bool b); +bool lp_is_in_client(void); +bool lp_load_ex(const char *pszFname, + bool global_only, + bool save_defaults, + bool add_ipc, + bool initialize_globals, + bool allow_include_registry, + bool allow_registry_shares); +bool lp_load(const char *pszFname, + bool global_only, + bool save_defaults, + bool add_ipc, + bool initialize_globals); +bool lp_load_initial_only(const char *pszFname); +bool lp_load_with_registry_shares(const char *pszFname, + bool global_only, + bool save_defaults, + bool add_ipc, + bool initialize_globals); +int lp_numservices(void); +void lp_dump(FILE *f, bool show_defaults, int maxtoprint); +void lp_dump_one(FILE * f, bool show_defaults, int snum); +int lp_servicenumber(const char *pszServiceName); +bool share_defined(const char *service_name); +struct share_params *get_share_params(TALLOC_CTX *mem_ctx, + const char *sharename); +struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx); +struct share_params *next_share(struct share_iterator *list); +struct share_params *next_printer(struct share_iterator *list); +struct share_params *snum2params_static(int snum); +const char *volume_label(int snum); +int lp_server_role(void); +bool lp_domain_master(void); +bool lp_preferred_master(void); +void lp_remove_service(int snum); +void lp_copy_service(int snum, const char *new_name); +int lp_default_server_announce(void); +int lp_major_announce_version(void); +int lp_minor_announce_version(void); +void lp_set_name_resolve_order(const char *new_order); +const char *lp_printername(int snum); +void lp_set_logfile(const char *name); +int lp_maxprintjobs(int snum); +const char *lp_printcapname(void); +bool lp_disable_spoolss( void ); +void lp_set_spoolss_state( uint32 state ); +uint32 lp_get_spoolss_state( void ); +bool lp_use_sendfile(int snum); +void set_use_sendfile(int snum, bool val); +void set_store_dos_attributes(int snum, bool val); +void lp_set_mangling_method(const char *new_method); +bool lp_posix_pathnames(void); +void lp_set_posix_pathnames(void); +enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp); +void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val); +int lp_min_receive_file_size(void); + +/* The following definitions come from param/params.c */ + +bool pm_process( const char *FileName, + bool (*sfunc)(const char *, void *), + bool (*pfunc)(const char *, const char *, void *), + void *userdata); + +/* The following definitions come from param/util.c */ + +uint32 get_int_param( const char* param ); +char* get_string_param( const char* param ); + +/* The following definitions come from passdb/login_cache.c */ + +bool login_cache_init(void); +bool login_cache_shutdown(void); +LOGIN_CACHE * login_cache_read(struct samu *sampass); +bool login_cache_write(const struct samu *sampass, LOGIN_CACHE entry); +bool login_cache_delentry(const struct samu *sampass); + +/* The following definitions come from passdb/lookup_sid.c */ + +bool lookup_name(TALLOC_CTX *mem_ctx, + const char *full_name, int flags, + const char **ret_domain, const char **ret_name, + DOM_SID *ret_sid, enum lsa_SidType *ret_type); +bool lookup_name_smbconf(TALLOC_CTX *mem_ctx, + const char *full_name, int flags, + const char **ret_domain, const char **ret_name, + DOM_SID *ret_sid, enum lsa_SidType *ret_type); +NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids, + const DOM_SID **sids, int level, + struct lsa_dom_info **ret_domains, + struct lsa_name_info **ret_names); +bool lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + const char **ret_domain, const char **ret_name, + enum lsa_SidType *ret_type); +void store_uid_sid_cache(const DOM_SID *psid, uid_t uid); +void store_gid_sid_cache(const DOM_SID *psid, gid_t gid); +void uid_to_sid(DOM_SID *psid, uid_t uid); +void gid_to_sid(DOM_SID *psid, gid_t gid); +bool sid_to_uid(const DOM_SID *psid, uid_t *puid); +bool sid_to_gid(const DOM_SID *psid, gid_t *pgid); + +/* The following definitions come from passdb/machine_sid.c */ + +DOM_SID *get_global_sam_sid(void); +void reset_global_sam_sid(void) ; +bool sid_check_is_domain(const DOM_SID *sid); +bool sid_check_is_in_our_domain(const DOM_SID *sid); + +/* The following definitions come from passdb/passdb.c */ + +const char *my_sam_name(void); +struct samu *samu_new( TALLOC_CTX *ctx ); +NTSTATUS samu_set_unix(struct samu *user, const struct passwd *pwd); +NTSTATUS samu_alloc_rid_unix(struct samu *user, const struct passwd *pwd); +char *pdb_encode_acct_ctrl(uint32 acct_ctrl, size_t length); +uint32 pdb_decode_acct_ctrl(const char *p); +void pdb_sethexpwd(char p[33], const unsigned char *pwd, uint32 acct_ctrl); +bool pdb_gethexpwd(const char *p, unsigned char *pwd); +void pdb_sethexhours(char *p, const unsigned char *hours); +bool pdb_gethexhours(const char *p, unsigned char *hours); +int algorithmic_rid_base(void); +uid_t algorithmic_pdb_user_rid_to_uid(uint32 user_rid); +uid_t max_algorithmic_uid(void); +uint32 algorithmic_pdb_uid_to_user_rid(uid_t uid); +gid_t pdb_group_rid_to_gid(uint32 group_rid); +gid_t max_algorithmic_gid(void); +uint32 algorithmic_pdb_gid_to_group_rid(gid_t gid); +bool algorithmic_pdb_rid_is_user(uint32 rid); +bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid, + enum lsa_SidType *type); +NTSTATUS local_password_change(const char *user_name, + int local_flags, + const char *new_passwd, + char **pp_err_str, + char **pp_msg_str); +bool init_sam_from_buffer_v3(struct samu *sampass, uint8 *buf, uint32 buflen); +uint32 init_buffer_from_sam_v3 (uint8 **buf, struct samu *sampass, bool size_only); +bool pdb_copy_sam_account(struct samu *dst, struct samu *src ); +bool pdb_update_bad_password_count(struct samu *sampass, bool *updated); +bool pdb_update_autolock_flag(struct samu *sampass, bool *updated); +bool pdb_increment_bad_password_count(struct samu *sampass); +bool is_dc_trusted_domain_situation(const char *domain_name); +bool get_trust_pw_clear(const char *domain, char **ret_pwd, + const char **account_name, uint32 *channel); +bool get_trust_pw_hash(const char *domain, uint8 ret_pwd[16], + const char **account_name, uint32 *channel); +struct samr_LogonHours get_logon_hours_from_pdb(TALLOC_CTX *mem_ctx, + struct samu *pw); + +/* The following definitions come from passdb/pdb_compat.c */ + +uint32 pdb_get_user_rid (const struct samu *sampass); +uint32 pdb_get_group_rid (struct samu *sampass); +bool pdb_set_user_sid_from_rid (struct samu *sampass, uint32 rid, enum pdb_value_state flag); +bool pdb_set_group_sid_from_rid (struct samu *sampass, uint32 grid, enum pdb_value_state flag); + +/* The following definitions come from passdb/pdb_get_set.c */ + +uint32 pdb_get_acct_ctrl(const struct samu *sampass); +time_t pdb_get_logon_time(const struct samu *sampass); +time_t pdb_get_logoff_time(const struct samu *sampass); +time_t pdb_get_kickoff_time(const struct samu *sampass); +time_t pdb_get_bad_password_time(const struct samu *sampass); +time_t pdb_get_pass_last_set_time(const struct samu *sampass); +time_t pdb_get_pass_can_change_time(const struct samu *sampass); +time_t pdb_get_pass_can_change_time_noncalc(const struct samu *sampass); +time_t pdb_get_pass_must_change_time(const struct samu *sampass); +bool pdb_get_pass_can_change(const struct samu *sampass); +uint16 pdb_get_logon_divs(const struct samu *sampass); +uint32 pdb_get_hours_len(const struct samu *sampass); +const uint8 *pdb_get_hours(const struct samu *sampass); +const uint8 *pdb_get_nt_passwd(const struct samu *sampass); +const uint8 *pdb_get_lanman_passwd(const struct samu *sampass); +const uint8 *pdb_get_pw_history(const struct samu *sampass, uint32 *current_hist_len); +const char *pdb_get_plaintext_passwd(const struct samu *sampass); +const DOM_SID *pdb_get_user_sid(const struct samu *sampass); +const DOM_SID *pdb_get_group_sid(struct samu *sampass); +enum pdb_value_state pdb_get_init_flags(const struct samu *sampass, enum pdb_elements element); +const char *pdb_get_username(const struct samu *sampass); +const char *pdb_get_domain(const struct samu *sampass); +const char *pdb_get_nt_username(const struct samu *sampass); +const char *pdb_get_fullname(const struct samu *sampass); +const char *pdb_get_homedir(const struct samu *sampass); +const char *pdb_get_dir_drive(const struct samu *sampass); +const char *pdb_get_logon_script(const struct samu *sampass); +const char *pdb_get_profile_path(const struct samu *sampass); +const char *pdb_get_acct_desc(const struct samu *sampass); +const char *pdb_get_workstations(const struct samu *sampass); +const char *pdb_get_comment(const struct samu *sampass); +const char *pdb_get_munged_dial(const struct samu *sampass); +uint16 pdb_get_bad_password_count(const struct samu *sampass); +uint16 pdb_get_logon_count(const struct samu *sampass); +uint32 pdb_get_unknown_6(const struct samu *sampass); +void *pdb_get_backend_private_data(const struct samu *sampass, const struct pdb_methods *my_methods); +bool pdb_set_acct_ctrl(struct samu *sampass, uint32 acct_ctrl, enum pdb_value_state flag); +bool pdb_set_logon_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag); +bool pdb_set_logoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag); +bool pdb_set_kickoff_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag); +bool pdb_set_bad_password_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag); +bool pdb_set_pass_can_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag); +bool pdb_set_pass_must_change_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag); +bool pdb_set_pass_last_set_time(struct samu *sampass, time_t mytime, enum pdb_value_state flag); +bool pdb_set_hours_len(struct samu *sampass, uint32 len, enum pdb_value_state flag); +bool pdb_set_logon_divs(struct samu *sampass, uint16 hours, enum pdb_value_state flag); +bool pdb_set_init_flags(struct samu *sampass, enum pdb_elements element, enum pdb_value_state value_flag); +bool pdb_set_user_sid(struct samu *sampass, const DOM_SID *u_sid, enum pdb_value_state flag); +bool pdb_set_user_sid_from_string(struct samu *sampass, fstring u_sid, enum pdb_value_state flag); +bool pdb_set_group_sid(struct samu *sampass, const DOM_SID *g_sid, enum pdb_value_state flag); +bool pdb_set_username(struct samu *sampass, const char *username, enum pdb_value_state flag); +bool pdb_set_domain(struct samu *sampass, const char *domain, enum pdb_value_state flag); +bool pdb_set_nt_username(struct samu *sampass, const char *nt_username, enum pdb_value_state flag); +bool pdb_set_fullname(struct samu *sampass, const char *full_name, enum pdb_value_state flag); +bool pdb_set_logon_script(struct samu *sampass, const char *logon_script, enum pdb_value_state flag); +bool pdb_set_profile_path(struct samu *sampass, const char *profile_path, enum pdb_value_state flag); +bool pdb_set_dir_drive(struct samu *sampass, const char *dir_drive, enum pdb_value_state flag); +bool pdb_set_homedir(struct samu *sampass, const char *home_dir, enum pdb_value_state flag); +bool pdb_set_acct_desc(struct samu *sampass, const char *acct_desc, enum pdb_value_state flag); +bool pdb_set_workstations(struct samu *sampass, const char *workstations, enum pdb_value_state flag); +bool pdb_set_comment(struct samu *sampass, const char *comment, enum pdb_value_state flag); +bool pdb_set_munged_dial(struct samu *sampass, const char *munged_dial, enum pdb_value_state flag); +bool pdb_set_nt_passwd(struct samu *sampass, const uint8 pwd[NT_HASH_LEN], enum pdb_value_state flag); +bool pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], enum pdb_value_state flag); +bool pdb_set_pw_history(struct samu *sampass, const uint8 *pwd, uint32 historyLen, enum pdb_value_state flag); +bool pdb_set_plaintext_pw_only(struct samu *sampass, const char *password, enum pdb_value_state flag); +bool pdb_set_bad_password_count(struct samu *sampass, uint16 bad_password_count, enum pdb_value_state flag); +bool pdb_set_logon_count(struct samu *sampass, uint16 logon_count, enum pdb_value_state flag); +bool pdb_set_unknown_6(struct samu *sampass, uint32 unkn, enum pdb_value_state flag); +bool pdb_set_hours(struct samu *sampass, const uint8 *hours, enum pdb_value_state flag); +bool pdb_set_backend_private_data(struct samu *sampass, void *private_data, + void (*free_fn)(void **), + const struct pdb_methods *my_methods, + enum pdb_value_state flag); +bool pdb_set_pass_can_change(struct samu *sampass, bool canchange); +bool pdb_set_plaintext_passwd(struct samu *sampass, const char *plaintext); +uint32 pdb_build_fields_present(struct samu *sampass); + +/* The following definitions come from passdb/pdb_interface.c */ + +NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function init) ; +struct pdb_init_function_entry *pdb_find_backend_entry(const char *name); +struct event_context *pdb_get_event_context(void); +NTSTATUS make_pdb_method_name(struct pdb_methods **methods, const char *selected); +bool pdb_getsampwnam(struct samu *sam_acct, const char *username) ; +bool guest_user_info( struct samu *user ); +bool pdb_getsampwsid(struct samu *sam_acct, const DOM_SID *sid) ; +NTSTATUS pdb_create_user(TALLOC_CTX *mem_ctx, const char *name, uint32 flags, + uint32 *rid); +NTSTATUS pdb_delete_user(TALLOC_CTX *mem_ctx, struct samu *sam_acct); +NTSTATUS pdb_add_sam_account(struct samu *sam_acct) ; +NTSTATUS pdb_update_sam_account(struct samu *sam_acct) ; +NTSTATUS pdb_delete_sam_account(struct samu *sam_acct) ; +NTSTATUS pdb_rename_sam_account(struct samu *oldname, const char *newname); +NTSTATUS pdb_update_login_attempts(struct samu *sam_acct, bool success); +bool pdb_getgrsid(GROUP_MAP *map, DOM_SID sid); +bool pdb_getgrgid(GROUP_MAP *map, gid_t gid); +bool pdb_getgrnam(GROUP_MAP *map, const char *name); +NTSTATUS pdb_create_dom_group(TALLOC_CTX *mem_ctx, const char *name, + uint32 *rid); +NTSTATUS pdb_delete_dom_group(TALLOC_CTX *mem_ctx, uint32 rid); +NTSTATUS pdb_add_group_mapping_entry(GROUP_MAP *map); +NTSTATUS pdb_update_group_mapping_entry(GROUP_MAP *map); +NTSTATUS pdb_delete_group_mapping_entry(DOM_SID sid); +bool pdb_enum_group_mapping(const DOM_SID *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, + size_t *p_num_entries, bool unix_only); +NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx, + const DOM_SID *sid, + uint32 **pp_member_rids, + size_t *p_num_members); +NTSTATUS pdb_enum_group_memberships(TALLOC_CTX *mem_ctx, struct samu *user, + DOM_SID **pp_sids, gid_t **pp_gids, + size_t *p_num_groups); +NTSTATUS pdb_set_unix_primary_group(TALLOC_CTX *mem_ctx, struct samu *user); +NTSTATUS pdb_add_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid, + uint32 member_rid); +NTSTATUS pdb_del_groupmem(TALLOC_CTX *mem_ctx, uint32 group_rid, + uint32 member_rid); +NTSTATUS pdb_create_alias(const char *name, uint32 *rid); +NTSTATUS pdb_delete_alias(const DOM_SID *sid); +NTSTATUS pdb_get_aliasinfo(const DOM_SID *sid, struct acct_info *info); +NTSTATUS pdb_set_aliasinfo(const DOM_SID *sid, struct acct_info *info); +NTSTATUS pdb_add_aliasmem(const DOM_SID *alias, const DOM_SID *member); +NTSTATUS pdb_del_aliasmem(const DOM_SID *alias, const DOM_SID *member); +NTSTATUS pdb_enum_aliasmem(const DOM_SID *alias, + DOM_SID **pp_members, size_t *p_num_members); +NTSTATUS pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx, + const DOM_SID *domain_sid, + const DOM_SID *members, size_t num_members, + uint32 **pp_alias_rids, + size_t *p_num_alias_rids); +NTSTATUS pdb_lookup_rids(const DOM_SID *domain_sid, + int num_rids, + uint32 *rids, + const char **names, + enum lsa_SidType *attrs); +NTSTATUS pdb_lookup_names(const DOM_SID *domain_sid, + int num_names, + const char **names, + uint32 *rids, + enum lsa_SidType *attrs); +bool pdb_get_account_policy(int policy_index, uint32 *value); +bool pdb_set_account_policy(int policy_index, uint32 value); +bool pdb_get_seq_num(time_t *seq_num); +bool pdb_uid_to_rid(uid_t uid, uint32 *rid); +bool pdb_uid_to_sid(uid_t uid, DOM_SID *sid); +bool pdb_gid_to_sid(gid_t gid, DOM_SID *sid); +bool pdb_sid_to_id(const DOM_SID *sid, union unid_t *id, + enum lsa_SidType *type); +bool pdb_rid_algorithm(void); +bool pdb_new_rid(uint32 *rid); +bool initialize_password_db(bool reload, struct event_context *event_ctx); +struct pdb_search *pdb_search_init(enum pdb_search_type type); +struct pdb_search *pdb_search_users(uint32 acct_flags); +struct pdb_search *pdb_search_groups(void); +struct pdb_search *pdb_search_aliases(const DOM_SID *sid); +uint32 pdb_search_entries(struct pdb_search *search, + uint32 start_idx, uint32 max_entries, + struct samr_displayentry **result); +void pdb_search_destroy(struct pdb_search *search); +bool pdb_get_trusteddom_pw(const char *domain, char** pwd, DOM_SID *sid, + time_t *pass_last_set_time); +bool pdb_set_trusteddom_pw(const char* domain, const char* pwd, + const DOM_SID *sid); +bool pdb_del_trusteddom_pw(const char *domain); +NTSTATUS pdb_enum_trusteddoms(TALLOC_CTX *mem_ctx, uint32 *num_domains, + struct trustdom_info ***domains); +NTSTATUS make_pdb_method( struct pdb_methods **methods ) ; + +/* The following definitions come from passdb/pdb_ldap.c */ + +const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver ); +int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state, + const char *user, + LDAPMessage ** result, + const char **attr); +const char **talloc_attrs(TALLOC_CTX *mem_ctx, ...); +NTSTATUS pdb_init_ldapsam_compat(struct pdb_methods **pdb_method, const char *location); +NTSTATUS pdb_init_ldapsam(struct pdb_methods **pdb_method, const char *location); +NTSTATUS pdb_ldap_init(void); + +/* The following definitions come from passdb/pdb_nds.c */ + +int pdb_nds_get_password( + struct smbldap_state *ldap_state, + char *object_dn, + size_t *pwd_len, + char *pwd ); +int pdb_nds_set_password( + struct smbldap_state *ldap_state, + char *object_dn, + const char *pwd ); +NTSTATUS pdb_nds_init(void); + +/* The following definitions come from passdb/pdb_smbpasswd.c */ + +NTSTATUS pdb_smbpasswd_init(void) ; + +/* The following definitions come from passdb/pdb_tdb.c */ + +bool init_sam_from_buffer_v2(struct samu *sampass, uint8 *buf, uint32 buflen); +NTSTATUS pdb_tdbsam_init(void); + +/* The following definitions come from passdb/secrets.c */ + +bool secrets_init(void); +struct db_context *secrets_db_ctx(void); +void secrets_shutdown(void); +void *secrets_fetch(const char *key, size_t *size); +bool secrets_store(const char *key, const void *data, size_t size); +bool secrets_delete(const char *key); +bool secrets_store_domain_sid(const char *domain, const DOM_SID *sid); +bool secrets_fetch_domain_sid(const char *domain, DOM_SID *sid); +bool secrets_store_domain_guid(const char *domain, struct GUID *guid); +bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid); +void *secrets_get_trust_account_lock(TALLOC_CTX *mem_ctx, const char *domain); +uint32 get_default_sec_channel(void); +bool secrets_fetch_trust_account_password_legacy(const char *domain, + uint8 ret_pwd[16], + time_t *pass_last_set_time, + uint32 *channel); +bool secrets_fetch_trust_account_password(const char *domain, uint8 ret_pwd[16], + time_t *pass_last_set_time, + uint32 *channel); +bool secrets_fetch_trusted_domain_password(const char *domain, char** pwd, + DOM_SID *sid, time_t *pass_last_set_time); +bool secrets_store_trusted_domain_password(const char* domain, const char* pwd, + const DOM_SID *sid); +bool secrets_delete_machine_password(const char *domain); +bool secrets_delete_machine_password_ex(const char *domain); +bool secrets_delete_domain_sid(const char *domain); +bool secrets_store_machine_password(const char *pass, const char *domain, uint32 sec_channel); +char *secrets_fetch_machine_password(const char *domain, + time_t *pass_last_set_time, + uint32 *channel); +bool trusted_domain_password_delete(const char *domain); +bool secrets_store_ldap_pw(const char* dn, char* pw); +bool fetch_ldap_pw(char **dn, char** pw); +NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains, + struct trustdom_info ***domains); +bool secrets_store_afs_keyfile(const char *cell, const struct afs_keyfile *keyfile); +bool secrets_fetch_afs_key(const char *cell, struct afs_key *result); +void secrets_fetch_ipc_userpass(char **username, char **domain, char **password); +bool secrets_store_schannel_session_info(TALLOC_CTX *mem_ctx, + const char *remote_machine, + const struct dcinfo *pdc); +bool secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx, + const char *remote_machine, + struct dcinfo **ppdc); +bool secrets_store_generic(const char *owner, const char *key, const char *secret); +char *secrets_fetch_generic(const char *owner, const char *key); + +/* The following definitions come from passdb/util_builtin.c */ + +bool lookup_builtin_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name); +bool lookup_builtin_name(const char *name, uint32 *rid); +const char *builtin_domain_name(void); +bool sid_check_is_builtin(const DOM_SID *sid); +bool sid_check_is_in_builtin(const DOM_SID *sid); + +/* The following definitions come from passdb/util_unixsids.c */ + +bool sid_check_is_unix_users(const DOM_SID *sid); +bool sid_check_is_in_unix_users(const DOM_SID *sid); +bool uid_to_unix_users_sid(uid_t uid, DOM_SID *sid); +bool gid_to_unix_groups_sid(gid_t gid, DOM_SID *sid); +const char *unix_users_domain_name(void); +bool lookup_unix_user_name(const char *name, DOM_SID *sid); +bool sid_check_is_unix_groups(const DOM_SID *sid); +bool sid_check_is_in_unix_groups(const DOM_SID *sid); +const char *unix_groups_domain_name(void); +bool lookup_unix_group_name(const char *name, DOM_SID *sid); + +/* The following definitions come from passdb/util_wellknown.c */ + +bool sid_check_is_wellknown_domain(const DOM_SID *sid, const char **name); +bool sid_check_is_in_wellknown_domain(const DOM_SID *sid); +bool lookup_wellknown_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + const char **domain, const char **name); +bool lookup_wellknown_name(TALLOC_CTX *mem_ctx, const char *name, + DOM_SID *sid, const char **domain); + +/* The following definitions come from printing/load.c */ + +void load_printers(void); + +/* The following definitions come from printing/lpq_parse.c */ + +bool parse_lpq_entry(enum printing_types printing_type,char *line, + print_queue_struct *buf, + print_status_struct *status,bool first); + +/* The following definitions come from printing/notify.c */ + +int print_queue_snum(const char *qname); +bool print_notify_messages_pending(void); +void print_notify_send_messages(struct messaging_context *msg_ctx, + unsigned int timeout); +void notify_printer_status_byname(const char *sharename, uint32 status); +void notify_printer_status(int snum, uint32 status); +void notify_job_status_byname(const char *sharename, uint32 jobid, uint32 status, + uint32 flags); +void notify_job_status(const char *sharename, uint32 jobid, uint32 status); +void notify_job_total_bytes(const char *sharename, uint32 jobid, + uint32 size); +void notify_job_total_pages(const char *sharename, uint32 jobid, + uint32 pages); +void notify_job_username(const char *sharename, uint32 jobid, char *name); +void notify_job_name(const char *sharename, uint32 jobid, char *name); +void notify_job_submitted(const char *sharename, uint32 jobid, + time_t submitted); +void notify_printer_driver(int snum, char *driver_name); +void notify_printer_comment(int snum, char *comment); +void notify_printer_sharename(int snum, char *share_name); +void notify_printer_printername(int snum, char *printername); +void notify_printer_port(int snum, char *port_name); +void notify_printer_location(int snum, char *location); +void notify_printer_byname( const char *printername, uint32 change, const char *value ); +bool print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, size_t *p_num_pids, pid_t **pp_pid_list); + +/* The following definitions come from printing/nt_printing.c */ + +bool nt_printing_init(struct messaging_context *msg_ctx); +uint32 update_c_setprinter(bool initialize); +uint32 get_c_setprinter(void); +int get_builtin_ntforms(nt_forms_struct **list); +bool get_a_builtin_ntform(UNISTR2 *uni_formname,nt_forms_struct *form); +int get_ntforms(nt_forms_struct **list); +int write_ntforms(nt_forms_struct **list, int number); +bool add_a_form(nt_forms_struct **list, const FORM *form, int *count); +bool delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, WERROR *ret); +void update_a_form(nt_forms_struct **list, const FORM *form, int count); +int get_ntdrivers(fstring **list, const char *architecture, uint32 version); +const char *get_short_archi(const char *long_archi); +WERROR clean_up_driver_struct(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, + uint32 level, struct current_user *user); +WERROR move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32 level, + struct current_user *user, WERROR *perr); +int pack_devicemode(NT_DEVICEMODE *nt_devmode, uint8 *buf, int buflen); +uint32 del_a_printer(const char *sharename); +NT_DEVICEMODE *construct_nt_devicemode(const fstring default_devicename); +NT_DEVICEMODE *dup_nt_devicemode(NT_DEVICEMODE *nt_devicemode); +void free_nt_devicemode(NT_DEVICEMODE **devmode_ptr); +int unpack_devicemode(NT_DEVICEMODE **nt_devmode, const uint8 *buf, int buflen); +int add_new_printer_key( NT_PRINTER_DATA *data, const char *name ); +int delete_printer_key( NT_PRINTER_DATA *data, const char *name ); +int lookup_printerkey( NT_PRINTER_DATA *data, const char *name ); +int get_printer_subkeys( NT_PRINTER_DATA *data, const char* key, fstring **subkeys ); +WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action); +WERROR check_published_printers(void); +bool is_printer_published(Printer_entry *print_hnd, int snum, + struct GUID *guid); +WERROR nt_printer_publish(Printer_entry *print_hnd, int snum, int action); +WERROR check_published_printers(void); +bool is_printer_published(Printer_entry *print_hnd, int snum, + struct GUID *guid); +WERROR delete_all_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key ); +WERROR delete_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value ); +WERROR add_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value, + uint32 type, uint8 *data, int real_len ); +REGISTRY_VALUE* get_printer_data( NT_PRINTER_INFO_LEVEL_2 *p2, const char *key, const char *value ); +WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL *printer, uint32 level); +bool set_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level); +bool del_driver_init(char *drivername); +WERROR save_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level, uint8 *data, uint32 data_len); +WERROR get_a_printer( Printer_entry *print_hnd, + NT_PRINTER_INFO_LEVEL **pp_printer, + uint32 level, + const char *sharename); +WERROR get_a_printer_search( Printer_entry *print_hnd, + NT_PRINTER_INFO_LEVEL **pp_printer, + uint32 level, + const char *sharename); +uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level); +uint32 add_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level); +WERROR get_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL *driver, uint32 level, + fstring drivername, const char *architecture, uint32 version); +uint32 free_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level); +bool printer_driver_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3 ); +bool printer_driver_files_in_use ( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info ); +WERROR delete_printer_driver( NT_PRINTER_DRIVER_INFO_LEVEL_3 *info_3, struct current_user *user, + uint32 version, bool delete_files ); +WERROR nt_printing_setsec(const char *sharename, SEC_DESC_BUF *secdesc_ctr); +bool nt_printing_getsec(TALLOC_CTX *ctx, const char *sharename, SEC_DESC_BUF **secdesc_ctr); +void map_printer_permissions(SEC_DESC *sd); +void map_job_permissions(SEC_DESC *sd); +bool print_access_check(struct auth_serversupplied_info *server_info, int snum, + int access_type); +bool print_time_access_check(const char *servicename); +char* get_server_name( Printer_entry *printer ); + +/* The following definitions come from printing/pcap.c */ + +bool pcap_cache_add(const char *name, const char *comment); +bool pcap_cache_loaded(void); +void pcap_cache_reload(void); +bool pcap_printername_ok(const char *printername); +void pcap_printer_fn(void (*fn)(char *, char *)); + +/* The following definitions come from printing/print_aix.c */ + +bool aix_cache_reload(void); + +/* The following definitions come from printing/print_cups.c */ + +bool cups_cache_reload(void); +bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer); + +/* The following definitions come from printing/print_generic.c */ + + +/* The following definitions come from printing/print_iprint.c */ + +bool iprint_cache_reload(void); + +/* The following definitions come from printing/print_svid.c */ + +bool sysv_cache_reload(void); + +/* The following definitions come from printing/printfsp.c */ + +NTSTATUS print_fsp_open(connection_struct *conn, const char *fname, + uint16_t current_vuid, files_struct **result); +void print_fsp_end(files_struct *fsp, enum file_close_type close_type); + +/* The following definitions come from printing/printing.c */ + +uint16 pjobid_to_rap(const char* sharename, uint32 jobid); +bool rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid); +bool print_backend_init(struct messaging_context *msg_ctx); +void printing_end(void); +int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob ); +uint32 sysjob_to_jobid(int unix_jobid); +void pjob_delete(const char* sharename, uint32 jobid); +void start_background_queue(void); +bool print_notify_register_pid(int snum); +bool print_notify_deregister_pid(int snum); +bool print_job_exists(const char* sharename, uint32 jobid); +int print_job_fd(const char* sharename, uint32 jobid); +char *print_job_fname(const char* sharename, uint32 jobid); +NT_DEVICEMODE *print_job_devmode(const char* sharename, uint32 jobid); +bool print_job_set_place(const char *sharename, uint32 jobid, int place); +bool print_job_set_name(const char *sharename, uint32 jobid, char *name); +bool print_job_delete(struct auth_serversupplied_info *server_info, int snum, + uint32 jobid, WERROR *errcode); +bool print_job_pause(struct auth_serversupplied_info *server_info, int snum, + uint32 jobid, WERROR *errcode); +bool print_job_resume(struct auth_serversupplied_info *server_info, int snum, + uint32 jobid, WERROR *errcode); +ssize_t print_job_write(int snum, uint32 jobid, const char *buf, SMB_OFF_T pos, size_t size); +int print_queue_length(int snum, print_status_struct *pstatus); +uint32 print_job_start(struct auth_serversupplied_info *server_info, int snum, + char *jobname, NT_DEVICEMODE *nt_devmode ); +void print_job_endpage(int snum, uint32 jobid); +bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type); +int print_queue_status(int snum, + print_queue_struct **ppqueue, + print_status_struct *status); +bool print_queue_pause(struct auth_serversupplied_info *server_info, int snum, + WERROR *errcode); +bool print_queue_resume(struct auth_serversupplied_info *server_info, int snum, + WERROR *errcode); +bool print_queue_purge(struct auth_serversupplied_info *server_info, int snum, + WERROR *errcode); + +/* The following definitions come from printing/printing_db.c */ + +struct tdb_print_db *get_print_db_byname(const char *printername); +void release_print_db( struct tdb_print_db *pdb); +void close_all_print_db(void); +TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, bool cleanlist); + +/* The following definitions come from profile/profile.c */ + +void set_profile_level(int level, struct server_id src); +bool profile_setup(struct messaging_context *msg_ctx, bool rdonly); + +/* The following definitions come from registry/reg_api.c */ + +WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive, + uint32 desired_access, + const struct nt_user_token *token, + struct registry_key **pkey); +WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent, + const char *name, uint32 desired_access, + struct registry_key **pkey); +WERROR reg_enumkey(TALLOC_CTX *mem_ctx, struct registry_key *key, + uint32 idx, char **name, NTTIME *last_write_time); +WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key, + uint32 idx, char **pname, struct registry_value **pval); +WERROR reg_queryvalue(TALLOC_CTX *mem_ctx, struct registry_key *key, + const char *name, struct registry_value **pval); +WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys, + uint32_t *max_subkeylen, uint32_t *max_subkeysize, + uint32_t *num_values, uint32_t *max_valnamelen, + uint32_t *max_valbufsize, uint32_t *secdescsize, + NTTIME *last_changed_time); +WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent, + const char *subkeypath, uint32 desired_access, + struct registry_key **pkey, + enum winreg_CreateAction *paction); +WERROR reg_deletekey(struct registry_key *parent, const char *path); +WERROR reg_setvalue(struct registry_key *key, const char *name, + const struct registry_value *val); +WERROR reg_deletevalue(struct registry_key *key, const char *name); +WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key, + struct security_descriptor **psecdesc); +WERROR reg_setkeysecurity(struct registry_key *key, + struct security_descriptor *psecdesc); +WERROR reg_getversion(uint32_t *version); +WERROR reg_restorekey(struct registry_key *key, const char *fname); +WERROR reg_savekey(struct registry_key *key, const char *fname); +WERROR reg_deleteallvalues(struct registry_key *key); +WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path, + uint32 desired_access, const struct nt_user_token *token, + struct registry_key **pkey); +WERROR reg_deletekey_recursive(TALLOC_CTX *ctx, + struct registry_key *parent, + const char *path); +WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx, + struct registry_key *parent, + const char *path); +WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path, + uint32 desired_access, + const struct nt_user_token *token, + enum winreg_CreateAction *paction, + struct registry_key **pkey); +WERROR reg_delete_path(const struct nt_user_token *token, + const char *orig_path); + +/* The following definitions come from registry/reg_backend_current_version.c */ + + +/* The following definitions come from registry/reg_backend_db.c */ + +WERROR init_registry_key(const char *add_path); +WERROR init_registry_data(void); +WERROR regdb_init(void); +WERROR regdb_open( void ); +int regdb_close( void ); +int regdb_get_seqnum(void); +bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr); +int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr); +int regdb_fetch_values( const char* key, REGVAL_CTR *values ); +bool regdb_store_values( const char *key, REGVAL_CTR *values ); +bool regdb_subkeys_need_update(REGSUBKEY_CTR *subkeys); +bool regdb_values_need_update(REGVAL_CTR *values); + +/* The following definitions come from registry/reg_backend_hkpt_params.c */ + + +/* The following definitions come from registry/reg_backend_netlogon_params.c */ + + +/* The following definitions come from registry/reg_backend_perflib.c */ + + +/* The following definitions come from registry/reg_backend_printing.c */ + + +/* The following definitions come from registry/reg_backend_prod_options.c */ + + +/* The following definitions come from registry/reg_backend_shares.c */ + + +/* The following definitions come from registry/reg_backend_smbconf.c */ + + +/* The following definitions come from registry/reg_backend_tcpip_params.c */ + + +/* The following definitions come from registry/reg_cachehook.c */ + +WERROR reghook_cache_init(void); +WERROR reghook_cache_add(const char *keyname, REGISTRY_OPS *ops); +REGISTRY_OPS *reghook_cache_find(const char *keyname); +void reghook_dump_cache( int debuglevel ); + +/* The following definitions come from registry/reg_dispatcher.c */ + +bool store_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys ); +bool store_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ); +int fetch_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkey_ctr ); +int fetch_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ); +bool regkey_access_check( REGISTRY_KEY *key, uint32 requested, uint32 *granted, + const struct nt_user_token *token ); +WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, REGISTRY_KEY *key, + struct security_descriptor **psecdesc); +WERROR regkey_set_secdesc(REGISTRY_KEY *key, + struct security_descriptor *psecdesc); +bool reg_subkeys_need_update(REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys); +bool reg_values_need_update(REGISTRY_KEY *key, REGVAL_CTR *values); + +/* The following definitions come from registry/reg_eventlog.c */ + +bool eventlog_init_keys(void); +bool eventlog_add_source( const char *eventlog, const char *sourcename, + const char *messagefile ); + +/* The following definitions come from registry/reg_init_basic.c */ + +WERROR registry_init_common(void); +WERROR registry_init_basic(void); + +/* The following definitions come from registry/reg_init_full.c */ + +WERROR registry_init_full(void); + +/* The following definitions come from registry/reg_init_smbconf.c */ + +NTSTATUS registry_create_admin_token(TALLOC_CTX *mem_ctx, + NT_USER_TOKEN **ptoken); +WERROR registry_init_smbconf(const char *keyname); + +/* The following definitions come from registry/reg_objects.c */ + +WERROR regsubkey_ctr_addkey( REGSUBKEY_CTR *ctr, const char *keyname ); +int regsubkey_ctr_delkey( REGSUBKEY_CTR *ctr, const char *keyname ); +bool regsubkey_ctr_key_exists( REGSUBKEY_CTR *ctr, const char *keyname ); +int regsubkey_ctr_numkeys( REGSUBKEY_CTR *ctr ); +char* regsubkey_ctr_specific_key( REGSUBKEY_CTR *ctr, uint32 key_index ); +int regval_ctr_numvals( REGVAL_CTR *ctr ); +REGISTRY_VALUE* dup_registry_value( REGISTRY_VALUE *val ); +void free_registry_value( REGISTRY_VALUE *val ); +uint8* regval_data_p( REGISTRY_VALUE *val ); +uint32 regval_size( REGISTRY_VALUE *val ); +char* regval_name( REGISTRY_VALUE *val ); +uint32 regval_type( REGISTRY_VALUE *val ); +REGISTRY_VALUE* regval_ctr_specific_value( REGVAL_CTR *ctr, uint32 idx ); +bool regval_ctr_key_exists( REGVAL_CTR *ctr, const char *value ); +REGISTRY_VALUE *regval_compose(TALLOC_CTX *ctx, const char *name, uint16 type, + const char *data_p, size_t size); +int regval_ctr_addvalue( REGVAL_CTR *ctr, const char *name, uint16 type, + const char *data_p, size_t size ); +int regval_ctr_copyvalue( REGVAL_CTR *ctr, REGISTRY_VALUE *val ); +int regval_ctr_delvalue( REGVAL_CTR *ctr, const char *name ); +REGISTRY_VALUE* regval_ctr_getvalue( REGVAL_CTR *ctr, const char *name ); +uint32 regval_dword( REGISTRY_VALUE *val ); +char *regval_sz(REGISTRY_VALUE *val); + +/* The following definitions come from registry/reg_perfcount.c */ + +void perfcount_init_keys( void ); +uint32 reg_perfcount_get_base_index(void); +uint32 reg_perfcount_get_last_counter(uint32 base_index); +uint32 reg_perfcount_get_last_help(uint32 last_counter); +uint32 reg_perfcount_get_counter_help(uint32 base_index, char **retbuf); +uint32 reg_perfcount_get_counter_names(uint32 base_index, char **retbuf); +bool _reg_perfcount_get_counter_data(TDB_DATA key, TDB_DATA *data); +bool _reg_perfcount_get_instance_info(PERF_INSTANCE_DEFINITION *inst, + prs_struct *ps, + int instId, + PERF_OBJECT_TYPE *obj, + TDB_CONTEXT *names); +bool _reg_perfcount_add_instance(PERF_OBJECT_TYPE *obj, + prs_struct *ps, + int instInd, + TDB_CONTEXT *names); +uint32 reg_perfcount_get_perf_data_block(uint32 base_index, + prs_struct *ps, + PERF_DATA_BLOCK *block, + const char *object_ids); +WERROR reg_perfcount_get_hkpd(prs_struct *ps, uint32 max_buf_size, uint32 *outbuf_len, const char *object_ids); + +/* The following definitions come from registry/reg_util.c */ + +bool reg_split_path(char *path, char **base, char **new_path); +bool reg_split_key(char *path, char **base, char **key); +char *normalize_reg_path(TALLOC_CTX *ctx, const char *keyname ); +void normalize_dbkey(char *key); +char *reg_remaining_path(TALLOC_CTX *ctx, const char *key); +int regval_convert_multi_sz( uint16 *multi_string, size_t byte_len, char ***values ); +size_t regval_build_multi_sz( char **values, uint16 **buffer ); + +/* The following definitions come from registry/reg_util_legacy.c */ + +WERROR regkey_open_internal( TALLOC_CTX *ctx, REGISTRY_KEY **regkey, + const char *path, + const struct nt_user_token *token, + uint32 access_desired ); + +/* The following definitions come from registry/regfio.c */ + + +/* The following definitions come from rpc_client/cli_lsarpc.c */ + +NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + bool sec_qos, uint32 des_access, + POLICY_HND *pol); +NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, bool sec_qos, + uint32 des_access, POLICY_HND *pol); +NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + POLICY_HND *pol, + int num_sids, + const DOM_SID *sids, + char ***pdomains, + char ***pnames, + enum lsa_SidType **ptypes); +NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + POLICY_HND *pol, int num_names, + const char **names, + const char ***dom_names, + int level, + DOM_SID **sids, + enum lsa_SidType **types); +bool fetch_domain_sid( char *domain, char *remote_machine, DOM_SID *psid); + +/* The following definitions come from rpc_client/cli_netlogon.c */ + +NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli, + const char *server_name, + const char *domain, + const char *clnt_name, + const char *machine_account, + const unsigned char machine_pwd[16], + enum netr_SchannelType sec_chan_type, + uint32_t *neg_flags_inout); +NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32 logon_parameters, + const char *domain, + const char *username, + const char *password, + const char *workstation, + int logon_type); +NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32 logon_parameters, + const char *server, + const char *username, + const char *domain, + const char *workstation, + const uint8 chal[8], + DATA_BLOB lm_response, + DATA_BLOB nt_response, + struct netr_SamInfo3 **info3); +NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32 logon_parameters, + const char *server, + const char *username, + const char *domain, + const char *workstation, + const uint8 chal[8], + DATA_BLOB lm_response, + DATA_BLOB nt_response, + struct netr_SamInfo3 **info3); + +/* The following definitions come from rpc_client/cli_pipe.c */ + +NTSTATUS rpc_api_pipe_req(struct rpc_pipe_client *cli, + uint8 op_num, + prs_struct *in_data, + prs_struct *out_data); +NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli, + struct cli_pipe_auth_data *auth); +unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli, + unsigned int timeout); +bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]); +struct cli_state *rpc_pipe_np_smb_conn(struct rpc_pipe_client *p); +NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx, + struct cli_pipe_auth_data **presult); +NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx, + enum pipe_auth_type auth_type, + enum pipe_auth_level auth_level, + const char *domain, + const char *username, + const char *password, + struct cli_pipe_auth_data **presult); +NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain, + enum pipe_auth_level auth_level, + const uint8_t sess_key[16], + struct cli_pipe_auth_data **presult); +NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx, + enum pipe_auth_level auth_level, + const char *service_princ, + const char *username, + const char *password, + struct cli_pipe_auth_data **presult); +NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host, + const struct ndr_syntax_id *abstract_syntax, + struct rpc_pipe_client **presult); +NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path, + const struct ndr_syntax_id *abstract_syntax, + struct rpc_pipe_client **presult); +NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli, + const struct ndr_syntax_id *interface, + struct rpc_pipe_client **presult); +NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli, + const struct ndr_syntax_id *interface, + enum pipe_auth_level auth_level, + const char *domain, + const char *username, + const char *password, + struct rpc_pipe_client **presult); +NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli, + const struct ndr_syntax_id *interface, + enum pipe_auth_level auth_level, + const char *domain, + const char *username, + const char *password, + struct rpc_pipe_client **presult); +NTSTATUS get_schannel_session_key(struct cli_state *cli, + const char *domain, + uint32 *pneg_flags, + struct rpc_pipe_client **presult); +NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli, + const struct ndr_syntax_id *interface, + enum pipe_auth_level auth_level, + const char *domain, + const struct dcinfo *pdc, + struct rpc_pipe_client **presult); +NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli, + const struct ndr_syntax_id *interface, + enum pipe_auth_level auth_level, + const char *domain, + const char *username, + const char *password, + struct rpc_pipe_client **presult); +NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli, + const struct ndr_syntax_id *interface, + enum pipe_auth_level auth_level, + const char *domain, + struct rpc_pipe_client **presult); +NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli, + const struct ndr_syntax_id *interface, + enum pipe_auth_level auth_level, + const char *service_princ, + const char *username, + const char *password, + struct rpc_pipe_client **presult); +NTSTATUS cli_get_session_key(TALLOC_CTX *mem_ctx, + struct rpc_pipe_client *cli, + DATA_BLOB *session_key); + + +/* The following definitions come from rpc_client/cli_reg.c */ + +NTSTATUS rpccli_winreg_Connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + uint32 reg_type, uint32 access_mask, + POLICY_HND *reg_hnd); +uint32 reg_init_regval_buffer( REGVAL_BUFFER *buf2, REGISTRY_VALUE *val ); + +/* The following definitions come from rpc_client/cli_samr.c */ + +NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + const char *newpassword, + const char *oldpassword); +NTSTATUS rpccli_samr_chgpasswd_user2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *username, + const char *newpassword, + const char *oldpassword); +NTSTATUS rpccli_samr_chng_pswd_auth_crap(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *username, + DATA_BLOB new_nt_password_blob, + DATA_BLOB old_nt_hash_enc_blob, + DATA_BLOB new_lm_password_blob, + DATA_BLOB old_lm_hash_enc_blob); +NTSTATUS rpccli_samr_chgpasswd_user3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *username, + const char *newpassword, + const char *oldpassword, + struct samr_DomInfo1 **dominfo1, + struct samr_ChangeReject **reject); +void get_query_dispinfo_params(int loop_count, uint32 *max_entries, + uint32 *max_size); +NTSTATUS rpccli_try_samr_connects(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32_t access_mask, + POLICY_HND *connect_pol); + +/* The following definitions come from rpc_client/cli_spoolss.c */ + +WERROR rpccli_spoolss_open_printer_ex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *printername, const char *datatype, uint32 access_required, + const char *station, const char *username, POLICY_HND *pol); +WERROR rpccli_spoolss_close_printer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *pol); +WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + char *name, uint32 flags, uint32 level, + uint32 *num_printers, PRINTER_INFO_CTR *ctr); +WERROR rpccli_spoolss_enum_ports(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + uint32 level, uint32 *num_ports, PORT_INFO_CTR *ctr); +WERROR rpccli_spoolss_getprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *pol, uint32 level, + PRINTER_INFO_CTR *ctr); +WERROR rpccli_spoolss_setprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *pol, uint32 level, + PRINTER_INFO_CTR *ctr, uint32 command); +WERROR rpccli_spoolss_getprinterdriver(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + POLICY_HND *pol, uint32 level, + const char *env, int version, PRINTER_DRIVER_CTR *ctr); +WERROR rpccli_spoolss_enumprinterdrivers (struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32 level, const char *env, + uint32 *num_drivers, + PRINTER_DRIVER_CTR *ctr); +WERROR rpccli_spoolss_getprinterdriverdir (struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint32 level, char *env, + DRIVER_DIRECTORY_CTR *ctr); +WERROR rpccli_spoolss_addprinterdriver (struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, uint32 level, + PRINTER_DRIVER_CTR *ctr); +WERROR rpccli_spoolss_addprinterex (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + uint32 level, PRINTER_INFO_CTR*ctr); +WERROR rpccli_spoolss_deleteprinterdriverex(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, const char *arch, + const char *driver, int version); +WERROR rpccli_spoolss_deleteprinterdriver (struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, const char *arch, + const char *driver); +WERROR rpccli_spoolss_getprintprocessordirectory(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + char *name, char *environment, + fstring procdir); +WERROR rpccli_spoolss_addform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *handle, uint32 level, FORM *form); +WERROR rpccli_spoolss_setform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *handle, uint32 level, + const char *form_name, FORM *form); +WERROR rpccli_spoolss_getform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *handle, const char *formname, + uint32 level, FORM_1 *form); +WERROR rpccli_spoolss_deleteform(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *handle, const char *form_name); +WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *handle, int level, uint32 *num_forms, + FORM_1 **forms); +WERROR rpccli_spoolss_enumjobs(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, uint32 level, uint32 firstjob, + uint32 num_jobs, uint32 *returned, JOB_INFO_CTR *ctr); +WERROR rpccli_spoolss_setjob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, uint32 jobid, uint32 level, + uint32 command); +WERROR rpccli_spoolss_getjob(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, uint32 jobid, uint32 level, + JOB_INFO_CTR *ctr); +WERROR rpccli_spoolss_startpageprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd); +WERROR rpccli_spoolss_endpageprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd); +WERROR rpccli_spoolss_startdocprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, char *docname, + char *outputfile, char *datatype, + uint32 *jobid); +WERROR rpccli_spoolss_enddocprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd); +WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, const char *valuename, + REGISTRY_VALUE *value); +WERROR rpccli_spoolss_getprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, const char *keyname, + const char *valuename, + REGISTRY_VALUE *value); +WERROR rpccli_spoolss_setprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, REGISTRY_VALUE *value); +WERROR rpccli_spoolss_setprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, char *keyname, + REGISTRY_VALUE *value); +WERROR rpccli_spoolss_enumprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, uint32 ndx, + uint32 value_offered, uint32 data_offered, + uint32 *value_needed, uint32 *data_needed, + REGISTRY_VALUE *value); +WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, const char *keyname, + REGVAL_CTR *ctr); +WERROR rpccli_spoolss_writeprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, uint32 data_size, char *data, + uint32 *num_written); +WERROR rpccli_spoolss_deleteprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, char *valuename); +WERROR rpccli_spoolss_deleteprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, char *keyname, + char *valuename); +WERROR rpccli_spoolss_enumprinterkey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, const char *keyname, + uint16 **keylist, uint32 *len); +WERROR rpccli_spoolss_deleteprinterkey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hnd, char *keyname); + +/* The following definitions come from rpc_client/cli_spoolss_notify.c */ + +WERROR rpccli_spoolss_reply_open_printer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *printer, uint32 printerlocal, uint32 type, + POLICY_HND *handle); +WERROR rpccli_spoolss_reply_close_printer(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *handle); +WERROR rpccli_spoolss_routerreplyprinter(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *pol, uint32 condition, uint32 change_id); +WERROR rpccli_spoolss_rrpcn(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *pol, uint32 notify_data_len, + SPOOL_NOTIFY_INFO_DATA *notify_data, + uint32 change_low, uint32 change_high); +WERROR rpccli_spoolss_rffpcnex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *pol, uint32 flags, uint32 options, + const char *localmachine, uint32 printerlocal, + SPOOL_NOTIFY_OPTION *option); + +/* The following definitions come from rpc_client/cli_svcctl.c */ + +WERROR rpccli_svcctl_enumerate_services( struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hSCM, uint32 type, uint32 state, + uint32 *returned, ENUM_SERVICES_STATUS **service_array ); +WERROR rpccli_svcctl_query_config(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *hService, SERVICE_CONFIG *config ); + +/* The following definitions come from rpc_client/init_lsa.c */ + +void init_lsa_String(struct lsa_String *name, const char *s); +void init_lsa_StringLarge(struct lsa_StringLarge *name, const char *s); +void init_lsa_AsciiString(struct lsa_AsciiString *name, const char *s); +void init_lsa_AsciiStringLarge(struct lsa_AsciiStringLarge *name, const char *s); +void init_lsa_sec_qos(struct lsa_QosInfo *r, + uint32_t len, + uint16_t impersonation_level, + uint8_t context_mode, + uint8_t effective_only); +void init_lsa_obj_attr(struct lsa_ObjectAttribute *r, + uint32_t len, + uint8_t *root_dir, + const char *object_name, + uint32_t attributes, + struct security_descriptor *sec_desc, + struct lsa_QosInfo *sec_qos); +void init_lsa_translated_sid(struct lsa_TranslatedSid *r, + enum lsa_SidType sid_type, + uint32_t rid, + uint32_t sid_index); +void init_lsa_translated_name2(struct lsa_TranslatedName2 *r, + enum lsa_SidType sid_type, + const char *name, + uint32_t sid_index, + uint32_t unknown); + +/* The following definitions come from rpc_client/init_netlogon.c */ + +void init_netr_SamBaseInfo(struct netr_SamBaseInfo *r, + NTTIME last_logon, + NTTIME last_logoff, + NTTIME acct_expiry, + NTTIME last_password_change, + NTTIME allow_password_change, + NTTIME force_password_change, + const char *account_name, + const char *full_name, + const char *logon_script, + const char *profile_path, + const char *home_directory, + const char *home_drive, + uint16_t logon_count, + uint16_t bad_password_count, + uint32_t rid, + uint32_t primary_gid, + struct samr_RidWithAttributeArray groups, + uint32_t user_flags, + struct netr_UserSessionKey key, + const char *logon_server, + const char *domain, + struct dom_sid2 *domain_sid, + struct netr_LMSessionKey LMSessKey, + uint32_t acct_flags); +void init_netr_SamInfo3(struct netr_SamInfo3 *r, + NTTIME last_logon, + NTTIME last_logoff, + NTTIME acct_expiry, + NTTIME last_password_change, + NTTIME allow_password_change, + NTTIME force_password_change, + const char *account_name, + const char *full_name, + const char *logon_script, + const char *profile_path, + const char *home_directory, + const char *home_drive, + uint16_t logon_count, + uint16_t bad_password_count, + uint32_t rid, + uint32_t primary_gid, + struct samr_RidWithAttributeArray groups, + uint32_t user_flags, + struct netr_UserSessionKey key, + const char *logon_server, + const char *domain, + struct dom_sid2 *domain_sid, + struct netr_LMSessionKey LMSessKey, + uint32_t acct_flags, + uint32_t sidcount, + struct netr_SidAttr *sids); +NTSTATUS serverinfo_to_SamInfo3(struct auth_serversupplied_info *server_info, + uint8_t pipe_session_key[16], + struct netr_SamInfo3 *sam3); +void init_netr_IdentityInfo(struct netr_IdentityInfo *r, + const char *domain_name, + uint32_t parameter_control, + uint32_t logon_id_low, + uint32_t logon_id_high, + const char *account_name, + const char *workstation); +void init_netr_NetworkInfo(struct netr_NetworkInfo *r, + const char *domain_name, + uint32_t parameter_control, + uint32_t logon_id_low, + uint32_t logon_id_high, + const char *account_name, + const char *workstation, + uint8_t challenge[8], + struct netr_ChallengeResponse nt, + struct netr_ChallengeResponse lm); +void init_netr_PasswordInfo(struct netr_PasswordInfo *r, + const char *domain_name, + uint32_t parameter_control, + uint32_t logon_id_low, + uint32_t logon_id_high, + const char *account_name, + const char *workstation, + struct samr_Password lmpassword, + struct samr_Password ntpassword); + +/* The following definitions come from rpc_client/init_samr.c */ + +void init_samr_DomInfo1(struct samr_DomInfo1 *r, + uint16_t min_password_length, + uint16_t password_history_length, + uint32_t password_properties, + int64_t max_password_age, + int64_t min_password_age); +void init_samr_DomInfo2(struct samr_DomInfo2 *r, + NTTIME force_logoff_time, + const char *comment, + const char *domain_name, + const char *primary, + uint64_t sequence_num, + uint32_t unknown2, + enum samr_Role role, + uint32_t unknown3, + uint32_t num_users, + uint32_t num_groups, + uint32_t num_aliases); +void init_samr_DomInfo3(struct samr_DomInfo3 *r, + NTTIME force_logoff_time); +void init_samr_DomInfo4(struct samr_DomInfo4 *r, + const char *comment); +void init_samr_DomInfo5(struct samr_DomInfo5 *r, + const char *domain_name); +void init_samr_DomInfo6(struct samr_DomInfo6 *r, + const char *primary); +void init_samr_DomInfo7(struct samr_DomInfo7 *r, + enum samr_Role role); +void init_samr_DomInfo8(struct samr_DomInfo8 *r, + uint64_t sequence_num, + NTTIME domain_create_time); +void init_samr_DomInfo9(struct samr_DomInfo9 *r, + uint32_t unknown); +void init_samr_DomInfo12(struct samr_DomInfo12 *r, + uint64_t lockout_duration, + uint64_t lockout_window, + uint16_t lockout_threshold); +void init_samr_group_info1(struct samr_GroupInfoAll *r, + const char *name, + uint32_t attributes, + uint32_t num_members, + const char *description); +void init_samr_group_info2(struct lsa_String *r, const char *group_name); +void init_samr_group_info3(struct samr_GroupInfoAttributes *r, + uint32_t attributes); +void init_samr_group_info4(struct lsa_String *r, const char *description); +void init_samr_group_info5(struct samr_GroupInfoAll *r, + const char *name, + uint32_t attributes, + uint32_t num_members, + const char *description); +void init_samr_alias_info1(struct samr_AliasInfoAll *r, + const char *name, + uint32_t num_members, + const char *description); +void init_samr_alias_info3(struct lsa_String *r, + const char *description); +void init_samr_user_info7(struct samr_UserInfo7 *r, + const char *account_name); +void init_samr_user_info9(struct samr_UserInfo9 *r, + uint32_t primary_gid); +void init_samr_user_info16(struct samr_UserInfo16 *r, + uint32_t acct_flags); +void init_samr_user_info18(struct samr_UserInfo18 *r, + const uint8 lm_pwd[16], + const uint8 nt_pwd[16]); +void init_samr_user_info20(struct samr_UserInfo20 *r, + struct lsa_BinaryString *parameters); +void init_samr_user_info21(struct samr_UserInfo21 *r, + NTTIME last_logon, + NTTIME last_logoff, + NTTIME last_password_change, + NTTIME acct_expiry, + NTTIME allow_password_change, + NTTIME force_password_change, + const char *account_name, + const char *full_name, + const char *home_directory, + const char *home_drive, + const char *logon_script, + const char *profile_path, + const char *description, + const char *workstations, + const char *comment, + struct lsa_BinaryString *parameters, + uint32_t rid, + uint32_t primary_gid, + uint32_t acct_flags, + uint32_t fields_present, + struct samr_LogonHours logon_hours, + uint16_t bad_password_count, + uint16_t logon_count, + uint16_t country_code, + uint16_t code_page, + uint8_t nt_password_set, + uint8_t lm_password_set, + uint8_t password_expired); +void init_samr_user_info23(struct samr_UserInfo23 *r, + NTTIME last_logon, + NTTIME last_logoff, + NTTIME last_password_change, + NTTIME acct_expiry, + NTTIME allow_password_change, + NTTIME force_password_change, + const char *account_name, + const char *full_name, + const char *home_directory, + const char *home_drive, + const char *logon_script, + const char *profile_path, + const char *description, + const char *workstations, + const char *comment, + struct lsa_BinaryString *parameters, + uint32_t rid, + uint32_t primary_gid, + uint32_t acct_flags, + uint32_t fields_present, + struct samr_LogonHours logon_hours, + uint16_t bad_password_count, + uint16_t logon_count, + uint16_t country_code, + uint16_t code_page, + uint8_t nt_password_set, + uint8_t lm_password_set, + uint8_t password_expired, + uint8_t data[516], + uint8_t pw_len); +void init_samr_user_info24(struct samr_UserInfo24 *r, + uint8_t data[516], + uint8_t pw_len); +void init_samr_CryptPasswordEx(const char *pwd, + DATA_BLOB *session_key, + struct samr_CryptPasswordEx *pwd_buf); +void init_samr_CryptPassword(const char *pwd, + DATA_BLOB *session_key, + struct samr_CryptPassword *pwd_buf); + +/* The following definitions come from rpc_client/init_srvsvc.c */ + +void init_srvsvc_NetSrvInfo102(struct srvsvc_NetSrvInfo102 *r, + enum srvsvc_PlatformId platform_id, + const char *server_name, + uint32_t version_major, + uint32_t version_minor, + uint32_t server_type, + const char *comment, + uint32_t users, + uint32_t disc, + uint32_t hidden, + uint32_t announce, + uint32_t anndelta, + uint32_t licenses, + const char *userpath); +void init_srvsvc_NetSrvInfo101(struct srvsvc_NetSrvInfo101 *r, + enum srvsvc_PlatformId platform_id, + const char *server_name, + uint32_t version_major, + uint32_t version_minor, + uint32_t server_type, + const char *comment); +void init_srvsvc_NetSrvInfo100(struct srvsvc_NetSrvInfo100 *r, + enum srvsvc_PlatformId platform_id, + const char *server_name); +void init_srvsvc_NetShareInfo0(struct srvsvc_NetShareInfo0 *r, + const char *name); +void init_srvsvc_NetShareInfo1(struct srvsvc_NetShareInfo1 *r, + const char *name, + enum srvsvc_ShareType type, + const char *comment); +void init_srvsvc_NetShareInfo2(struct srvsvc_NetShareInfo2 *r, + const char *name, + enum srvsvc_ShareType type, + const char *comment, + uint32_t permissions, + uint32_t max_users, + uint32_t current_users, + const char *path, + const char *password); +void init_srvsvc_NetShareInfo501(struct srvsvc_NetShareInfo501 *r, + const char *name, + enum srvsvc_ShareType type, + const char *comment, + uint32_t csc_policy); +void init_srvsvc_NetShareInfo502(struct srvsvc_NetShareInfo502 *r, + const char *name, + enum srvsvc_ShareType type, + const char *comment, + uint32_t permissions, + uint32_t max_users, + uint32_t current_users, + const char *path, + const char *password, + struct sec_desc_buf *sd_buf); +void init_srvsvc_NetShareInfo1004(struct srvsvc_NetShareInfo1004 *r, + const char *comment); +void init_srvsvc_NetShareInfo1005(struct srvsvc_NetShareInfo1005 *r, + uint32_t dfs_flags); +void init_srvsvc_NetShareInfo1006(struct srvsvc_NetShareInfo1006 *r, + uint32_t max_users); +void init_srvsvc_NetShareInfo1007(struct srvsvc_NetShareInfo1007 *r, + uint32_t flags, + const char *alternate_directory_name); +void init_srvsvc_NetRemoteTODInfo(struct srvsvc_NetRemoteTODInfo *r, + uint32_t elapsed, + uint32_t msecs, + uint32_t hours, + uint32_t mins, + uint32_t secs, + uint32_t hunds, + int32_t ttimezone, + uint32_t tinterval, + uint32_t day, + uint32_t month, + uint32_t year, + uint32_t weekday); +void init_srvsvc_NetSessInfo0(struct srvsvc_NetSessInfo0 *r, + const char *client); +void init_srvsvc_NetSessInfo1(struct srvsvc_NetSessInfo1 *r, + const char *client, + const char *user, + uint32_t num_open, + uint32_t _time, + uint32_t idle_time, + uint32_t user_flags); +void init_srvsvc_NetSessInfo2(struct srvsvc_NetSessInfo2 *r, + const char *client, + const char *user, + uint32_t num_open, + uint32_t _time, + uint32_t idle_time, + uint32_t user_flags, + const char *client_type); +void init_srvsvc_NetSessInfo10(struct srvsvc_NetSessInfo10 *r, + const char *client, + const char *user, + uint32_t _time, + uint32_t idle_time); +void init_srvsvc_NetSessInfo502(struct srvsvc_NetSessInfo502 *r, + const char *client, + const char *user, + uint32_t num_open, + uint32_t _time, + uint32_t idle_time, + uint32_t user_flags, + const char *client_type, + const char *transport); +void init_srvsvc_NetFileInfo2(struct srvsvc_NetFileInfo2 *r, + uint32_t fid); +void init_srvsvc_NetFileInfo3(struct srvsvc_NetFileInfo3 *r, + uint32_t fid, + uint32_t permissions, + uint32_t num_locks, + const char *path, + const char *user); +void init_srvsvc_NetConnInfo0(struct srvsvc_NetConnInfo0 *r, + uint32_t conn_id); +void init_srvsvc_NetConnInfo1(struct srvsvc_NetConnInfo1 *r, + uint32_t conn_id, + uint32_t conn_type, + uint32_t num_open, + uint32_t num_users, + uint32_t conn_time, + const char *user, + const char *share); + +/* The following definitions come from rpc_client/ndr.c */ + +NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const struct ndr_interface_table *table, + uint32 opnum, void *r); + +/* The following definitions come from rpc_parse/parse_buffer.c */ + +void rpcbuf_init(RPC_BUFFER *buffer, uint32 size, TALLOC_CTX *ctx); +bool prs_rpcbuffer(const char *desc, prs_struct *ps, int depth, RPC_BUFFER *buffer); +bool prs_rpcbuffer_p(const char *desc, prs_struct *ps, int depth, RPC_BUFFER **buffer); +bool rpcbuf_alloc_size(RPC_BUFFER *buffer, uint32 buffer_size); +void rpcbuf_move(RPC_BUFFER *src, RPC_BUFFER **dest); +uint32 rpcbuf_get_size(RPC_BUFFER *buffer); +bool smb_io_relstr(const char *desc, RPC_BUFFER *buffer, int depth, UNISTR *string); +bool smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 **string); +bool smb_io_relsecdesc(const char *desc, RPC_BUFFER *buffer, int depth, SEC_DESC **secdesc); +uint32 size_of_relative_string(UNISTR *string); + +/* The following definitions come from rpc_parse/parse_eventlog.c */ + +bool eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u, + prs_struct *ps, int depth); +bool eventlog_io_r_read_eventlog(const char *desc, + EVENTLOG_Q_READ_EVENTLOG *q_u, + EVENTLOG_R_READ_EVENTLOG *r_u, + prs_struct *ps, + int depth); + +/* The following definitions come from rpc_parse/parse_misc.c */ + +bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth); +bool smb_io_nttime(const char *desc, prs_struct *ps, int depth, NTTIME *nttime); +uint32 get_enum_hnd(ENUM_HND *enh); +void init_enum_hnd(ENUM_HND *enh, uint32 hnd); +bool smb_io_enum_hnd(const char *desc, ENUM_HND *hnd, prs_struct *ps, int depth); +bool smb_io_dom_sid(const char *desc, DOM_SID *sid, prs_struct *ps, int depth); +void init_dom_sid2(DOM_SID2 *sid2, const DOM_SID *sid); +bool smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **sid2); +bool smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth); +bool smb_io_uuid(const char *desc, struct GUID *uuid, + prs_struct *ps, int depth); +void init_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer); +bool smb_io_strhdr(const char *desc, STRHDR *hdr, prs_struct *ps, int depth); +void init_uni_hdr(UNIHDR *hdr, UNISTR2 *str2); +bool smb_io_unihdr(const char *desc, UNIHDR *hdr, prs_struct *ps, int depth); +void init_buf_hdr(BUFHDR *hdr, int max_len, int len); +bool smb_io_hdrbuf_pre(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset); +bool smb_io_hdrbuf_post(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth, + uint32 ptr_hdrbuf, uint32 max_len, uint32 len); +bool smb_io_hdrbuf(const char *desc, BUFHDR *hdr, prs_struct *ps, int depth); +void init_unistr(UNISTR *str, const char *buf); +bool smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth); +void init_rpc_blob_uint32(RPC_DATA_BLOB *str, uint32 val); +void init_rpc_blob_str(RPC_DATA_BLOB *str, const char *buf, int len); +void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf); +void init_rpc_blob_bytes(RPC_DATA_BLOB *str, uint8 *buf, size_t len); +bool smb_io_buffer5(const char *desc, BUFFER5 *buf5, prs_struct *ps, int depth); +void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len); +bool smb_io_regval_buffer(const char *desc, prs_struct *ps, int depth, REGVAL_BUFFER *buf2); +void init_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf); +void copy_unistr2(UNISTR2 *str, const UNISTR2 *from); +void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len); +bool smb_io_string2(const char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth); +void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags); +void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags); +void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf ); +void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf); +void init_unistr2_from_unistr(TALLOC_CTX *ctx, UNISTR2 *to, const UNISTR *from); +void init_unistr2_from_datablob(UNISTR2 *str, DATA_BLOB *blob) ; +bool prs_io_unistr2_p(const char *desc, prs_struct *ps, int depth, UNISTR2 **uni2); +bool prs_io_unistr2(const char *desc, prs_struct *ps, int depth, UNISTR2 *uni2 ); +bool smb_io_unistr2(const char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth); +bool prs_unistr4(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4); +bool prs_unistr4_hdr(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4); +bool prs_unistr4_str(const char *desc, prs_struct *ps, int depth, UNISTR4 *uni4); +bool prs_unistr4_array(const char *desc, prs_struct *ps, int depth, UNISTR4_ARRAY *array ); +bool init_unistr4_array( UNISTR4_ARRAY *array, uint32 count, const char **strings ); +void init_dom_rid(DOM_RID *prid, uint32 rid, uint16 type, uint32 idx); +bool smb_io_dom_rid(const char *desc, DOM_RID *rid, prs_struct *ps, int depth); +bool smb_io_dom_rid2(const char *desc, DOM_RID2 *rid, prs_struct *ps, int depth); +void init_dom_rid3(DOM_RID3 *rid3, uint32 rid, uint8 type); +bool smb_io_dom_rid3(const char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth); +void init_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid); +void init_clnt_srv(DOM_CLNT_SRV *logcln, const char *logon_srv, + const char *comp_name); +bool smb_io_clnt_srv(const char *desc, DOM_CLNT_SRV *logcln, prs_struct *ps, int depth); +void init_log_info(DOM_LOG_INFO *loginfo, const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name); +bool smb_io_log_info(const char *desc, DOM_LOG_INFO *loginfo, prs_struct *ps, int depth); +bool smb_io_chal(const char *desc, DOM_CHAL *chal, prs_struct *ps, int depth); +bool smb_io_cred(const char *desc, DOM_CRED *cred, prs_struct *ps, int depth); +void init_clnt_info2(DOM_CLNT_INFO2 *clnt, + const char *logon_srv, const char *comp_name, + const DOM_CRED *clnt_cred); +bool smb_io_clnt_info2(const char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth); +void init_clnt_info(DOM_CLNT_INFO *clnt, + const char *logon_srv, const char *acct_name, + uint16 sec_chan, const char *comp_name, + const DOM_CRED *cred); +bool smb_io_clnt_info(const char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth); +void init_logon_id(DOM_LOGON_ID *logonid, uint32 log_id_low, uint32 log_id_high); +bool smb_io_logon_id(const char *desc, DOM_LOGON_ID *logonid, prs_struct *ps, int depth); +void init_owf_info(OWF_INFO *hash, const uint8 data[16]); +bool smb_io_owf_info(const char *desc, OWF_INFO *hash, prs_struct *ps, int depth); +bool smb_io_gid(const char *desc, DOM_GID *gid, prs_struct *ps, int depth); +bool smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth); +void init_unistr3(UNISTR3 *str, const char *buf); +bool smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth); +bool prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64); +bool smb_io_bufhdr2(const char *desc, BUFHDR2 *hdr, prs_struct *ps, int depth); +bool smb_io_bufhdr4(const char *desc, BUFHDR4 *hdr, prs_struct *ps, int depth); +bool smb_io_rpc_blob(const char *desc, RPC_DATA_BLOB *blob, prs_struct *ps, int depth); +bool make_uni_hdr(UNIHDR *hdr, int len); +bool make_bufhdr2(BUFHDR2 *hdr, uint32 info_level, uint32 length, uint32 buffer); +uint32 str_len_uni(UNISTR *source); +bool policy_handle_is_valid(const POLICY_HND *hnd); + +/* The following definitions come from rpc_parse/parse_ntsvcs.c */ + +bool ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u, prs_struct *ps, int depth); +bool ntsvcs_io_r_get_device_list(const char *desc, NTSVCS_R_GET_DEVICE_LIST *r_u, prs_struct *ps, int depth); +bool ntsvcs_io_q_get_device_reg_property(const char *desc, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, prs_struct *ps, int depth); +bool ntsvcs_io_r_get_device_reg_property(const char *desc, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u, prs_struct *ps, int depth); + +/* The following definitions come from rpc_parse/parse_prs.c */ + +void prs_dump(const char *name, int v, prs_struct *ps); +void prs_dump_before(const char *name, int v, prs_struct *ps); +void prs_dump_region(const char *name, int v, prs_struct *ps, + int from_off, int to_off); +void prs_debug(prs_struct *ps, int depth, const char *desc, const char *fn_name); +bool prs_init(prs_struct *ps, uint32 size, TALLOC_CTX *ctx, bool io); +void prs_mem_free(prs_struct *ps); +void prs_mem_clear(prs_struct *ps); +char *prs_alloc_mem_(prs_struct *ps, size_t size, unsigned int count); +char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count); +TALLOC_CTX *prs_get_mem_context(prs_struct *ps); +void prs_give_memory(prs_struct *ps, char *buf, uint32 size, bool is_dynamic); +char *prs_take_memory(prs_struct *ps, uint32 *psize); +bool prs_set_buffer_size(prs_struct *ps, uint32 newsize); +bool prs_grow(prs_struct *ps, uint32 extra_space); +bool prs_force_grow(prs_struct *ps, uint32 extra_space); +char *prs_data_p(prs_struct *ps); +uint32 prs_data_size(prs_struct *ps); +uint32 prs_offset(prs_struct *ps); +bool prs_set_offset(prs_struct *ps, uint32 offset); +bool prs_append_prs_data(prs_struct *dst, prs_struct *src); +bool prs_append_some_data(prs_struct *dst, void *src_base, uint32_t start, + uint32_t len); +bool prs_append_some_prs_data(prs_struct *dst, prs_struct *src, int32 start, uint32 len); +bool prs_copy_data_in(prs_struct *dst, const char *src, uint32 len); +bool prs_copy_data_out(char *dst, prs_struct *src, uint32 len); +bool prs_copy_all_data_out(char *dst, prs_struct *src); +void prs_set_endian_data(prs_struct *ps, bool endian); +bool prs_align(prs_struct *ps); +bool prs_align_uint16(prs_struct *ps); +bool prs_align_uint64(prs_struct *ps); +bool prs_align_custom(prs_struct *ps, uint8 boundary); +bool prs_align_needed(prs_struct *ps, uint32 needed); +char *prs_mem_get(prs_struct *ps, uint32 extra_size); +void prs_switch_type(prs_struct *ps, bool io); +void prs_force_dynamic(prs_struct *ps); +void prs_set_session_key(prs_struct *ps, const char sess_key[16]); +bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8); +bool prs_pointer( const char *name, prs_struct *ps, int depth, + void *dta, size_t data_size, + bool (*prs_fn)(const char*, prs_struct*, int, void*) ); +bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16); +bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32); +bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32); +bool prs_ntstatus(const char *name, prs_struct *ps, int depth, NTSTATUS *status); +bool prs_dcerpc_status(const char *name, prs_struct *ps, int depth, NTSTATUS *status); +bool prs_werror(const char *name, prs_struct *ps, int depth, WERROR *status); +bool prs_uint8s(bool charmode, const char *name, prs_struct *ps, int depth, uint8 *data8s, int len); +bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len); +bool prs_uint16uni(bool charmode, const char *name, prs_struct *ps, int depth, uint16 *data16s, int len); +bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uint32 *data32s, int len); +bool prs_buffer5(bool charmode, const char *name, prs_struct *ps, int depth, BUFFER5 *str); +bool prs_regval_buffer(bool charmode, const char *name, prs_struct *ps, int depth, REGVAL_BUFFER *buf); +bool prs_string2(bool charmode, const char *name, prs_struct *ps, int depth, STRING2 *str); +bool prs_unistr2(bool charmode, const char *name, prs_struct *ps, int depth, UNISTR2 *str); +bool prs_unistr3(bool charmode, const char *name, UNISTR3 *str, prs_struct *ps, int depth); +bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str); +bool prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_buf_size); +bool prs_string_alloc(const char *name, prs_struct *ps, int depth, const char **str); +bool prs_uint16_pre(const char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset); +bool prs_uint16_post(const char *name, prs_struct *ps, int depth, uint16 *data16, + uint32 ptr_uint16, uint32 start_offset); +bool prs_uint32_pre(const char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset); +bool prs_uint32_post(const char *name, prs_struct *ps, int depth, uint32 *data32, + uint32 ptr_uint32, uint32 data_size); +int tdb_prs_store(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps); +int tdb_prs_fetch(TDB_CONTEXT *tdb, TDB_DATA kbuf, prs_struct *ps, TALLOC_CTX *mem_ctx); +bool prs_hash1(prs_struct *ps, uint32 offset, int len); +void schannel_encode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level, + enum schannel_direction direction, + RPC_AUTH_SCHANNEL_CHK * verf, + char *data, size_t data_len); +bool schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_level, + enum schannel_direction direction, + RPC_AUTH_SCHANNEL_CHK * verf, char *data, size_t data_len); +bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx); +bool prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx); + +/* The following definitions come from rpc_parse/parse_rpc.c */ + +const char *cli_get_pipe_name_from_iface(TALLOC_CTX *mem_ctx, + struct cli_state *cli, + const struct ndr_syntax_id *interface); +void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, + uint32 call_id, int data_len, int auth_len); +bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth); +void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, + const RPC_IFACE *abstract, const RPC_IFACE *transfer); +void init_rpc_hdr_rb(RPC_HDR_RB *rpc, + uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, + RPC_CONTEXT *context); +bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth); +bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth); +void init_rpc_hdr_ba(RPC_HDR_BA *rpc, + uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, + const char *pipe_addr, + uint8 num_results, uint16 result, uint16 reason, + RPC_IFACE *transfer); +bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth); +void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum); +bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth); +bool smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth); +bool smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth); +void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, + uint8 auth_type, uint8 auth_level, + uint8 auth_pad_len, + uint32 auth_context_id); +bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth); +bool rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, + const char *signature, uint32 msg_type); +void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, + const char *signature, uint32 msg_type); +bool smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth); +bool smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth); +void init_rpc_auth_schannel_neg(RPC_AUTH_SCHANNEL_NEG *neg, + const char *domain, const char *myname); +bool smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, + prs_struct *ps, int depth); +bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, + RPC_AUTH_SCHANNEL_CHK * chk, + prs_struct *ps, int depth); + +/* The following definitions come from rpc_parse/parse_sec.c */ + +bool sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth); +bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int depth); + +/* The following definitions come from rpc_parse/parse_spoolss.c */ + +bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime); +bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime); +bool smb_io_notify_info_data_strings(const char *desc,SPOOL_NOTIFY_INFO_DATA *data, + prs_struct *ps, int depth); +bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u ); +bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode); +bool make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX *q_u, + const fstring printername, + const fstring datatype, + uint32 access_required, + const fstring clientname, + const fstring user_name); +bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u, + const char *srv_name, const char* clientname, const char* user_name, + uint32 level, PRINTER_INFO_CTR *ctr); +bool make_spoolss_printer_info_2(TALLOC_CTX *ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2, + PRINTER_INFO_2 *info); +bool make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 **spool_info3, + PRINTER_INFO_3 *info); +bool make_spoolss_printer_info_7(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_7 **spool_info7, + PRINTER_INFO_7 *info); +bool spoolss_io_q_open_printer(const char *desc, SPOOL_Q_OPEN_PRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_open_printer(const char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_open_printer_ex(const char *desc, SPOOL_Q_OPEN_PRINTER_EX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_open_printer_ex(const char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx, + SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, + const char *server, + const char* arch, + const char* driver, + int version); +bool make_spoolss_q_deleteprinterdriver( + TALLOC_CTX *mem_ctx, + SPOOL_Q_DELETEPRINTERDRIVER *q_u, + const char *server, + const char* arch, + const char* driver +); +bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u, + const POLICY_HND *handle, + const char *valuename, uint32 size); +bool make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX *q_u, + const POLICY_HND *handle, + const char *keyname, + const char *valuename, uint32 size); +bool spoolss_io_q_getprinterdata(const char *desc, SPOOL_Q_GETPRINTERDATA *q_u, prs_struct *ps, int depth); +bool spoolss_io_q_deleteprinterdata(const char *desc, SPOOL_Q_DELETEPRINTERDATA *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_deleteprinterdata(const char *desc, SPOOL_R_DELETEPRINTERDATA *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_deleteprinterdataex(const char *desc, SPOOL_Q_DELETEPRINTERDATAEX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_deleteprinterdataex(const char *desc, SPOOL_R_DELETEPRINTERDATAEX *r_u, prs_struct *ps, int depth); +bool spoolss_io_r_getprinterdata(const char *desc, SPOOL_R_GETPRINTERDATA *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER *q_u, POLICY_HND *hnd); +bool spoolss_io_q_abortprinter(const char *desc, SPOOL_Q_ABORTPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_abortprinter(const char *desc, SPOOL_R_ABORTPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_deleteprinter(const char *desc, SPOOL_Q_DELETEPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_deleteprinter(const char *desc, SPOOL_R_DELETEPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_deleteprinterdriver(const char *desc, SPOOL_Q_DELETEPRINTERDRIVER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_deleteprinterdriver(const char *desc, SPOOL_R_DELETEPRINTERDRIVER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_deleteprinterdriverex(const char *desc, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_deleteprinterdriverex(const char *desc, SPOOL_R_DELETEPRINTERDRIVEREX *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_closeprinter(const char *desc, SPOOL_Q_CLOSEPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_closeprinter(const char *desc, SPOOL_R_CLOSEPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_startdocprinter(const char *desc, SPOOL_Q_STARTDOCPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_startdocprinter(const char *desc, SPOOL_R_STARTDOCPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_enddocprinter(const char *desc, SPOOL_Q_ENDDOCPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_enddocprinter(const char *desc, SPOOL_R_ENDDOCPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_startpageprinter(const char *desc, SPOOL_Q_STARTPAGEPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_startpageprinter(const char *desc, SPOOL_R_STARTPAGEPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_endpageprinter(const char *desc, SPOOL_Q_ENDPAGEPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_endpageprinter(const char *desc, SPOOL_R_ENDPAGEPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_writeprinter(const char *desc, SPOOL_Q_WRITEPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_writeprinter(const char *desc, SPOOL_R_WRITEPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_rffpcnex(const char *desc, SPOOL_Q_RFFPCNEX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_rffpcnex(const char *desc, SPOOL_R_RFFPCNEX *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_rfnpcnex(const char *desc, SPOOL_Q_RFNPCNEX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_rfnpcnex(const char *desc, SPOOL_R_RFNPCNEX *r_u, prs_struct *ps, int depth); +bool smb_io_printer_info_0(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_0 *info, int depth); +bool smb_io_printer_info_1(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_1 *info, int depth); +bool smb_io_printer_info_2(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_2 *info, int depth); +bool smb_io_printer_info_3(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_3 *info, int depth); +bool smb_io_printer_info_4(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_4 *info, int depth); +bool smb_io_printer_info_5(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_5 *info, int depth); +bool smb_io_printer_info_6(const char *desc, RPC_BUFFER *buffer, + PRINTER_INFO_6 *info, int depth); +bool smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7 *info, int depth); +bool smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth); +bool smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth); +bool smb_io_printer_driver_info_1(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_1 *info, int depth) ; +bool smb_io_printer_driver_info_2(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_2 *info, int depth) ; +bool smb_io_printer_driver_info_3(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_3 *info, int depth); +bool smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_INFO_6 *info, int depth); +bool smb_io_job_info_1(const char *desc, RPC_BUFFER *buffer, JOB_INFO_1 *info, int depth); +bool smb_io_job_info_2(const char *desc, RPC_BUFFER *buffer, JOB_INFO_2 *info, int depth); +bool smb_io_form_1(const char *desc, RPC_BUFFER *buffer, FORM_1 *info, int depth); +bool smb_io_driverdir_1(const char *desc, RPC_BUFFER *buffer, DRIVER_DIRECTORY_1 *info, int depth); +bool smb_io_port_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth); +bool smb_io_port_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth); +bool smb_io_printprocessor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_1 *info, int depth); +bool smb_io_printprocdatatype_info_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCDATATYPE_1 *info, int depth); +bool smb_io_printmonitor_info_1(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_1 *info, int depth); +bool smb_io_printmonitor_info_2(const char *desc, RPC_BUFFER *buffer, PRINTMONITOR_2 *info, int depth); +uint32 spoolss_size_printer_info_0(PRINTER_INFO_0 *info); +uint32 spoolss_size_printer_info_1(PRINTER_INFO_1 *info); +uint32 spoolss_size_printer_info_2(PRINTER_INFO_2 *info); +uint32 spoolss_size_printer_info_4(PRINTER_INFO_4 *info); +uint32 spoolss_size_printer_info_5(PRINTER_INFO_5 *info); +uint32 spoolss_size_printer_info_6(PRINTER_INFO_6 *info); +uint32 spoolss_size_printer_info_3(PRINTER_INFO_3 *info); +uint32 spoolss_size_printer_info_7(PRINTER_INFO_7 *info); +uint32 spoolss_size_printer_driver_info_1(DRIVER_INFO_1 *info); +uint32 spoolss_size_printer_driver_info_2(DRIVER_INFO_2 *info); +uint32 spoolss_size_string_array(uint16 *string); +uint32 spoolss_size_printer_driver_info_3(DRIVER_INFO_3 *info); +uint32 spoolss_size_printer_driver_info_6(DRIVER_INFO_6 *info); +uint32 spoolss_size_job_info_1(JOB_INFO_1 *info); +uint32 spoolss_size_job_info_2(JOB_INFO_2 *info); +uint32 spoolss_size_form_1(FORM_1 *info); +uint32 spoolss_size_port_info_1(PORT_INFO_1 *info); +uint32 spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1 *info); +uint32 spoolss_size_printprocessordirectory_info_1(PRINTPROCESSOR_DIRECTORY_1 *info); +uint32 spoolss_size_port_info_2(PORT_INFO_2 *info); +uint32 spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1 *info); +uint32 spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1 *info); +uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p); +uint32 spoolss_size_printmonitor_info_1(PRINTMONITOR_1 *info); +uint32 spoolss_size_printmonitor_info_2(PRINTMONITOR_2 *info); +bool make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2 *q_u, + const POLICY_HND *hnd, + const fstring architecture, + uint32 level, uint32 clientmajor, uint32 clientminor, + RPC_BUFFER *buffer, uint32 offered); +bool spoolss_io_q_getprinterdriver2(const char *desc, SPOOL_Q_GETPRINTERDRIVER2 *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_getprinterdriver2(const char *desc, SPOOL_R_GETPRINTERDRIVER2 *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_enumprinters( + SPOOL_Q_ENUMPRINTERS *q_u, + uint32 flags, + char *servername, + uint32 level, + RPC_BUFFER *buffer, + uint32 offered +); +bool make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u, + fstring servername, uint32 level, + RPC_BUFFER *buffer, uint32 offered); +bool spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth); +bool spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_getprinter(const char *desc, SPOOL_Q_GETPRINTER *q_u, prs_struct *ps, int depth); +bool make_spoolss_q_getprinter( + TALLOC_CTX *mem_ctx, + SPOOL_Q_GETPRINTER *q_u, + const POLICY_HND *hnd, + uint32 level, + RPC_BUFFER *buffer, + uint32 offered +); +bool make_spoolss_q_setprinter(TALLOC_CTX *mem_ctx, SPOOL_Q_SETPRINTER *q_u, + const POLICY_HND *hnd, uint32 level, PRINTER_INFO_CTR *info, + uint32 command); +bool spoolss_io_r_setprinter(const char *desc, SPOOL_R_SETPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_setprinter(const char *desc, SPOOL_Q_SETPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_fcpn(const char *desc, SPOOL_R_FCPN *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_fcpn(const char *desc, SPOOL_Q_FCPN *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_addjob(const char *desc, SPOOL_R_ADDJOB *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_addjob(const char *desc, SPOOL_Q_ADDJOB *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumjobs(const char *desc, SPOOL_R_ENUMJOBS *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS *q_u, const POLICY_HND *hnd, + uint32 firstjob, + uint32 numofjobs, + uint32 level, + RPC_BUFFER *buffer, + uint32 offered); +bool spoolss_io_q_enumjobs(const char *desc, SPOOL_Q_ENUMJOBS *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_schedulejob(const char *desc, SPOOL_R_SCHEDULEJOB *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_schedulejob(const char *desc, SPOOL_Q_SCHEDULEJOB *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_setjob(const char *desc, SPOOL_R_SETJOB *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_setjob(const char *desc, SPOOL_Q_SETJOB *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumprinterdrivers(const char *desc, SPOOL_R_ENUMPRINTERDRIVERS *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u, + const char *name, + const char *environment, + uint32 level, + RPC_BUFFER *buffer, uint32 offered); +bool spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth); +bool spoolss_io_q_enumforms(const char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumforms(const char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_getform(const char *desc, SPOOL_Q_GETFORM *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_getform(const char *desc, SPOOL_R_GETFORM *r_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth); +bool spool_io_printer_info_level_1(const char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth); +bool spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3 *il, prs_struct *ps, int depth); +bool spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth); +bool spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth); +bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth); +bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u, + prs_struct *ps, int depth); +bool spool_io_printer_driver_info_level_3(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **q_u, + prs_struct *ps, int depth); +bool spool_io_printer_driver_info_level_6(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 **q_u, + prs_struct *ps, int depth); +bool smb_io_unibuffer(const char *desc, UNISTR2 *buffer, prs_struct *ps, int depth); +bool spool_io_printer_driver_info_level(const char *desc, SPOOL_PRINTER_DRIVER_INFO_LEVEL *il, prs_struct *ps, int depth); +bool make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx, + SPOOL_Q_ADDPRINTERDRIVER *q_u, const char* srv_name, + uint32 level, PRINTER_DRIVER_CTR *info); +bool make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx, + SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info, + DRIVER_INFO_3 *info3); +bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src); +bool spoolss_io_q_addprinterdriver(const char *desc, SPOOL_Q_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_addprinterdriver(const char *desc, SPOOL_R_ADDPRINTERDRIVER *q_u, prs_struct *ps, int depth); +bool spoolss_io_q_addprinterdriverex(const char *desc, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_addprinterdriverex(const char *desc, SPOOL_R_ADDPRINTERDRIVEREX *q_u, prs_struct *ps, int depth); +bool uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *uni, + NT_PRINTER_DRIVER_INFO_LEVEL_3 **asc); +bool uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *uni, + NT_PRINTER_DRIVER_INFO_LEVEL_6 **asc); +bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni, + NT_PRINTER_INFO_LEVEL_2 *d); +bool make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR *q_u, + fstring servername, fstring env_name, uint32 level, + RPC_BUFFER *buffer, uint32 offered); +bool spoolss_io_q_getprinterdriverdir(const char *desc, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_getprinterdriverdir(const char *desc, SPOOL_R_GETPRINTERDRIVERDIR *r_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumprintprocessors(const char *desc, SPOOL_R_ENUMPRINTPROCESSORS *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_enumprintprocessors(const char *desc, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, prs_struct *ps, int depth); +bool spoolss_io_q_addprintprocessor(const char *desc, SPOOL_Q_ADDPRINTPROCESSOR *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_addprintprocessor(const char *desc, SPOOL_R_ADDPRINTPROCESSOR *r_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumprintprocdatatypes(const char *desc, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_enumprintprocdatatypes(const char *desc, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, prs_struct *ps, int depth); +bool spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth); +bool make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u, + const POLICY_HND *hnd, + uint32 idx, uint32 valuelen, uint32 datalen); +bool make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u, + const POLICY_HND *hnd, const char *key, + uint32 size); +bool make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA *q_u, const POLICY_HND *hnd, + char* value, uint32 data_type, char* data, uint32 data_size); +bool make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX *q_u, const POLICY_HND *hnd, + char *key, char* value, uint32 data_type, char* data, + uint32 data_size); +bool spoolss_io_q_setprinterdata(const char *desc, SPOOL_Q_SETPRINTERDATA *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_setprinterdata(const char *desc, SPOOL_R_SETPRINTERDATA *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_resetprinter(const char *desc, SPOOL_Q_RESETPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_resetprinter(const char *desc, SPOOL_R_RESETPRINTER *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_deleteform(const char *desc, SPOOL_Q_DELETEFORM *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_deleteform(const char *desc, SPOOL_R_DELETEFORM *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_addform(const char *desc, SPOOL_Q_ADDFORM *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_addform(const char *desc, SPOOL_R_ADDFORM *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_setform(const char *desc, SPOOL_Q_SETFORM *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_setform(const char *desc, SPOOL_R_SETFORM *r_u, prs_struct *ps, int depth); +bool spoolss_io_r_getjob(const char *desc, SPOOL_R_GETJOB *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_getjob(const char *desc, SPOOL_Q_GETJOB *q_u, prs_struct *ps, int depth); +void free_devmode(DEVICEMODE *devmode); +void free_printer_info_1(PRINTER_INFO_1 *printer); +void free_printer_info_2(PRINTER_INFO_2 *printer); +void free_printer_info_3(PRINTER_INFO_3 *printer); +void free_printer_info_4(PRINTER_INFO_4 *printer); +void free_printer_info_5(PRINTER_INFO_5 *printer); +void free_printer_info_6(PRINTER_INFO_6 *printer); +void free_printer_info_7(PRINTER_INFO_7 *printer); +void free_job_info_2(JOB_INFO_2 *job); +bool make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER *q_u, + const fstring string, uint32 printer, uint32 type); +bool spoolss_io_q_replyopenprinter(const char *desc, SPOOL_Q_REPLYOPENPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_replyopenprinter(const char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER *q_u, POLICY_HND *hnd, + uint32 condition, uint32 change_id); +bool spoolss_io_q_routerreplyprinter (const char *desc, SPOOL_Q_ROUTERREPLYPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_routerreplyprinter (const char *desc, SPOOL_R_ROUTERREPLYPRINTER *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HND *hnd); +bool spoolss_io_q_replycloseprinter(const char *desc, SPOOL_Q_REPLYCLOSEPRINTER *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_replycloseprinter(const char *desc, SPOOL_R_REPLYCLOSEPRINTER *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN *q_u, POLICY_HND *hnd, + uint32 change_low, uint32 change_high, + SPOOL_NOTIFY_INFO *info); +bool spoolss_io_q_reply_rrpcn(const char *desc, SPOOL_Q_REPLY_RRPCN *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_reply_rrpcn(const char *desc, SPOOL_R_REPLY_RRPCN *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_getprinterdataex(const char *desc, SPOOL_Q_GETPRINTERDATAEX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_getprinterdataex(const char *desc, SPOOL_R_GETPRINTERDATAEX *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_setprinterdataex(const char *desc, SPOOL_Q_SETPRINTERDATAEX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_setprinterdataex(const char *desc, SPOOL_R_SETPRINTERDATAEX *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY *q_u, + POLICY_HND *hnd, const char *key, + uint32 size); +bool spoolss_io_q_enumprinterkey(const char *desc, SPOOL_Q_ENUMPRINTERKEY *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumprinterkey(const char *desc, SPOOL_R_ENUMPRINTERKEY *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY *q_u, + POLICY_HND *hnd, char *keyname); +bool spoolss_io_q_deleteprinterkey(const char *desc, SPOOL_Q_DELETEPRINTERKEY *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_deleteprinterkey(const char *desc, SPOOL_R_DELETEPRINTERKEY *r_u, prs_struct *ps, int depth); +bool spoolss_io_q_enumprinterdataex(const char *desc, SPOOL_Q_ENUMPRINTERDATAEX *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_enumprinterdataex(const char *desc, SPOOL_R_ENUMPRINTERDATAEX *r_u, prs_struct *ps, int depth); +bool make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, const char *name, char *environment, int level, RPC_BUFFER *buffer, uint32 offered); +bool spoolss_io_q_getprintprocessordirectory(const char *desc, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_getprintprocessordirectory(const char *desc, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u, prs_struct *ps, int depth); +bool smb_io_printprocessordirectory_1(const char *desc, RPC_BUFFER *buffer, PRINTPROCESSOR_DIRECTORY_1 *info, int depth); +bool make_spoolss_q_addform(SPOOL_Q_ADDFORM *q_u, POLICY_HND *handle, + int level, FORM *form); +bool make_spoolss_q_setform(SPOOL_Q_SETFORM *q_u, POLICY_HND *handle, + int level, const char *form_name, FORM *form); +bool make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM *q_u, POLICY_HND *handle, + const char *form); +bool make_spoolss_q_getform(SPOOL_Q_GETFORM *q_u, POLICY_HND *handle, + const char *formname, uint32 level, + RPC_BUFFER *buffer, uint32 offered); +bool make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS *q_u, POLICY_HND *handle, + uint32 level, RPC_BUFFER *buffer, + uint32 offered); +bool make_spoolss_q_setjob(SPOOL_Q_SETJOB *q_u, POLICY_HND *handle, + uint32 jobid, uint32 level, uint32 command); +bool make_spoolss_q_getjob(SPOOL_Q_GETJOB *q_u, POLICY_HND *handle, + uint32 jobid, uint32 level, RPC_BUFFER *buffer, + uint32 offered); +bool make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER *q_u, + POLICY_HND *handle); +bool make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER *q_u, + POLICY_HND *handle); +bool make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER *q_u, + POLICY_HND *handle, uint32 level, + char *docname, char *outputfile, + char *datatype); +bool make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER *q_u, + POLICY_HND *handle); +bool make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER *q_u, + POLICY_HND *handle, uint32 data_size, + char *data); +bool make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u, + POLICY_HND *handle, char *valuename); +bool make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX *q_u, + POLICY_HND *handle, char *key, + char *value); +bool make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX *q_u, POLICY_HND *handle, + uint32 flags, uint32 options, const char *localmachine, + uint32 printerlocal, SPOOL_NOTIFY_OPTION *option); +bool spoolss_io_q_xcvdataport(const char *desc, SPOOL_Q_XCVDATAPORT *q_u, prs_struct *ps, int depth); +bool spoolss_io_r_xcvdataport(const char *desc, SPOOL_R_XCVDATAPORT *r_u, prs_struct *ps, int depth); +bool make_monitorui_buf( RPC_BUFFER *buf, const char *dllname ); +bool convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) ; + +/* The following definitions come from rpc_parse/parse_svcctl.c */ + +bool svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth ); +bool svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth ); +uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status ); +uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config ); +bool svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, prs_struct *ps, int depth); +bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth); +bool svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth); +bool svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth); +bool svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth); +void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *service_desc ); +bool svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth ); +uint32 svcctl_sizeof_service_description( SERVICE_DESCRIPTION *desc ); +bool svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BUFFER *buffer, int depth ); +uint32 svcctl_sizeof_service_fa( SERVICE_FAILURE_ACTIONS *fa); +bool svcctl_io_r_query_service_config2(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u, prs_struct *ps, int depth); +bool svcctl_io_q_query_service_status_ex(const char *desc, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, prs_struct *ps, int depth); +bool svcctl_io_r_query_service_status_ex(const char *desc, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u, prs_struct *ps, int depth); + +/* The following definitions come from rpc_server/srv_dfs_nt.c */ + +void _dfs_GetManagerVersion(pipes_struct *p, struct dfs_GetManagerVersion *r); +WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r); +WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r); +WERROR _dfs_Enum(pipes_struct *p, struct dfs_Enum *r); +WERROR _dfs_GetInfo(pipes_struct *p, struct dfs_GetInfo *r); +WERROR _dfs_SetInfo(pipes_struct *p, struct dfs_SetInfo *r); +WERROR _dfs_Rename(pipes_struct *p, struct dfs_Rename *r); +WERROR _dfs_Move(pipes_struct *p, struct dfs_Move *r); +WERROR _dfs_ManagerGetConfigInfo(pipes_struct *p, struct dfs_ManagerGetConfigInfo *r); +WERROR _dfs_ManagerSendSiteInfo(pipes_struct *p, struct dfs_ManagerSendSiteInfo *r); +WERROR _dfs_AddFtRoot(pipes_struct *p, struct dfs_AddFtRoot *r); +WERROR _dfs_RemoveFtRoot(pipes_struct *p, struct dfs_RemoveFtRoot *r); +WERROR _dfs_AddStdRoot(pipes_struct *p, struct dfs_AddStdRoot *r); +WERROR _dfs_RemoveStdRoot(pipes_struct *p, struct dfs_RemoveStdRoot *r); +WERROR _dfs_ManagerInitialize(pipes_struct *p, struct dfs_ManagerInitialize *r); +WERROR _dfs_AddStdRootForced(pipes_struct *p, struct dfs_AddStdRootForced *r); +WERROR _dfs_GetDcAddress(pipes_struct *p, struct dfs_GetDcAddress *r); +WERROR _dfs_SetDcAddress(pipes_struct *p, struct dfs_SetDcAddress *r); +WERROR _dfs_FlushFtTable(pipes_struct *p, struct dfs_FlushFtTable *r); +WERROR _dfs_Add2(pipes_struct *p, struct dfs_Add2 *r); +WERROR _dfs_Remove2(pipes_struct *p, struct dfs_Remove2 *r); +WERROR _dfs_EnumEx(pipes_struct *p, struct dfs_EnumEx *r); +WERROR _dfs_SetInfo2(pipes_struct *p, struct dfs_SetInfo2 *r); + +/* The following definitions come from rpc_server/srv_dssetup_nt.c */ + +WERROR _dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p, + struct dssetup_DsRoleGetPrimaryDomainInformation *r); +WERROR _dssetup_DsRoleDnsNameToFlatName(pipes_struct *p, + struct dssetup_DsRoleDnsNameToFlatName *r); +WERROR _dssetup_DsRoleDcAsDc(pipes_struct *p, + struct dssetup_DsRoleDcAsDc *r); +WERROR _dssetup_DsRoleDcAsReplica(pipes_struct *p, + struct dssetup_DsRoleDcAsReplica *r); +WERROR _dssetup_DsRoleDemoteDc(pipes_struct *p, + struct dssetup_DsRoleDemoteDc *r); +WERROR _dssetup_DsRoleGetDcOperationProgress(pipes_struct *p, + struct dssetup_DsRoleGetDcOperationProgress *r); +WERROR _dssetup_DsRoleGetDcOperationResults(pipes_struct *p, + struct dssetup_DsRoleGetDcOperationResults *r); +WERROR _dssetup_DsRoleCancel(pipes_struct *p, + struct dssetup_DsRoleCancel *r); +WERROR _dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p, + struct dssetup_DsRoleServerSaveStateForUpgrade *r); +WERROR _dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p, + struct dssetup_DsRoleUpgradeDownlevelServer *r); +WERROR _dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p, + struct dssetup_DsRoleAbortDownlevelServerUpgrade *r); + +/* The following definitions come from rpc_server/srv_echo_nt.c */ + +void _echo_AddOne(pipes_struct *p, struct echo_AddOne *r ); +void _echo_EchoData(pipes_struct *p, struct echo_EchoData *r); +void _echo_SinkData(pipes_struct *p, struct echo_SinkData *r); +void _echo_SourceData(pipes_struct *p, struct echo_SourceData *r); +void _echo_TestCall(pipes_struct *p, struct echo_TestCall *r); +NTSTATUS _echo_TestCall2(pipes_struct *p, struct echo_TestCall2 *r); +uint32 _echo_TestSleep(pipes_struct *p, struct echo_TestSleep *r); +void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r); +void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r); +uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r); + +/* The following definitions come from rpc_server/srv_eventlog.c */ + +NTSTATUS rpc_eventlog2_init(void); +void eventlog2_get_pipe_fns(struct api_struct **fns, int *n_fns); + +/* The following definitions come from rpc_server/srv_eventlog_lib.c */ + +TDB_CONTEXT *elog_init_tdb( char *tdbfilename ); +char *elog_tdbname(TALLOC_CTX *ctx, const char *name ); +int elog_tdb_size( TDB_CONTEXT * tdb, int *MaxSize, int *Retention ); +bool prune_eventlog( TDB_CONTEXT * tdb ); +bool can_write_to_eventlog( TDB_CONTEXT * tdb, int32 needed ); +ELOG_TDB *elog_open_tdb( char *logname, bool force_clear ); +int elog_close_tdb( ELOG_TDB *etdb, bool force_close ); +int write_eventlog_tdb( TDB_CONTEXT * the_tdb, Eventlog_entry * ee ); +void fixup_eventlog_entry( Eventlog_entry * ee ); +bool parse_logentry( char *line, Eventlog_entry * entry, bool * eor ); + +/* The following definitions come from rpc_server/srv_eventlog_nt.c */ + +NTSTATUS _eventlog_OpenEventLogW(pipes_struct *p, + struct eventlog_OpenEventLogW *r); +NTSTATUS _eventlog_ClearEventLogW(pipes_struct *p, + struct eventlog_ClearEventLogW *r); +NTSTATUS _eventlog_CloseEventLog( pipes_struct * p, struct eventlog_CloseEventLog *r ); +NTSTATUS _eventlog_read_eventlog( pipes_struct * p, + EVENTLOG_Q_READ_EVENTLOG * q_u, + EVENTLOG_R_READ_EVENTLOG * r_u ); +NTSTATUS _eventlog_GetOldestRecord(pipes_struct *p, + struct eventlog_GetOldestRecord *r); +NTSTATUS _eventlog_GetNumRecords(pipes_struct *p, + struct eventlog_GetNumRecords *r); +NTSTATUS _eventlog_BackupEventLogW(pipes_struct *p, struct eventlog_BackupEventLogW *r); +NTSTATUS _eventlog_DeregisterEventSource(pipes_struct *p, struct eventlog_DeregisterEventSource *r); +NTSTATUS _eventlog_ChangeNotify(pipes_struct *p, struct eventlog_ChangeNotify *r); +NTSTATUS _eventlog_RegisterEventSourceW(pipes_struct *p, struct eventlog_RegisterEventSourceW *r); +NTSTATUS _eventlog_OpenBackupEventLogW(pipes_struct *p, struct eventlog_OpenBackupEventLogW *r); +NTSTATUS _eventlog_ReadEventLogW(pipes_struct *p, struct eventlog_ReadEventLogW *r); +NTSTATUS _eventlog_ReportEventW(pipes_struct *p, struct eventlog_ReportEventW *r); +NTSTATUS _eventlog_ClearEventLogA(pipes_struct *p, struct eventlog_ClearEventLogA *r); +NTSTATUS _eventlog_BackupEventLogA(pipes_struct *p, struct eventlog_BackupEventLogA *r); +NTSTATUS _eventlog_OpenEventLogA(pipes_struct *p, struct eventlog_OpenEventLogA *r); +NTSTATUS _eventlog_RegisterEventSourceA(pipes_struct *p, struct eventlog_RegisterEventSourceA *r); +NTSTATUS _eventlog_OpenBackupEventLogA(pipes_struct *p, struct eventlog_OpenBackupEventLogA *r); +NTSTATUS _eventlog_ReadEventLogA(pipes_struct *p, struct eventlog_ReadEventLogA *r); +NTSTATUS _eventlog_ReportEventA(pipes_struct *p, struct eventlog_ReportEventA *r); +NTSTATUS _eventlog_RegisterClusterSvc(pipes_struct *p, struct eventlog_RegisterClusterSvc *r); +NTSTATUS _eventlog_DeregisterClusterSvc(pipes_struct *p, struct eventlog_DeregisterClusterSvc *r); +NTSTATUS _eventlog_WriteClusterEvents(pipes_struct *p, struct eventlog_WriteClusterEvents *r); +NTSTATUS _eventlog_GetLogIntormation(pipes_struct *p, struct eventlog_GetLogIntormation *r); +NTSTATUS _eventlog_FlushEventLog(pipes_struct *p, struct eventlog_FlushEventLog *r); + +/* The following definitions come from rpc_server/srv_initshutdown_nt.c */ + +WERROR _initshutdown_Init(pipes_struct *p, struct initshutdown_Init *r); +WERROR _initshutdown_InitEx(pipes_struct *p, struct initshutdown_InitEx *r); +WERROR _initshutdown_Abort(pipes_struct *p, struct initshutdown_Abort *r); + +/* The following definitions come from rpc_server/srv_lsa_hnd.c */ + +bool init_pipe_handle_list(pipes_struct *p, const char *pipe_name); +bool create_policy_hnd(pipes_struct *p, POLICY_HND *hnd, void (*free_fn)(void *), void *data_ptr); +bool find_policy_by_hnd(pipes_struct *p, POLICY_HND *hnd, void **data_p); +bool close_policy_hnd(pipes_struct *p, POLICY_HND *hnd); +void close_policy_by_pipe(pipes_struct *p); +bool pipe_access_check(pipes_struct *p); + +/* The following definitions come from rpc_server/srv_lsa_nt.c */ + +NTSTATUS _lsa_OpenPolicy2(pipes_struct *p, + struct lsa_OpenPolicy2 *r); +NTSTATUS _lsa_OpenPolicy(pipes_struct *p, + struct lsa_OpenPolicy *r); +NTSTATUS _lsa_EnumTrustDom(pipes_struct *p, + struct lsa_EnumTrustDom *r); +NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p, + struct lsa_QueryInfoPolicy *r); +NTSTATUS _lsa_LookupSids(pipes_struct *p, + struct lsa_LookupSids *r); +NTSTATUS _lsa_LookupSids2(pipes_struct *p, + struct lsa_LookupSids2 *r); +NTSTATUS _lsa_LookupSids3(pipes_struct *p, + struct lsa_LookupSids3 *r); +NTSTATUS _lsa_LookupNames(pipes_struct *p, + struct lsa_LookupNames *r); +NTSTATUS _lsa_LookupNames2(pipes_struct *p, + struct lsa_LookupNames2 *r); +NTSTATUS _lsa_LookupNames3(pipes_struct *p, + struct lsa_LookupNames3 *r); +NTSTATUS _lsa_LookupNames4(pipes_struct *p, + struct lsa_LookupNames4 *r); +NTSTATUS _lsa_Close(pipes_struct *p, struct lsa_Close *r); +NTSTATUS _lsa_OpenSecret(pipes_struct *p, struct lsa_OpenSecret *r); +NTSTATUS _lsa_OpenTrustedDomain(pipes_struct *p, struct lsa_OpenTrustedDomain *r); +NTSTATUS _lsa_CreateTrustedDomain(pipes_struct *p, struct lsa_CreateTrustedDomain *r); +NTSTATUS _lsa_CreateSecret(pipes_struct *p, struct lsa_CreateSecret *r); +NTSTATUS _lsa_SetSecret(pipes_struct *p, struct lsa_SetSecret *r); +NTSTATUS _lsa_DeleteObject(pipes_struct *p, + struct lsa_DeleteObject *r); +NTSTATUS _lsa_EnumPrivs(pipes_struct *p, + struct lsa_EnumPrivs *r); +NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p, + struct lsa_LookupPrivDisplayName *r); +NTSTATUS _lsa_EnumAccounts(pipes_struct *p, + struct lsa_EnumAccounts *r); +NTSTATUS _lsa_GetUserName(pipes_struct *p, + struct lsa_GetUserName *r); +NTSTATUS _lsa_CreateAccount(pipes_struct *p, + struct lsa_CreateAccount *r); +NTSTATUS _lsa_OpenAccount(pipes_struct *p, + struct lsa_OpenAccount *r); +NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p, + struct lsa_EnumPrivsAccount *r); +NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p, + struct lsa_GetSystemAccessAccount *r); +NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p, + struct lsa_SetSystemAccessAccount *r); +NTSTATUS _lsa_AddPrivilegesToAccount(pipes_struct *p, + struct lsa_AddPrivilegesToAccount *r); +NTSTATUS _lsa_RemovePrivilegesFromAccount(pipes_struct *p, + struct lsa_RemovePrivilegesFromAccount *r); +NTSTATUS _lsa_QuerySecurity(pipes_struct *p, + struct lsa_QuerySecurity *r); +NTSTATUS _lsa_AddAccountRights(pipes_struct *p, + struct lsa_AddAccountRights *r); +NTSTATUS _lsa_RemoveAccountRights(pipes_struct *p, + struct lsa_RemoveAccountRights *r); +NTSTATUS _lsa_EnumAccountRights(pipes_struct *p, + struct lsa_EnumAccountRights *r); +NTSTATUS _lsa_LookupPrivValue(pipes_struct *p, + struct lsa_LookupPrivValue *r); +NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r); +NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r); +NTSTATUS _lsa_ChangePassword(pipes_struct *p, struct lsa_ChangePassword *r); +NTSTATUS _lsa_SetInfoPolicy(pipes_struct *p, struct lsa_SetInfoPolicy *r); +NTSTATUS _lsa_ClearAuditLog(pipes_struct *p, struct lsa_ClearAuditLog *r); +NTSTATUS _lsa_GetQuotasForAccount(pipes_struct *p, struct lsa_GetQuotasForAccount *r); +NTSTATUS _lsa_SetQuotasForAccount(pipes_struct *p, struct lsa_SetQuotasForAccount *r); +NTSTATUS _lsa_QueryTrustedDomainInfo(pipes_struct *p, struct lsa_QueryTrustedDomainInfo *r); +NTSTATUS _lsa_SetInformationTrustedDomain(pipes_struct *p, struct lsa_SetInformationTrustedDomain *r); +NTSTATUS _lsa_QuerySecret(pipes_struct *p, struct lsa_QuerySecret *r); +NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r); +NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r); +NTSTATUS _lsa_QueryTrustedDomainInfoBySid(pipes_struct *p, struct lsa_QueryTrustedDomainInfoBySid *r); +NTSTATUS _lsa_SetTrustedDomainInfo(pipes_struct *p, struct lsa_SetTrustedDomainInfo *r); +NTSTATUS _lsa_DeleteTrustedDomain(pipes_struct *p, struct lsa_DeleteTrustedDomain *r); +NTSTATUS _lsa_StorePrivateData(pipes_struct *p, struct lsa_StorePrivateData *r); +NTSTATUS _lsa_RetrievePrivateData(pipes_struct *p, struct lsa_RetrievePrivateData *r); +NTSTATUS _lsa_QueryInfoPolicy2(pipes_struct *p, struct lsa_QueryInfoPolicy2 *r); +NTSTATUS _lsa_SetInfoPolicy2(pipes_struct *p, struct lsa_SetInfoPolicy2 *r); +NTSTATUS _lsa_QueryTrustedDomainInfoByName(pipes_struct *p, struct lsa_QueryTrustedDomainInfoByName *r); +NTSTATUS _lsa_SetTrustedDomainInfoByName(pipes_struct *p, struct lsa_SetTrustedDomainInfoByName *r); +NTSTATUS _lsa_EnumTrustedDomainsEx(pipes_struct *p, struct lsa_EnumTrustedDomainsEx *r); +NTSTATUS _lsa_CreateTrustedDomainEx(pipes_struct *p, struct lsa_CreateTrustedDomainEx *r); +NTSTATUS _lsa_CloseTrustedDomainEx(pipes_struct *p, struct lsa_CloseTrustedDomainEx *r); +NTSTATUS _lsa_QueryDomainInformationPolicy(pipes_struct *p, struct lsa_QueryDomainInformationPolicy *r); +NTSTATUS _lsa_SetDomainInformationPolicy(pipes_struct *p, struct lsa_SetDomainInformationPolicy *r); +NTSTATUS _lsa_OpenTrustedDomainByName(pipes_struct *p, struct lsa_OpenTrustedDomainByName *r); +NTSTATUS _lsa_TestCall(pipes_struct *p, struct lsa_TestCall *r); +NTSTATUS _lsa_CreateTrustedDomainEx2(pipes_struct *p, struct lsa_CreateTrustedDomainEx2 *r); +NTSTATUS _lsa_CREDRWRITE(pipes_struct *p, struct lsa_CREDRWRITE *r); +NTSTATUS _lsa_CREDRREAD(pipes_struct *p, struct lsa_CREDRREAD *r); +NTSTATUS _lsa_CREDRENUMERATE(pipes_struct *p, struct lsa_CREDRENUMERATE *r); +NTSTATUS _lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRWRITEDOMAINCREDENTIALS *r); +NTSTATUS _lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p, struct lsa_CREDRREADDOMAINCREDENTIALS *r); +NTSTATUS _lsa_CREDRDELETE(pipes_struct *p, struct lsa_CREDRDELETE *r); +NTSTATUS _lsa_CREDRGETTARGETINFO(pipes_struct *p, struct lsa_CREDRGETTARGETINFO *r); +NTSTATUS _lsa_CREDRPROFILELOADED(pipes_struct *p, struct lsa_CREDRPROFILELOADED *r); +NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTYPES *r); +NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r); +NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r); +NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r); +NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r); +NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r); +NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r); +NTSTATUS _lsa_LSAROPENPOLICYSCE(pipes_struct *p, struct lsa_LSAROPENPOLICYSCE *r); +NTSTATUS _lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r); +NTSTATUS _lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p, struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r); +NTSTATUS _lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p, struct lsa_LSARADTREPORTSECURITYEVENT *r); + +/* The following definitions come from rpc_server/srv_netlog_nt.c */ + +WERROR _netr_LogonControl(pipes_struct *p, + struct netr_LogonControl *r); +WERROR _netr_LogonControl2(pipes_struct *p, + struct netr_LogonControl2 *r); +WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p, + struct netr_NetrEnumerateTrustedDomains *r); +NTSTATUS _netr_ServerReqChallenge(pipes_struct *p, + struct netr_ServerReqChallenge *r); +NTSTATUS _netr_ServerAuthenticate(pipes_struct *p, + struct netr_ServerAuthenticate *r); +NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p, + struct netr_ServerAuthenticate2 *r); +NTSTATUS _netr_ServerPasswordSet(pipes_struct *p, + struct netr_ServerPasswordSet *r); +NTSTATUS _netr_LogonSamLogoff(pipes_struct *p, + struct netr_LogonSamLogoff *r); +NTSTATUS _netr_LogonSamLogon(pipes_struct *p, + struct netr_LogonSamLogon *r); +NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p, + struct netr_LogonSamLogonEx *r); +WERROR _netr_LogonUasLogon(pipes_struct *p, + struct netr_LogonUasLogon *r); +WERROR _netr_LogonUasLogoff(pipes_struct *p, + struct netr_LogonUasLogoff *r); +NTSTATUS _netr_DatabaseDeltas(pipes_struct *p, + struct netr_DatabaseDeltas *r); +NTSTATUS _netr_DatabaseSync(pipes_struct *p, + struct netr_DatabaseSync *r); +NTSTATUS _netr_AccountDeltas(pipes_struct *p, + struct netr_AccountDeltas *r); +NTSTATUS _netr_AccountSync(pipes_struct *p, + struct netr_AccountSync *r); +WERROR _netr_GetDcName(pipes_struct *p, + struct netr_GetDcName *r); +WERROR _netr_GetAnyDCName(pipes_struct *p, + struct netr_GetAnyDCName *r); +NTSTATUS _netr_DatabaseSync2(pipes_struct *p, + struct netr_DatabaseSync2 *r); +NTSTATUS _netr_DatabaseRedo(pipes_struct *p, + struct netr_DatabaseRedo *r); +WERROR _netr_LogonControl2Ex(pipes_struct *p, + struct netr_LogonControl2Ex *r); +WERROR _netr_DsRGetDCName(pipes_struct *p, + struct netr_DsRGetDCName *r); +WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p, + struct netr_NETRLOGONDUMMYROUTINE1 *r); +WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p, + struct netr_NETRLOGONSETSERVICEBITS *r); +WERROR _netr_LogonGetTrustRid(pipes_struct *p, + struct netr_LogonGetTrustRid *r); +WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p, + struct netr_NETRLOGONCOMPUTESERVERDIGEST *r); +WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p, + struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r); +NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p, + struct netr_ServerAuthenticate3 *r); +WERROR _netr_DsRGetDCNameEx(pipes_struct *p, + struct netr_DsRGetDCNameEx *r); +WERROR _netr_DsRGetSiteName(pipes_struct *p, + struct netr_DsRGetSiteName *r); +NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p, + struct netr_LogonGetDomainInfo *r); +NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p, + struct netr_ServerPasswordSet2 *r); +WERROR _netr_ServerPasswordGet(pipes_struct *p, + struct netr_ServerPasswordGet *r); +WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p, + struct netr_NETRLOGONSENDTOSAM *r); +WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p, + struct netr_DsRAddressToSitenamesW *r); +WERROR _netr_DsRGetDCNameEx2(pipes_struct *p, + struct netr_DsRGetDCNameEx2 *r); +WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p, + struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r); +WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p, + struct netr_NetrEnumerateTrustedDomainsEx *r); +WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p, + struct netr_DsRAddressToSitenamesExW *r); +WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p, + struct netr_DsrGetDcSiteCoverageW *r); +WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p, + struct netr_DsrEnumerateDomainTrusts *r); +WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p, + struct netr_DsrDeregisterDNSHostRecords *r); +NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p, + struct netr_ServerTrustPasswordsGet *r); +WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p, + struct netr_DsRGetForestTrustInformation *r); +WERROR _netr_GetForestTrustInformation(pipes_struct *p, + struct netr_GetForestTrustInformation *r); +NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, + struct netr_LogonSamLogonWithFlags *r); +WERROR _netr_NETRSERVERGETTRUSTINFO(pipes_struct *p, + struct netr_NETRSERVERGETTRUSTINFO *r); + +/* The following definitions come from rpc_server/srv_ntsvcs.c */ + +void ntsvcs2_get_pipe_fns( struct api_struct **fns, int *n_fns ); +NTSTATUS rpc_ntsvcs2_init(void); + +/* The following definitions come from rpc_server/srv_ntsvcs_nt.c */ + +WERROR _PNP_GetVersion(pipes_struct *p, + struct PNP_GetVersion *r); +WERROR _PNP_GetDeviceListSize(pipes_struct *p, + struct PNP_GetDeviceListSize *r); +WERROR _ntsvcs_get_device_list( pipes_struct *p, NTSVCS_Q_GET_DEVICE_LIST *q_u, NTSVCS_R_GET_DEVICE_LIST *r_u ); +WERROR _ntsvcs_get_device_reg_property( pipes_struct *p, NTSVCS_Q_GET_DEVICE_REG_PROPERTY *q_u, NTSVCS_R_GET_DEVICE_REG_PROPERTY *r_u ); +WERROR _PNP_ValidateDeviceInstance(pipes_struct *p, + struct PNP_ValidateDeviceInstance *r); +WERROR _PNP_GetHwProfInfo(pipes_struct *p, + struct PNP_GetHwProfInfo *r); +WERROR _PNP_HwProfFlags(pipes_struct *p, + struct PNP_HwProfFlags *r); +WERROR _PNP_Disconnect(pipes_struct *p, + struct PNP_Disconnect *r); +WERROR _PNP_Connect(pipes_struct *p, + struct PNP_Connect *r); +WERROR _PNP_GetGlobalState(pipes_struct *p, + struct PNP_GetGlobalState *r); +WERROR _PNP_InitDetection(pipes_struct *p, + struct PNP_InitDetection *r); +WERROR _PNP_ReportLogOn(pipes_struct *p, + struct PNP_ReportLogOn *r); +WERROR _PNP_GetRootDeviceInstance(pipes_struct *p, + struct PNP_GetRootDeviceInstance *r); +WERROR _PNP_GetRelatedDeviceInstance(pipes_struct *p, + struct PNP_GetRelatedDeviceInstance *r); +WERROR _PNP_EnumerateSubKeys(pipes_struct *p, + struct PNP_EnumerateSubKeys *r); +WERROR _PNP_GetDeviceList(pipes_struct *p, + struct PNP_GetDeviceList *r); +WERROR _PNP_GetDepth(pipes_struct *p, + struct PNP_GetDepth *r); +WERROR _PNP_GetDeviceRegProp(pipes_struct *p, + struct PNP_GetDeviceRegProp *r); +WERROR _PNP_SetDeviceRegProp(pipes_struct *p, + struct PNP_SetDeviceRegProp *r); +WERROR _PNP_GetClassInstance(pipes_struct *p, + struct PNP_GetClassInstance *r); +WERROR _PNP_CreateKey(pipes_struct *p, + struct PNP_CreateKey *r); +WERROR _PNP_DeleteRegistryKey(pipes_struct *p, + struct PNP_DeleteRegistryKey *r); +WERROR _PNP_GetClassCount(pipes_struct *p, + struct PNP_GetClassCount *r); +WERROR _PNP_GetClassName(pipes_struct *p, + struct PNP_GetClassName *r); +WERROR _PNP_DeleteClassKey(pipes_struct *p, + struct PNP_DeleteClassKey *r); +WERROR _PNP_GetInterfaceDeviceAlias(pipes_struct *p, + struct PNP_GetInterfaceDeviceAlias *r); +WERROR _PNP_GetInterfaceDeviceList(pipes_struct *p, + struct PNP_GetInterfaceDeviceList *r); +WERROR _PNP_GetInterfaceDeviceListSize(pipes_struct *p, + struct PNP_GetInterfaceDeviceListSize *r); +WERROR _PNP_RegisterDeviceClassAssociation(pipes_struct *p, + struct PNP_RegisterDeviceClassAssociation *r); +WERROR _PNP_UnregisterDeviceClassAssociation(pipes_struct *p, + struct PNP_UnregisterDeviceClassAssociation *r); +WERROR _PNP_GetClassRegProp(pipes_struct *p, + struct PNP_GetClassRegProp *r); +WERROR _PNP_SetClassRegProp(pipes_struct *p, + struct PNP_SetClassRegProp *r); +WERROR _PNP_CreateDevInst(pipes_struct *p, + struct PNP_CreateDevInst *r); +WERROR _PNP_DeviceInstanceAction(pipes_struct *p, + struct PNP_DeviceInstanceAction *r); +WERROR _PNP_GetDeviceStatus(pipes_struct *p, + struct PNP_GetDeviceStatus *r); +WERROR _PNP_SetDeviceProblem(pipes_struct *p, + struct PNP_SetDeviceProblem *r); +WERROR _PNP_DisableDevInst(pipes_struct *p, + struct PNP_DisableDevInst *r); +WERROR _PNP_UninstallDevInst(pipes_struct *p, + struct PNP_UninstallDevInst *r); +WERROR _PNP_AddID(pipes_struct *p, + struct PNP_AddID *r); +WERROR _PNP_RegisterDriver(pipes_struct *p, + struct PNP_RegisterDriver *r); +WERROR _PNP_QueryRemove(pipes_struct *p, + struct PNP_QueryRemove *r); +WERROR _PNP_RequestDeviceEject(pipes_struct *p, + struct PNP_RequestDeviceEject *r); +WERROR _PNP_IsDockStationPresent(pipes_struct *p, + struct PNP_IsDockStationPresent *r); +WERROR _PNP_RequestEjectPC(pipes_struct *p, + struct PNP_RequestEjectPC *r); +WERROR _PNP_AddEmptyLogConf(pipes_struct *p, + struct PNP_AddEmptyLogConf *r); +WERROR _PNP_FreeLogConf(pipes_struct *p, + struct PNP_FreeLogConf *r); +WERROR _PNP_GetFirstLogConf(pipes_struct *p, + struct PNP_GetFirstLogConf *r); +WERROR _PNP_GetNextLogConf(pipes_struct *p, + struct PNP_GetNextLogConf *r); +WERROR _PNP_GetLogConfPriority(pipes_struct *p, + struct PNP_GetLogConfPriority *r); +WERROR _PNP_AddResDes(pipes_struct *p, + struct PNP_AddResDes *r); +WERROR _PNP_FreeResDes(pipes_struct *p, + struct PNP_FreeResDes *r); +WERROR _PNP_GetNextResDes(pipes_struct *p, + struct PNP_GetNextResDes *r); +WERROR _PNP_GetResDesData(pipes_struct *p, + struct PNP_GetResDesData *r); +WERROR _PNP_GetResDesDataSize(pipes_struct *p, + struct PNP_GetResDesDataSize *r); +WERROR _PNP_ModifyResDes(pipes_struct *p, + struct PNP_ModifyResDes *r); +WERROR _PNP_DetectResourceLimit(pipes_struct *p, + struct PNP_DetectResourceLimit *r); +WERROR _PNP_QueryResConfList(pipes_struct *p, + struct PNP_QueryResConfList *r); +WERROR _PNP_SetHwProf(pipes_struct *p, + struct PNP_SetHwProf *r); +WERROR _PNP_QueryArbitratorFreeData(pipes_struct *p, + struct PNP_QueryArbitratorFreeData *r); +WERROR _PNP_QueryArbitratorFreeSize(pipes_struct *p, + struct PNP_QueryArbitratorFreeSize *r); +WERROR _PNP_RunDetection(pipes_struct *p, + struct PNP_RunDetection *r); +WERROR _PNP_RegisterNotification(pipes_struct *p, + struct PNP_RegisterNotification *r); +WERROR _PNP_UnregisterNotification(pipes_struct *p, + struct PNP_UnregisterNotification *r); +WERROR _PNP_GetCustomDevProp(pipes_struct *p, + struct PNP_GetCustomDevProp *r); +WERROR _PNP_GetVersionInternal(pipes_struct *p, + struct PNP_GetVersionInternal *r); +WERROR _PNP_GetBlockedDriverInfo(pipes_struct *p, + struct PNP_GetBlockedDriverInfo *r); +WERROR _PNP_GetServerSideDeviceInstallFlags(pipes_struct *p, + struct PNP_GetServerSideDeviceInstallFlags *r); + +/* The following definitions come from rpc_server/srv_pipe.c */ + +bool create_next_pdu(pipes_struct *p); +bool api_pipe_bind_auth3(pipes_struct *p, prs_struct *rpc_in_p); +bool setup_fault_pdu(pipes_struct *p, NTSTATUS status); +bool setup_cancel_ack_reply(pipes_struct *p, prs_struct *rpc_in_p); +bool check_bind_req(struct pipes_struct *p, RPC_IFACE* abstract, + RPC_IFACE* transfer, uint32 context_id); +NTSTATUS rpc_pipe_register_commands(int version, const char *clnt, + const char *srv, + const struct ndr_syntax_id *interface, + const struct api_struct *cmds, int size); +bool is_known_pipename(const char *cli_filename); +bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p); +bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p); +bool api_pipe_ntlmssp_auth_process(pipes_struct *p, prs_struct *rpc_in, + uint32 *p_ss_padding_len, NTSTATUS *pstatus); +bool api_pipe_schannel_process(pipes_struct *p, prs_struct *rpc_in, uint32 *p_ss_padding_len); +struct current_user *get_current_user(struct current_user *user, pipes_struct *p); +void free_pipe_rpc_context( PIPE_RPC_FNS *list ); +bool api_pipe_request(pipes_struct *p); + +/* The following definitions come from rpc_server/srv_pipe_hnd.c */ + +pipes_struct *get_first_internal_pipe(void); +pipes_struct *get_next_internal_pipe(pipes_struct *p); +void set_pipe_handle_offset(int max_open_files); +void reset_chain_p(void); +void init_rpc_pipe_hnd(void); +smb_np_struct *open_rpc_pipe_p(const char *pipe_name, + connection_struct *conn, uint16 vuid); +ssize_t write_to_pipe(smb_np_struct *p, char *data, size_t n); +ssize_t read_from_pipe(smb_np_struct *p, char *data, size_t n, + bool *is_data_outstanding); +bool wait_rpc_pipe_hnd_state(smb_np_struct *p, uint16 priority); +bool set_rpc_pipe_hnd_state(smb_np_struct *p, uint16 device_state); +bool close_rpc_pipe_hnd(smb_np_struct *p); +void pipe_close_conn(connection_struct *conn); +smb_np_struct *get_rpc_pipe_p(uint16 pnum); +smb_np_struct *get_rpc_pipe(int pnum); +struct pipes_struct *make_internal_rpc_pipe_p(const char *pipe_name, + const char *client_address, + struct auth_serversupplied_info *server_info, + uint16_t vuid); +ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_t n, + bool *is_data_outstanding); +ssize_t write_to_internal_pipe(struct pipes_struct *p, char *data, size_t n); + +/* The following definitions come from rpc_server/srv_samr_nt.c */ + +NTSTATUS _samr_Close(pipes_struct *p, struct samr_Close *r); +NTSTATUS _samr_OpenDomain(pipes_struct *p, + struct samr_OpenDomain *r); +NTSTATUS _samr_GetUserPwInfo(pipes_struct *p, + struct samr_GetUserPwInfo *r); +NTSTATUS _samr_SetSecurity(pipes_struct *p, + struct samr_SetSecurity *r); +NTSTATUS _samr_QuerySecurity(pipes_struct *p, + struct samr_QuerySecurity *r); +NTSTATUS _samr_EnumDomainUsers(pipes_struct *p, + struct samr_EnumDomainUsers *r); +NTSTATUS _samr_EnumDomainGroups(pipes_struct *p, + struct samr_EnumDomainGroups *r); +NTSTATUS _samr_EnumDomainAliases(pipes_struct *p, + struct samr_EnumDomainAliases *r); +NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p, + struct samr_QueryDisplayInfo *r); +NTSTATUS _samr_QueryDisplayInfo2(pipes_struct *p, + struct samr_QueryDisplayInfo2 *r); +NTSTATUS _samr_QueryDisplayInfo3(pipes_struct *p, + struct samr_QueryDisplayInfo3 *r); +NTSTATUS _samr_QueryAliasInfo(pipes_struct *p, + struct samr_QueryAliasInfo *r); +NTSTATUS _samr_LookupNames(pipes_struct *p, + struct samr_LookupNames *r); +NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, + struct samr_ChangePasswordUser2 *r); +NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p, + struct samr_ChangePasswordUser3 *r); +NTSTATUS _samr_LookupRids(pipes_struct *p, + struct samr_LookupRids *r); +NTSTATUS _samr_OpenUser(pipes_struct *p, + struct samr_OpenUser *r); +NTSTATUS _samr_QueryUserInfo(pipes_struct *p, + struct samr_QueryUserInfo *r); +NTSTATUS _samr_GetGroupsForUser(pipes_struct *p, + struct samr_GetGroupsForUser *r); +NTSTATUS _samr_QueryDomainInfo(pipes_struct *p, + struct samr_QueryDomainInfo *r); +NTSTATUS _samr_CreateUser2(pipes_struct *p, + struct samr_CreateUser2 *r); +NTSTATUS _samr_Connect(pipes_struct *p, + struct samr_Connect *r); +NTSTATUS _samr_Connect2(pipes_struct *p, + struct samr_Connect2 *r); +NTSTATUS _samr_Connect4(pipes_struct *p, + struct samr_Connect4 *r); +NTSTATUS _samr_Connect5(pipes_struct *p, + struct samr_Connect5 *r); +NTSTATUS _samr_LookupDomain(pipes_struct *p, + struct samr_LookupDomain *r); +NTSTATUS _samr_EnumDomains(pipes_struct *p, + struct samr_EnumDomains *r); +NTSTATUS _samr_OpenAlias(pipes_struct *p, + struct samr_OpenAlias *r); +NTSTATUS _samr_SetUserInfo(pipes_struct *p, + struct samr_SetUserInfo *r); +NTSTATUS _samr_SetUserInfo2(pipes_struct *p, + struct samr_SetUserInfo2 *r); +NTSTATUS _samr_GetAliasMembership(pipes_struct *p, + struct samr_GetAliasMembership *r); +NTSTATUS _samr_GetMembersInAlias(pipes_struct *p, + struct samr_GetMembersInAlias *r); +NTSTATUS _samr_QueryGroupMember(pipes_struct *p, + struct samr_QueryGroupMember *r); +NTSTATUS _samr_AddAliasMember(pipes_struct *p, + struct samr_AddAliasMember *r); +NTSTATUS _samr_DeleteAliasMember(pipes_struct *p, + struct samr_DeleteAliasMember *r); +NTSTATUS _samr_AddGroupMember(pipes_struct *p, + struct samr_AddGroupMember *r); +NTSTATUS _samr_DeleteGroupMember(pipes_struct *p, + struct samr_DeleteGroupMember *r); +NTSTATUS _samr_DeleteUser(pipes_struct *p, + struct samr_DeleteUser *r); +NTSTATUS _samr_DeleteDomainGroup(pipes_struct *p, + struct samr_DeleteDomainGroup *r); +NTSTATUS _samr_DeleteDomAlias(pipes_struct *p, + struct samr_DeleteDomAlias *r); +NTSTATUS _samr_CreateDomainGroup(pipes_struct *p, + struct samr_CreateDomainGroup *r); +NTSTATUS _samr_CreateDomAlias(pipes_struct *p, + struct samr_CreateDomAlias *r); +NTSTATUS _samr_QueryGroupInfo(pipes_struct *p, + struct samr_QueryGroupInfo *r); +NTSTATUS _samr_SetGroupInfo(pipes_struct *p, + struct samr_SetGroupInfo *r); +NTSTATUS _samr_SetAliasInfo(pipes_struct *p, + struct samr_SetAliasInfo *r); +NTSTATUS _samr_GetDomPwInfo(pipes_struct *p, + struct samr_GetDomPwInfo *r); +NTSTATUS _samr_OpenGroup(pipes_struct *p, + struct samr_OpenGroup *r); +NTSTATUS _samr_RemoveMemberFromForeignDomain(pipes_struct *p, + struct samr_RemoveMemberFromForeignDomain *r); +NTSTATUS _samr_QueryDomainInfo2(pipes_struct *p, + struct samr_QueryDomainInfo2 *r); +NTSTATUS _samr_SetDomainInfo(pipes_struct *p, + struct samr_SetDomainInfo *r); +NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p, + struct samr_GetDisplayEnumerationIndex *r); +NTSTATUS _samr_GetDisplayEnumerationIndex2(pipes_struct *p, + struct samr_GetDisplayEnumerationIndex2 *r); +NTSTATUS _samr_Shutdown(pipes_struct *p, + struct samr_Shutdown *r); +NTSTATUS _samr_CreateUser(pipes_struct *p, + struct samr_CreateUser *r); +NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p, + struct samr_SetMemberAttributesOfGroup *r); +NTSTATUS _samr_ChangePasswordUser(pipes_struct *p, + struct samr_ChangePasswordUser *r); +NTSTATUS _samr_TestPrivateFunctionsDomain(pipes_struct *p, + struct samr_TestPrivateFunctionsDomain *r); +NTSTATUS _samr_TestPrivateFunctionsUser(pipes_struct *p, + struct samr_TestPrivateFunctionsUser *r); +NTSTATUS _samr_QueryUserInfo2(pipes_struct *p, + struct samr_QueryUserInfo2 *r); +NTSTATUS _samr_AddMultipleMembersToAlias(pipes_struct *p, + struct samr_AddMultipleMembersToAlias *r); +NTSTATUS _samr_RemoveMultipleMembersFromAlias(pipes_struct *p, + struct samr_RemoveMultipleMembersFromAlias *r); +NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p, + struct samr_OemChangePasswordUser2 *r); +NTSTATUS _samr_SetBootKeyInformation(pipes_struct *p, + struct samr_SetBootKeyInformation *r); +NTSTATUS _samr_GetBootKeyInformation(pipes_struct *p, + struct samr_GetBootKeyInformation *r); +NTSTATUS _samr_Connect3(pipes_struct *p, + struct samr_Connect3 *r); +NTSTATUS _samr_RidToSid(pipes_struct *p, + struct samr_RidToSid *r); +NTSTATUS _samr_SetDsrmPassword(pipes_struct *p, + struct samr_SetDsrmPassword *r); +NTSTATUS _samr_ValidatePassword(pipes_struct *p, + struct samr_ValidatePassword *r); + +/* The following definitions come from rpc_server/srv_samr_util.c */ + +void copy_id20_to_sam_passwd(struct samu *to, + struct samr_UserInfo20 *from); +void copy_id21_to_sam_passwd(const char *log_prefix, + struct samu *to, + struct samr_UserInfo21 *from); +void copy_id23_to_sam_passwd(struct samu *to, + struct samr_UserInfo23 *from); +void copy_id25_to_sam_passwd(struct samu *to, + struct samr_UserInfo25 *from); + +/* The following definitions come from rpc_server/srv_spoolss.c */ + +void spoolss_get_pipe_fns( struct api_struct **fns, int *n_fns ); +NTSTATUS rpc_spoolss_init(void); + +/* The following definitions come from rpc_server/srv_spoolss_nt.c */ + +WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *sharename ); +void do_drv_upgrade_printer(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); +void update_monitored_printq_cache( void ); +void reset_all_printerdata(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); +WERROR _spoolss_open_printer(pipes_struct *p, SPOOL_Q_OPEN_PRINTER *q_u, SPOOL_R_OPEN_PRINTER *r_u); +WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, SPOOL_R_OPEN_PRINTER_EX *r_u); +bool convert_devicemode(const char *printername, const DEVICEMODE *devmode, + NT_DEVICEMODE **pp_nt_devmode); +WERROR _spoolss_closeprinter(pipes_struct *p, SPOOL_Q_CLOSEPRINTER *q_u, SPOOL_R_CLOSEPRINTER *r_u); +WERROR _spoolss_deleteprinter(pipes_struct *p, SPOOL_Q_DELETEPRINTER *q_u, SPOOL_R_DELETEPRINTER *r_u); +WERROR _spoolss_deleteprinterdriver(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIVER *q_u, SPOOL_R_DELETEPRINTERDRIVER *r_u); +WERROR _spoolss_deleteprinterdriverex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, SPOOL_R_DELETEPRINTERDRIVEREX *r_u); +WERROR set_printer_dataex( NT_PRINTER_INFO_LEVEL *printer, const char *key, const char *value, + uint32 type, uint8 *data, int real_len ); +WERROR _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, SPOOL_R_GETPRINTERDATA *r_u); +WERROR _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNEX *r_u); +void spoolss_notify_server_name(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_printer_name(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_share_name(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_port_name(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_driver_name(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_comment(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_location(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_sepfile(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_print_processor(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_parameters(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_datatype(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_attributes(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void spoolss_notify_cjobs(int snum, + SPOOL_NOTIFY_INFO_DATA *data, + print_queue_struct *queue, + NT_PRINTER_INFO_LEVEL *printer, + TALLOC_CTX *mem_ctx); +void construct_info_data(SPOOL_NOTIFY_INFO_DATA *info_data, uint16 type, uint16 field, int id); +WERROR _spoolss_rfnpcnex( pipes_struct *p, SPOOL_Q_RFNPCNEX *q_u, SPOOL_R_RFNPCNEX *r_u); +DEVICEMODE *construct_dev_mode(const char *servicename); +WERROR _spoolss_enumprinters( pipes_struct *p, SPOOL_Q_ENUMPRINTERS *q_u, SPOOL_R_ENUMPRINTERS *r_u); +WERROR _spoolss_getprinter(pipes_struct *p, SPOOL_Q_GETPRINTER *q_u, SPOOL_R_GETPRINTER *r_u); +WERROR _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_u, SPOOL_R_GETPRINTERDRIVER2 *r_u); +WERROR _spoolss_startpageprinter(pipes_struct *p, SPOOL_Q_STARTPAGEPRINTER *q_u, SPOOL_R_STARTPAGEPRINTER *r_u); +WERROR _spoolss_endpageprinter(pipes_struct *p, SPOOL_Q_ENDPAGEPRINTER *q_u, SPOOL_R_ENDPAGEPRINTER *r_u); +WERROR _spoolss_startdocprinter(pipes_struct *p, SPOOL_Q_STARTDOCPRINTER *q_u, SPOOL_R_STARTDOCPRINTER *r_u); +WERROR _spoolss_enddocprinter(pipes_struct *p, SPOOL_Q_ENDDOCPRINTER *q_u, SPOOL_R_ENDDOCPRINTER *r_u); +WERROR _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL_R_WRITEPRINTER *r_u); +WERROR _spoolss_abortprinter(pipes_struct *p, SPOOL_Q_ABORTPRINTER *q_u, SPOOL_R_ABORTPRINTER *r_u); +WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname, const char *uri ); +bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer); +WERROR _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SETPRINTER *r_u); +WERROR _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u); +WERROR _spoolss_addjob(pipes_struct *p, SPOOL_Q_ADDJOB *q_u, SPOOL_R_ADDJOB *r_u); +WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJOBS *r_u); +WERROR _spoolss_schedulejob( pipes_struct *p, SPOOL_Q_SCHEDULEJOB *q_u, SPOOL_R_SCHEDULEJOB *r_u); +WERROR _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u); +WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, SPOOL_R_ENUMPRINTERDRIVERS *r_u); +WERROR _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMFORMS *r_u); +WERROR _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *r_u); +WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines ); +WERROR _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUMPORTS *r_u); +WERROR _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOOL_R_ADDPRINTEREX *r_u); +WERROR _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_u, SPOOL_R_ADDPRINTERDRIVER *r_u); +WERROR _spoolss_addprinterdriverex(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVEREX *q_u, SPOOL_R_ADDPRINTERDRIVEREX *r_u); +WERROR _spoolss_getprinterdriverdirectory(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVERDIR *q_u, SPOOL_R_GETPRINTERDRIVERDIR *r_u); +WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u); +WERROR _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SPOOL_R_SETPRINTERDATA *r_u); +WERROR _spoolss_resetprinter(pipes_struct *p, SPOOL_Q_RESETPRINTER *q_u, SPOOL_R_RESETPRINTER *r_u); +WERROR _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_u, SPOOL_R_DELETEPRINTERDATA *r_u); +WERROR _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFORM *r_u); +WERROR _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_DELETEFORM *r_u); +WERROR _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM *r_u); +WERROR _spoolss_enumprintprocessors(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCESSORS *q_u, SPOOL_R_ENUMPRINTPROCESSORS *r_u); +WERROR _spoolss_enumprintprocdatatypes(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCDATATYPES *q_u, SPOOL_R_ENUMPRINTPROCDATATYPES *r_u); +WERROR _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *q_u, SPOOL_R_ENUMPRINTMONITORS *r_u); +WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_u); +WERROR _spoolss_getprinterdataex(pipes_struct *p, SPOOL_Q_GETPRINTERDATAEX *q_u, SPOOL_R_GETPRINTERDATAEX *r_u); +WERROR _spoolss_setprinterdataex(pipes_struct *p, SPOOL_Q_SETPRINTERDATAEX *q_u, SPOOL_R_SETPRINTERDATAEX *r_u); +WERROR _spoolss_deleteprinterdataex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATAEX *q_u, SPOOL_R_DELETEPRINTERDATAEX *r_u); +WERROR _spoolss_enumprinterkey(pipes_struct *p, SPOOL_Q_ENUMPRINTERKEY *q_u, SPOOL_R_ENUMPRINTERKEY *r_u); +WERROR _spoolss_deleteprinterkey(pipes_struct *p, SPOOL_Q_DELETEPRINTERKEY *q_u, SPOOL_R_DELETEPRINTERKEY *r_u); +WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_u, SPOOL_R_ENUMPRINTERDATAEX *r_u); +WERROR _spoolss_getprintprocessordirectory(pipes_struct *p, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u); +WERROR _spoolss_xcvdataport(pipes_struct *p, SPOOL_Q_XCVDATAPORT *q_u, SPOOL_R_XCVDATAPORT *r_u); + +/* The following definitions come from rpc_server/srv_srvsvc_nt.c */ + +WERROR _srvsvc_NetFileEnum(pipes_struct *p, + struct srvsvc_NetFileEnum *r); +WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p, + struct srvsvc_NetSrvGetInfo *r); +WERROR _srvsvc_NetSrvSetInfo(pipes_struct *p, + struct srvsvc_NetSrvSetInfo *r); +WERROR _srvsvc_NetConnEnum(pipes_struct *p, + struct srvsvc_NetConnEnum *r); +WERROR _srvsvc_NetSessEnum(pipes_struct *p, + struct srvsvc_NetSessEnum *r); +WERROR _srvsvc_NetSessDel(pipes_struct *p, + struct srvsvc_NetSessDel *r); +WERROR _srvsvc_NetShareEnumAll(pipes_struct *p, + struct srvsvc_NetShareEnumAll *r); +WERROR _srvsvc_NetShareEnum(pipes_struct *p, + struct srvsvc_NetShareEnum *r); +WERROR _srvsvc_NetShareGetInfo(pipes_struct *p, + struct srvsvc_NetShareGetInfo *r); +char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname); +WERROR _srvsvc_NetShareSetInfo(pipes_struct *p, + struct srvsvc_NetShareSetInfo *r); +WERROR _srvsvc_NetShareAdd(pipes_struct *p, + struct srvsvc_NetShareAdd *r); +WERROR _srvsvc_NetShareDel(pipes_struct *p, + struct srvsvc_NetShareDel *r); +WERROR _srvsvc_NetShareDelSticky(pipes_struct *p, + struct srvsvc_NetShareDelSticky *r); +WERROR _srvsvc_NetRemoteTOD(pipes_struct *p, + struct srvsvc_NetRemoteTOD *r); +WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, + struct srvsvc_NetGetFileSecurity *r); +WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, + struct srvsvc_NetSetFileSecurity *r); +WERROR _srvsvc_NetDiskEnum(pipes_struct *p, + struct srvsvc_NetDiskEnum *r); +WERROR _srvsvc_NetNameValidate(pipes_struct *p, + struct srvsvc_NetNameValidate *r); +WERROR _srvsvc_NetFileClose(pipes_struct *p, struct srvsvc_NetFileClose *r); +WERROR _srvsvc_NetCharDevEnum(pipes_struct *p, struct srvsvc_NetCharDevEnum *r); +WERROR _srvsvc_NetCharDevGetInfo(pipes_struct *p, struct srvsvc_NetCharDevGetInfo *r); +WERROR _srvsvc_NetCharDevControl(pipes_struct *p, struct srvsvc_NetCharDevControl *r); +WERROR _srvsvc_NetCharDevQEnum(pipes_struct *p, struct srvsvc_NetCharDevQEnum *r); +WERROR _srvsvc_NetCharDevQGetInfo(pipes_struct *p, struct srvsvc_NetCharDevQGetInfo *r); +WERROR _srvsvc_NetCharDevQSetInfo(pipes_struct *p, struct srvsvc_NetCharDevQSetInfo *r); +WERROR _srvsvc_NetCharDevQPurge(pipes_struct *p, struct srvsvc_NetCharDevQPurge *r); +WERROR _srvsvc_NetCharDevQPurgeSelf(pipes_struct *p, struct srvsvc_NetCharDevQPurgeSelf *r); +WERROR _srvsvc_NetFileGetInfo(pipes_struct *p, struct srvsvc_NetFileGetInfo *r); +WERROR _srvsvc_NetShareCheck(pipes_struct *p, struct srvsvc_NetShareCheck *r); +WERROR _srvsvc_NetServerStatisticsGet(pipes_struct *p, struct srvsvc_NetServerStatisticsGet *r); +WERROR _srvsvc_NetTransportAdd(pipes_struct *p, struct srvsvc_NetTransportAdd *r); +WERROR _srvsvc_NetTransportEnum(pipes_struct *p, struct srvsvc_NetTransportEnum *r); +WERROR _srvsvc_NetTransportDel(pipes_struct *p, struct srvsvc_NetTransportDel *r); +WERROR _srvsvc_NetSetServiceBits(pipes_struct *p, struct srvsvc_NetSetServiceBits *r); +WERROR _srvsvc_NetPathType(pipes_struct *p, struct srvsvc_NetPathType *r); +WERROR _srvsvc_NetPathCanonicalize(pipes_struct *p, struct srvsvc_NetPathCanonicalize *r); +WERROR _srvsvc_NetPathCompare(pipes_struct *p, struct srvsvc_NetPathCompare *r); +WERROR _srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p, struct srvsvc_NETRPRNAMECANONICALIZE *r); +WERROR _srvsvc_NetPRNameCompare(pipes_struct *p, struct srvsvc_NetPRNameCompare *r); +WERROR _srvsvc_NetShareDelStart(pipes_struct *p, struct srvsvc_NetShareDelStart *r); +WERROR _srvsvc_NetShareDelCommit(pipes_struct *p, struct srvsvc_NetShareDelCommit *r); +WERROR _srvsvc_NetServerTransportAddEx(pipes_struct *p, struct srvsvc_NetServerTransportAddEx *r); +WERROR _srvsvc_NetServerSetServiceBitsEx(pipes_struct *p, struct srvsvc_NetServerSetServiceBitsEx *r); +WERROR _srvsvc_NETRDFSGETVERSION(pipes_struct *p, struct srvsvc_NETRDFSGETVERSION *r); +WERROR _srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSCREATELOCALPARTITION *r); +WERROR _srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p, struct srvsvc_NETRDFSDELETELOCALPARTITION *r); +WERROR _srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p, struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r); +WERROR _srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p, struct srvsvc_NETRDFSSETSERVERINFO *r); +WERROR _srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSCREATEEXITPOINT *r); +WERROR _srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p, struct srvsvc_NETRDFSDELETEEXITPOINT *r); +WERROR _srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p, struct srvsvc_NETRDFSMODIFYPREFIX *r); +WERROR _srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p, struct srvsvc_NETRDFSFIXLOCALVOLUME *r); +WERROR _srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p, struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r); +WERROR _srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p, struct srvsvc_NETRSERVERTRANSPORTDELEX *r); + +/* The following definitions come from rpc_server/srv_svcctl.c */ + +void svcctl2_get_pipe_fns( struct api_struct **fns, int *n_fns ); +NTSTATUS rpc_svcctl2_init(void); + +/* The following definitions come from rpc_server/srv_svcctl_nt.c */ + +bool init_service_op_table( void ); +WERROR _svcctl_OpenSCManagerW(pipes_struct *p, + struct svcctl_OpenSCManagerW *r); +WERROR _svcctl_OpenServiceW(pipes_struct *p, + struct svcctl_OpenServiceW *r); +WERROR _svcctl_CloseServiceHandle(pipes_struct *p, struct svcctl_CloseServiceHandle *r); +WERROR _svcctl_GetServiceDisplayNameW(pipes_struct *p, + struct svcctl_GetServiceDisplayNameW *r); +WERROR _svcctl_QueryServiceStatus(pipes_struct *p, + struct svcctl_QueryServiceStatus *r); +WERROR _svcctl_enum_services_status(pipes_struct *p, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, SVCCTL_R_ENUM_SERVICES_STATUS *r_u); +WERROR _svcctl_StartServiceW(pipes_struct *p, + struct svcctl_StartServiceW *r); +WERROR _svcctl_ControlService(pipes_struct *p, + struct svcctl_ControlService *r); +WERROR _svcctl_EnumDependentServicesW(pipes_struct *p, + struct svcctl_EnumDependentServicesW *r); +WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u ); +WERROR _svcctl_query_service_config( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u ); +WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u ); +WERROR _svcctl_LockServiceDatabase(pipes_struct *p, + struct svcctl_LockServiceDatabase *r); +WERROR _svcctl_UnlockServiceDatabase(pipes_struct *p, + struct svcctl_UnlockServiceDatabase *r); +WERROR _svcctl_QueryServiceObjectSecurity(pipes_struct *p, + struct svcctl_QueryServiceObjectSecurity *r); +WERROR _svcctl_SetServiceObjectSecurity(pipes_struct *p, + struct svcctl_SetServiceObjectSecurity *r); +WERROR _svcctl_DeleteService(pipes_struct *p, struct svcctl_DeleteService *r); +WERROR _svcctl_SetServiceStatus(pipes_struct *p, struct svcctl_SetServiceStatus *r); +WERROR _svcctl_NotifyBootConfigStatus(pipes_struct *p, struct svcctl_NotifyBootConfigStatus *r); +WERROR _svcctl_SCSetServiceBitsW(pipes_struct *p, struct svcctl_SCSetServiceBitsW *r); +WERROR _svcctl_ChangeServiceConfigW(pipes_struct *p, struct svcctl_ChangeServiceConfigW *r); +WERROR _svcctl_CreateServiceW(pipes_struct *p, struct svcctl_CreateServiceW *r); +WERROR _svcctl_EnumServicesStatusW(pipes_struct *p, struct svcctl_EnumServicesStatusW *r); +WERROR _svcctl_QueryServiceConfigW(pipes_struct *p, struct svcctl_QueryServiceConfigW *r); +WERROR _svcctl_QueryServiceLockStatusW(pipes_struct *p, struct svcctl_QueryServiceLockStatusW *r); +WERROR _svcctl_GetServiceKeyNameW(pipes_struct *p, struct svcctl_GetServiceKeyNameW *r); +WERROR _svcctl_SCSetServiceBitsA(pipes_struct *p, struct svcctl_SCSetServiceBitsA *r); +WERROR _svcctl_ChangeServiceConfigA(pipes_struct *p, struct svcctl_ChangeServiceConfigA *r); +WERROR _svcctl_CreateServiceA(pipes_struct *p, struct svcctl_CreateServiceA *r); +WERROR _svcctl_EnumDependentServicesA(pipes_struct *p, struct svcctl_EnumDependentServicesA *r); +WERROR _svcctl_EnumServicesStatusA(pipes_struct *p, struct svcctl_EnumServicesStatusA *r); +WERROR _svcctl_OpenSCManagerA(pipes_struct *p, struct svcctl_OpenSCManagerA *r); +WERROR _svcctl_OpenServiceA(pipes_struct *p, struct svcctl_OpenServiceA *r); +WERROR _svcctl_QueryServiceConfigA(pipes_struct *p, struct svcctl_QueryServiceConfigA *r); +WERROR _svcctl_QueryServiceLockStatusA(pipes_struct *p, struct svcctl_QueryServiceLockStatusA *r); +WERROR _svcctl_StartServiceA(pipes_struct *p, struct svcctl_StartServiceA *r); +WERROR _svcctl_GetServiceDisplayNameA(pipes_struct *p, struct svcctl_GetServiceDisplayNameA *r); +WERROR _svcctl_GetServiceKeyNameA(pipes_struct *p, struct svcctl_GetServiceKeyNameA *r); +WERROR _svcctl_GetCurrentGroupeStateW(pipes_struct *p, struct svcctl_GetCurrentGroupeStateW *r); +WERROR _svcctl_EnumServiceGroupW(pipes_struct *p, struct svcctl_EnumServiceGroupW *r); +WERROR _svcctl_ChangeServiceConfig2A(pipes_struct *p, struct svcctl_ChangeServiceConfig2A *r); +WERROR _svcctl_ChangeServiceConfig2W(pipes_struct *p, struct svcctl_ChangeServiceConfig2W *r); +WERROR _svcctl_QueryServiceConfig2A(pipes_struct *p, struct svcctl_QueryServiceConfig2A *r); +WERROR _svcctl_QueryServiceConfig2W(pipes_struct *p, struct svcctl_QueryServiceConfig2W *r); +WERROR _svcctl_QueryServiceStatusEx(pipes_struct *p, struct svcctl_QueryServiceStatusEx *r); +WERROR _EnumServicesStatusExA(pipes_struct *p, struct EnumServicesStatusExA *r); +WERROR _EnumServicesStatusExW(pipes_struct *p, struct EnumServicesStatusExW *r); +WERROR _svcctl_SCSendTSMessage(pipes_struct *p, struct svcctl_SCSendTSMessage *r); + +/* The following definitions come from rpc_server/srv_winreg_nt.c */ + +WERROR _winreg_CloseKey(pipes_struct *p, struct winreg_CloseKey *r); +WERROR _winreg_OpenHKLM(pipes_struct *p, struct winreg_OpenHKLM *r); +WERROR _winreg_OpenHKPD(pipes_struct *p, struct winreg_OpenHKPD *r); +WERROR _winreg_OpenHKPT(pipes_struct *p, struct winreg_OpenHKPT *r); +WERROR _winreg_OpenHKCR(pipes_struct *p, struct winreg_OpenHKCR *r); +WERROR _winreg_OpenHKU(pipes_struct *p, struct winreg_OpenHKU *r); +WERROR _winreg_OpenHKCU(pipes_struct *p, struct winreg_OpenHKCU *r); +WERROR _winreg_OpenHKCC(pipes_struct *p, struct winreg_OpenHKCC *r); +WERROR _winreg_OpenHKDD(pipes_struct *p, struct winreg_OpenHKDD *r); +WERROR _winreg_OpenHKPN(pipes_struct *p, struct winreg_OpenHKPN *r); +WERROR _winreg_OpenKey(pipes_struct *p, struct winreg_OpenKey *r); +WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r); +WERROR _winreg_QueryInfoKey(pipes_struct *p, struct winreg_QueryInfoKey *r); +WERROR _winreg_GetVersion(pipes_struct *p, struct winreg_GetVersion *r); +WERROR _winreg_EnumKey(pipes_struct *p, struct winreg_EnumKey *r); +WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r); +WERROR _winreg_InitiateSystemShutdown(pipes_struct *p, struct winreg_InitiateSystemShutdown *r); +WERROR _winreg_InitiateSystemShutdownEx(pipes_struct *p, struct winreg_InitiateSystemShutdownEx *r); +WERROR _winreg_AbortSystemShutdown(pipes_struct *p, struct winreg_AbortSystemShutdown *r); +WERROR _winreg_RestoreKey(pipes_struct *p, struct winreg_RestoreKey *r); +WERROR _winreg_SaveKey(pipes_struct *p, struct winreg_SaveKey *r); +WERROR _winreg_SaveKeyEx(pipes_struct *p, struct winreg_SaveKeyEx *r); +WERROR _winreg_CreateKey( pipes_struct *p, struct winreg_CreateKey *r); +WERROR _winreg_SetValue(pipes_struct *p, struct winreg_SetValue *r); +WERROR _winreg_DeleteKey(pipes_struct *p, struct winreg_DeleteKey *r); +WERROR _winreg_DeleteValue(pipes_struct *p, struct winreg_DeleteValue *r); +WERROR _winreg_GetKeySecurity(pipes_struct *p, struct winreg_GetKeySecurity *r); +WERROR _winreg_SetKeySecurity(pipes_struct *p, struct winreg_SetKeySecurity *r); +WERROR _winreg_FlushKey(pipes_struct *p, struct winreg_FlushKey *r); +WERROR _winreg_UnLoadKey(pipes_struct *p, struct winreg_UnLoadKey *r); +WERROR _winreg_ReplaceKey(pipes_struct *p, struct winreg_ReplaceKey *r); +WERROR _winreg_LoadKey(pipes_struct *p, struct winreg_LoadKey *r); +WERROR _winreg_NotifyChangeKeyValue(pipes_struct *p, struct winreg_NotifyChangeKeyValue *r); +WERROR _winreg_QueryMultipleValues(pipes_struct *p, struct winreg_QueryMultipleValues *r); +WERROR _winreg_QueryMultipleValues2(pipes_struct *p, struct winreg_QueryMultipleValues2 *r); + +/* The following definitions come from rpc_server/srv_wkssvc_nt.c */ + +WERROR _wkssvc_NetWkstaGetInfo(pipes_struct *p, struct wkssvc_NetWkstaGetInfo *r); +WERROR _wkssvc_NetWkstaSetInfo(pipes_struct *p, struct wkssvc_NetWkstaSetInfo *r); +WERROR _wkssvc_NetWkstaEnumUsers(pipes_struct *p, struct wkssvc_NetWkstaEnumUsers *r); +WERROR _wkssvc_NetrWkstaUserGetInfo(pipes_struct *p, struct wkssvc_NetrWkstaUserGetInfo *r); +WERROR _wkssvc_NetrWkstaUserSetInfo(pipes_struct *p, struct wkssvc_NetrWkstaUserSetInfo *r); +WERROR _wkssvc_NetWkstaTransportEnum(pipes_struct *p, struct wkssvc_NetWkstaTransportEnum *r); +WERROR _wkssvc_NetrWkstaTransportAdd(pipes_struct *p, struct wkssvc_NetrWkstaTransportAdd *r); +WERROR _wkssvc_NetrWkstaTransportDel(pipes_struct *p, struct wkssvc_NetrWkstaTransportDel *r); +WERROR _wkssvc_NetrUseAdd(pipes_struct *p, struct wkssvc_NetrUseAdd *r); +WERROR _wkssvc_NetrUseGetInfo(pipes_struct *p, struct wkssvc_NetrUseGetInfo *r); +WERROR _wkssvc_NetrUseDel(pipes_struct *p, struct wkssvc_NetrUseDel *r); +WERROR _wkssvc_NetrUseEnum(pipes_struct *p, struct wkssvc_NetrUseEnum *r); +WERROR _wkssvc_NetrMessageBufferSend(pipes_struct *p, struct wkssvc_NetrMessageBufferSend *r); +WERROR _wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p, struct wkssvc_NetrWorkstationStatisticsGet *r) ; +WERROR _wkssvc_NetrLogonDomainNameAdd(pipes_struct *p, struct wkssvc_NetrLogonDomainNameAdd *r); +WERROR _wkssvc_NetrLogonDomainNameDel(pipes_struct *p, struct wkssvc_NetrLogonDomainNameDel *r); +WERROR _wkssvc_NetrJoinDomain(pipes_struct *p, struct wkssvc_NetrJoinDomain *r); +WERROR _wkssvc_NetrUnjoinDomain(pipes_struct *p, struct wkssvc_NetrUnjoinDomain *r); +WERROR _wkssvc_NetrRenameMachineInDomain(pipes_struct *p, struct wkssvc_NetrRenameMachineInDomain *r); +WERROR _wkssvc_NetrValidateName(pipes_struct *p, struct wkssvc_NetrValidateName *r); +WERROR _wkssvc_NetrGetJoinInformation(pipes_struct *p, struct wkssvc_NetrGetJoinInformation *r); +WERROR _wkssvc_NetrGetJoinableOus(pipes_struct *p, struct wkssvc_NetrGetJoinableOus *r); +WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, + struct wkssvc_NetrJoinDomain2 *r); +WERROR _wkssvc_NetrUnjoinDomain2(pipes_struct *p, + struct wkssvc_NetrUnjoinDomain2 *r); +WERROR _wkssvc_NetrRenameMachineInDomain2(pipes_struct *p, struct wkssvc_NetrRenameMachineInDomain2 *r); +WERROR _wkssvc_NetrValidateName2(pipes_struct *p, struct wkssvc_NetrValidateName2 *r); +WERROR _wkssvc_NetrGetJoinableOus2(pipes_struct *p, struct wkssvc_NetrGetJoinableOus2 *r); +WERROR _wkssvc_NetrAddAlternateComputerName(pipes_struct *p, struct wkssvc_NetrAddAlternateComputerName *r); +WERROR _wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p, struct wkssvc_NetrRemoveAlternateComputerName *r); +WERROR _wkssvc_NetrSetPrimaryComputername(pipes_struct *p, struct wkssvc_NetrSetPrimaryComputername *r); +WERROR _wkssvc_NetrEnumerateComputerNames(pipes_struct *p, struct wkssvc_NetrEnumerateComputerNames *r); + +/* The following definitions come from rpcclient/cmd_dfs.c */ + + +/* The following definitions come from rpcclient/cmd_dssetup.c */ + + +/* The following definitions come from rpcclient/cmd_echo.c */ + + +/* The following definitions come from rpcclient/cmd_lsarpc.c */ + + +/* The following definitions come from rpcclient/cmd_netlogon.c */ + + +/* The following definitions come from rpcclient/cmd_ntsvcs.c */ + + +/* The following definitions come from rpcclient/cmd_samr.c */ + + +/* The following definitions come from rpcclient/cmd_shutdown.c */ + + +/* The following definitions come from rpcclient/cmd_spoolss.c */ + +void set_drv_info_3_env (DRIVER_INFO_3 *info, const char *arch); + +/* The following definitions come from rpcclient/cmd_srvsvc.c */ + + +/* The following definitions come from rpcclient/cmd_test.c */ + + +/* The following definitions come from rpcclient/cmd_wkssvc.c */ + + +/* The following definitions come from rpcclient/rpcclient.c */ + + +/* The following definitions come from services/services_db.c */ + +void svcctl_init_keys( void ); +SEC_DESC *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token ); +bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc, NT_USER_TOKEN *token ); +const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token ); +const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token ); +REGVAL_CTR *svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token ); + +/* The following definitions come from services/svc_netlogon.c */ + + +/* The following definitions come from services/svc_rcinit.c */ + + +/* The following definitions come from services/svc_spoolss.c */ + + +/* The following definitions come from services/svc_winreg.c */ + + +/* The following definitions come from services/svc_wins.c */ + + +/* The following definitions come from smbd/aio.c */ + +void aio_request_done(uint16_t mid); +bool aio_finished(void); +void initialize_async_io_handler(void); +bool schedule_aio_read_and_X(connection_struct *conn, + struct smb_request *req, + files_struct *fsp, SMB_OFF_T startpos, + size_t smb_maxcnt); +bool schedule_aio_write_and_X(connection_struct *conn, + struct smb_request *req, + files_struct *fsp, char *data, + SMB_OFF_T startpos, + size_t numtowrite); +int process_aio_queue(void); +int wait_for_aio_completion(files_struct *fsp); +void cancel_aio_by_fsp(files_struct *fsp); +bool aio_finished(void); +void initialize_async_io_handler(void); +int process_aio_queue(void); +bool schedule_aio_read_and_X(connection_struct *conn, + struct smb_request *req, + files_struct *fsp, SMB_OFF_T startpos, + size_t smb_maxcnt); +bool schedule_aio_write_and_X(connection_struct *conn, + struct smb_request *req, + files_struct *fsp, char *data, + SMB_OFF_T startpos, + size_t numtowrite); +void cancel_aio_by_fsp(files_struct *fsp); +int wait_for_aio_completion(files_struct *fsp); + +/* The following definitions come from smbd/blocking.c */ + +bool push_blocking_lock_request( struct byte_range_lock *br_lck, + const struct smb_request *req, + files_struct *fsp, + int lock_timeout, + int lock_num, + uint32 lock_pid, + enum brl_type lock_type, + enum brl_flavour lock_flav, + SMB_BIG_UINT offset, + SMB_BIG_UINT count, + uint32 blocking_pid); +void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lock *br_lck); +void remove_pending_lock_requests_by_mid(int mid); +bool blocking_lock_was_deferred(int mid); +bool blocking_lock_cancel(files_struct *fsp, + uint32 lock_pid, + SMB_BIG_UINT offset, + SMB_BIG_UINT count, + enum brl_flavour lock_flav, + unsigned char locktype, + NTSTATUS err); + +/* The following definitions come from smbd/change_trust_pw.c */ + +NTSTATUS change_trust_account_password( const char *domain, const char *remote_machine); + +/* The following definitions come from smbd/chgpasswd.c */ + +bool chgpasswd(const char *name, const struct passwd *pass, + const char *oldpass, const char *newpass, bool as_root); +bool chgpasswd(const char *name, const struct passwd *pass, + const char *oldpass, const char *newpass, bool as_root); +bool check_lanman_password(char *user, uchar * pass1, + uchar * pass2, struct samu **hnd); +bool change_lanman_password(struct samu *sampass, uchar *pass2); +NTSTATUS pass_oem_change(char *user, + uchar password_encrypted_with_lm_hash[516], + const uchar old_lm_hash_encrypted[16], + uchar password_encrypted_with_nt_hash[516], + const uchar old_nt_hash_encrypted[16], + uint32 *reject_reason); +NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passwd, bool as_root, uint32 *samr_reject_reason); + +/* The following definitions come from smbd/close.c */ + +void set_close_write_time(struct files_struct *fsp, struct timespec ts); +NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type); +void msg_close_file(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); + +/* The following definitions come from smbd/conn.c */ + +void conn_init(void); +int conn_num_open(void); +bool conn_snum_used(int snum); +connection_struct *conn_find(unsigned cnum); +connection_struct *conn_new(void); +bool conn_close_all(void); +bool conn_idle_all(time_t t); +void conn_clear_vuid_caches(uint16 vuid); +void conn_free_internal(connection_struct *conn); +void conn_free(connection_struct *conn); +void msg_force_tdis(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); + +/* The following definitions come from smbd/connection.c */ + +bool yield_connection(connection_struct *conn, const char *name); +int count_current_connections( const char *sharename, bool clear ); +int count_all_current_connections(void); +bool claim_connection(connection_struct *conn, const char *name, + uint32 msg_flags); +bool register_message_flags(bool doreg, uint32 msg_flags); +bool store_pipe_opendb( smb_np_struct *p ); +bool delete_pipe_opendb( smb_np_struct *p ); + +/* The following definitions come from smbd/dfree.c */ + +SMB_BIG_UINT sys_disk_free(connection_struct *conn, const char *path, bool small_query, + SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize); +SMB_BIG_UINT get_dfree_info(connection_struct *conn, + const char *path, + bool small_query, + SMB_BIG_UINT *bsize, + SMB_BIG_UINT *dfree, + SMB_BIG_UINT *dsize); + +/* The following definitions come from smbd/dir.c */ + +bool make_dir_struct(TALLOC_CTX *ctx, + char *buf, + const char *mask, + const char *fname, + SMB_OFF_T size, + uint32 mode, + time_t date, + bool uc); +void init_dptrs(void); +char *dptr_path(int key); +char *dptr_wcard(int key); +uint16 dptr_attr(int key); +void dptr_close(int *key); +void dptr_closecnum(connection_struct *conn); +void dptr_idlecnum(connection_struct *conn); +void dptr_closepath(char *path,uint16 spid); +NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, bool expect_close,uint16 spid, + const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret); +int dptr_CloseDir(struct dptr_struct *dptr); +void dptr_SeekDir(struct dptr_struct *dptr, long offset); +long dptr_TellDir(struct dptr_struct *dptr); +bool dptr_has_wild(struct dptr_struct *dptr); +int dptr_dnum(struct dptr_struct *dptr); +const char *dptr_ReadDirName(TALLOC_CTX *ctx, + struct dptr_struct *dptr, + long *poffset, + SMB_STRUCT_STAT *pst); +bool dptr_SearchDir(struct dptr_struct *dptr, const char *name, long *poffset, SMB_STRUCT_STAT *pst); +void dptr_DirCacheAdd(struct dptr_struct *dptr, const char *name, long offset); +bool dptr_fill(char *buf1,unsigned int key); +struct dptr_struct *dptr_fetch(char *buf,int *num); +struct dptr_struct *dptr_fetch_lanman2(int dptr_num); +bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype); +bool get_dir_entry(TALLOC_CTX *ctx, + connection_struct *conn, + const char *mask, + uint32 dirtype, + char **pp_fname_out, + SMB_OFF_T *size, + uint32 *mode, + time_t *date, + bool check_descend, + bool ask_sharemode); +bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto); +struct smb_Dir *OpenDir(TALLOC_CTX *mem_ctx, connection_struct *conn, + const char *name, const char *mask, uint32 attr); +const char *ReadDirName(struct smb_Dir *dirp, long *poffset); +void RewindDir(struct smb_Dir *dirp, long *poffset); +void SeekDir(struct smb_Dir *dirp, long offset); +long TellDir(struct smb_Dir *dirp); +void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset); +bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset); +NTSTATUS can_delete_directory(struct connection_struct *conn, + const char *dirname); + +/* The following definitions come from smbd/dmapi.c */ + +const void *dmapi_get_current_session(void); +bool dmapi_have_session(void); +bool dmapi_new_session(void); +bool dmapi_destroy_session(void); +uint32 dmapi_file_flags(const char * const path); + +/* The following definitions come from smbd/dnsregister.c */ + +void dns_register_close(struct dns_reg_state **dns_state_ptr); +void dns_register_smbd(struct dns_reg_state ** dns_state_ptr, + unsigned port, + int *maxfd, + fd_set *listen_set, + struct timeval *timeout); +bool dns_register_smbd_reply(struct dns_reg_state *dns_state, + fd_set *lfds, struct timeval *timeout); + +/* The following definitions come from smbd/dosmode.c */ + +mode_t unix_mode(connection_struct *conn, int dosmode, const char *fname, + const char *inherit_from_dir); +uint32 dos_mode_msdfs(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf); +uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf); +int file_set_dosmode(connection_struct *conn, const char *fname, + uint32 dosmode, SMB_STRUCT_STAT *st, + const char *parent_dir, + bool newfile); +int file_ntimes(connection_struct *conn, const char *fname, const struct timespec ts[2]); +bool set_sticky_write_time_path(connection_struct *conn, const char *fname, + struct file_id fileid, const struct timespec mtime); +bool set_sticky_write_time_fsp(struct files_struct *fsp, const struct timespec mtime); +bool update_write_time(struct files_struct *fsp); + +/* The following definitions come from smbd/error.c */ + +bool use_nt_status(void); +void error_packet_set(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file); +int error_packet(char *outbuf, uint8 eclass, uint32 ecode, NTSTATUS ntstatus, int line, const char *file); +void reply_nt_error(struct smb_request *req, NTSTATUS ntstatus, + int line, const char *file); +void reply_force_nt_error(struct smb_request *req, NTSTATUS ntstatus, + int line, const char *file); +void reply_dos_error(struct smb_request *req, uint8 eclass, uint32 ecode, + int line, const char *file); +void reply_both_error(struct smb_request *req, uint8 eclass, uint32 ecode, + NTSTATUS status, int line, const char *file); +void reply_openerror(struct smb_request *req, NTSTATUS status); +void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode, + NTSTATUS defstatus, int line, const char *file); + +/* The following definitions come from smbd/fake_file.c */ + +enum FAKE_FILE_TYPE is_fake_file(const char *fname); +NTSTATUS open_fake_file(connection_struct *conn, + uint16_t current_vuid, + enum FAKE_FILE_TYPE fake_file_type, + const char *fname, + uint32 access_mask, + files_struct **result); +void destroy_fake_file_handle(struct fake_file_handle **fh); +NTSTATUS close_fake_file(files_struct *fsp); + +/* The following definitions come from smbd/file_access.c */ + +bool can_access_file_acl(struct connection_struct *conn, + const char * fname, + uint32_t access_mask); +bool can_delete_file_in_directory(connection_struct *conn, const char *fname); +bool can_access_file_data(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf, uint32 access_mask); +bool can_write_to_file(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf); +bool directory_has_default_acl(connection_struct *conn, const char *fname); + +/* The following definitions come from smbd/fileio.c */ + +ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n); +void trigger_write_time_update(struct files_struct *fsp); +void trigger_write_time_update_immediate(struct files_struct *fsp); +ssize_t write_file(struct smb_request *req, + files_struct *fsp, + const char *data, + SMB_OFF_T pos, + size_t n); +void delete_write_cache(files_struct *fsp); +void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size); +ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason); +NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through); +int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst); + +/* The following definitions come from smbd/filename.c */ + +NTSTATUS unix_convert(TALLOC_CTX *ctx, + connection_struct *conn, + const char *orig_path, + bool allow_wcard_last_component, + char **pp_conv_path, + char **pp_saved_last_component, + SMB_STRUCT_STAT *pst); +NTSTATUS check_name(connection_struct *conn, const char *name); + +/* The following definitions come from smbd/files.c */ + +NTSTATUS file_new(connection_struct *conn, files_struct **result); +void file_close_conn(connection_struct *conn); +void file_close_pid(uint16 smbpid, int vuid); +void file_init(void); +void file_close_user(int vuid); +void file_dump_open_table(void); +files_struct *file_find_fd(int fd); +files_struct *file_find_dif(struct file_id id, unsigned long gen_id); +files_struct *file_find_fsp(files_struct *orig_fsp); +files_struct *file_find_di_first(struct file_id id); +files_struct *file_find_di_next(files_struct *start_fsp); +files_struct *file_find_print(void); +void file_sync_all(connection_struct *conn); +void file_free(files_struct *fsp); +files_struct *file_fnum(uint16 fnum); +files_struct *file_fsp(uint16 fid); +void file_chain_reset(void); +NTSTATUS dup_file_fsp(files_struct *fsp, + uint32 access_mask, + uint32 share_access, + uint32 create_options, + files_struct **result); + +/* The following definitions come from smbd/ipc.c */ + +void send_trans_reply(connection_struct *conn, + const uint8_t *inbuf, + char *rparam, int rparam_len, + char *rdata, int rdata_len, + bool buffer_too_large); +void reply_trans(struct smb_request *req); +void reply_transs(struct smb_request *req); + +/* The following definitions come from smbd/lanman.c */ + +void api_reply(connection_struct *conn, uint16 vuid, + struct smb_request *req, + char *data, char *params, + int tdscnt, int tpscnt, + int mdrcnt, int mprcnt); + +/* The following definitions come from smbd/mangle.c */ + +void mangle_reset_cache(void); +void mangle_change_to_posix(void); +bool mangle_is_mangled(const char *s, const struct share_params *p); +bool mangle_is_8_3(const char *fname, bool check_case, + const struct share_params *p); +bool mangle_is_8_3_wildcards(const char *fname, bool check_case, + const struct share_params *p); +bool mangle_must_mangle(const char *fname, + const struct share_params *p); +bool mangle_lookup_name_from_8_3(TALLOC_CTX *ctx, + const char *in, + char **out, /* talloced on the given context. */ + const struct share_params *p); +bool name_to_8_3(const char *in, + char out[13], + bool cache83, + const struct share_params *p); + +/* The following definitions come from smbd/mangle_hash.c */ + +struct mangle_fns *mangle_hash_init(void); + +/* The following definitions come from smbd/mangle_hash2.c */ + +struct mangle_fns *mangle_hash2_init(void); +struct mangle_fns *posix_mangle_init(void); + +/* The following definitions come from smbd/map_username.c */ + +bool map_username(fstring user); + +/* The following definitions come from smbd/message.c */ + +void reply_sends(struct smb_request *req); +void reply_sendstrt(struct smb_request *req); +void reply_sendtxt(struct smb_request *req); +void reply_sendend(struct smb_request *req); + +/* The following definitions come from smbd/msdfs.c */ + +bool is_msdfs_link(connection_struct *conn, + const char *path, + SMB_STRUCT_STAT *sbufp); +NTSTATUS get_referred_path(TALLOC_CTX *ctx, + const char *dfs_path, + struct junction_map *jucn, + int *consumedcntp, + bool *self_referralp); +int setup_dfs_referral(connection_struct *orig_conn, + const char *dfs_path, + int max_referral_level, + char **ppdata, NTSTATUS *pstatus); +bool create_junction(TALLOC_CTX *ctx, + const char *dfs_path, + struct junction_map *jucn); +bool create_msdfs_link(const struct junction_map *jucn); +bool remove_msdfs_link(const struct junction_map *jucn); +struct junction_map *enum_msdfs_links(TALLOC_CTX *ctx, size_t *p_num_jn); +NTSTATUS resolve_dfspath(TALLOC_CTX *ctx, + connection_struct *conn, + bool dfs_pathnames, + const char *name_in, + char **pp_name_out); +NTSTATUS resolve_dfspath_wcard(TALLOC_CTX *ctx, + connection_struct *conn, + bool dfs_pathnames, + const char *name_in, + char **pp_name_out, + bool *ppath_contains_wcard); +NTSTATUS create_conn_struct(TALLOC_CTX *ctx, + connection_struct **pconn, + int snum, + const char *path, + char **poldcwd); + +/* The following definitions come from smbd/negprot.c */ + +void reply_negprot(struct smb_request *req); + +/* The following definitions come from smbd/notify.c */ + +void change_notify_reply(connection_struct *conn, + const uint8 *request_buf, uint32 max_param, + struct notify_change_buf *notify_buf); +NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter, + bool recursive); +NTSTATUS change_notify_add_request(const struct smb_request *req, + uint32 max_param, + uint32 filter, bool recursive, + struct files_struct *fsp); +void remove_pending_change_notify_requests_by_mid(uint16 mid); +void remove_pending_change_notify_requests_by_fid(files_struct *fsp, + NTSTATUS status); +void notify_fname(connection_struct *conn, uint32 action, uint32 filter, + const char *path); +char *notify_filter_string(TALLOC_CTX *mem_ctx, uint32 filter); +struct sys_notify_context *sys_notify_context_create(connection_struct *conn, + TALLOC_CTX *mem_ctx, + struct event_context *ev); +NTSTATUS sys_notify_watch(struct sys_notify_context *ctx, + struct notify_entry *e, + void (*callback)(struct sys_notify_context *ctx, + void *private_data, + struct notify_event *ev), + void *private_data, void *handle); + +/* The following definitions come from smbd/notify_inotify.c */ + +NTSTATUS inotify_watch(struct sys_notify_context *ctx, + struct notify_entry *e, + void (*callback)(struct sys_notify_context *ctx, + void *private_data, + struct notify_event *ev), + void *private_data, + void *handle_p); + +/* The following definitions come from smbd/notify_internal.c */ + +struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, + struct messaging_context *messaging_ctx, + struct event_context *ev, + connection_struct *conn); +NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0, + void (*callback)(void *, const struct notify_event *), + void *private_data); +NTSTATUS notify_remove(struct notify_context *notify, void *private_data); +void notify_trigger(struct notify_context *notify, + uint32_t action, uint32_t filter, const char *path); + +/* The following definitions come from smbd/ntquotas.c */ + +int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid, SMB_NTQUOTA_STRUCT *qt); +int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid, SMB_NTQUOTA_STRUCT *qt); +int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list); +void *init_quota_handle(TALLOC_CTX *mem_ctx); + +/* The following definitions come from smbd/nttrans.c */ + +void send_nt_replies(connection_struct *conn, + struct smb_request *req, NTSTATUS nt_error, + char *params, int paramsize, + char *pdata, int datasize); +bool is_ntfs_stream_name(const char *fname); +void reply_ntcreate_and_X(struct smb_request *req); +void reply_ntcancel(struct smb_request *req); +void reply_ntrename(struct smb_request *req); +void reply_nttrans(struct smb_request *req); +void reply_nttranss(struct smb_request *req); + +/* The following definitions come from smbd/open.c */ + +NTSTATUS fd_close(files_struct *fsp); +bool map_open_params_to_ntcreate(const char *fname, int deny_mode, int open_func, + uint32 *paccess_mask, + uint32 *pshare_mode, + uint32 *pcreate_disposition, + uint32 *pcreate_options); +NTSTATUS open_file_ntcreate(connection_struct *conn, + struct smb_request *req, + const char *fname, + SMB_STRUCT_STAT *psbuf, + uint32 access_mask, /* access bits (FILE_READ_DATA etc.) */ + uint32 share_access, /* share constants (FILE_SHARE_READ etc) */ + uint32 create_disposition, /* FILE_OPEN_IF etc. */ + uint32 create_options, /* options such as delete on close. */ + uint32 new_dos_attributes, /* attributes used for new file. */ + int oplock_request, /* internal Samba oplock codes. */ + /* Information (FILE_EXISTS etc.) */ + int *pinfo, + files_struct **result); +NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname, + SMB_STRUCT_STAT *psbuf, files_struct **result); +NTSTATUS close_file_fchmod(files_struct *fsp); +NTSTATUS open_directory(connection_struct *conn, + struct smb_request *req, + const char *fname, + SMB_STRUCT_STAT *psbuf, + uint32 access_mask, + uint32 share_access, + uint32 create_disposition, + uint32 create_options, + uint32 file_attributes, + int *pinfo, + files_struct **result); +NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, const char *directory); +void msg_file_was_renamed(struct messaging_context *msg, + void *private_data, + uint32_t msg_type, + struct server_id server_id, + DATA_BLOB *data); +NTSTATUS create_file_unixpath(connection_struct *conn, + struct smb_request *req, + const char *fname, + uint32_t access_mask, + uint32_t share_access, + uint32_t create_disposition, + uint32_t create_options, + uint32_t file_attributes, + uint32_t oplock_request, + SMB_BIG_UINT allocation_size, + struct security_descriptor *sd, + struct ea_list *ea_list, + + files_struct **result, + int *pinfo, + SMB_STRUCT_STAT *psbuf); +NTSTATUS create_file(connection_struct *conn, + struct smb_request *req, + uint16_t root_dir_fid, + const char *fname, + uint32_t access_mask, + uint32_t share_access, + uint32_t create_disposition, + uint32_t create_options, + uint32_t file_attributes, + uint32_t oplock_request, + SMB_BIG_UINT allocation_size, + struct security_descriptor *sd, + struct ea_list *ea_list, + + files_struct **result, + int *pinfo, + SMB_STRUCT_STAT *psbuf); + +/* The following definitions come from smbd/oplock.c */ + +int32 get_number_of_exclusive_open_oplocks(void); +bool oplock_message_waiting(fd_set *fds); +void process_kernel_oplocks(struct messaging_context *msg_ctx, fd_set *pfds); +bool set_file_oplock(files_struct *fsp, int oplock_type); +void release_file_oplock(files_struct *fsp); +bool remove_oplock(files_struct *fsp); +bool downgrade_oplock(files_struct *fsp); +int oplock_notify_fd(void); +void reply_to_oplock_break_requests(files_struct *fsp); +void release_level_2_oplocks_on_change(files_struct *fsp); +void share_mode_entry_to_message(char *msg, const struct share_mode_entry *e); +void message_to_share_mode_entry(struct share_mode_entry *e, char *msg); +bool init_oplocks(struct messaging_context *msg_ctx); + +/* The following definitions come from smbd/oplock_irix.c */ + +struct kernel_oplocks *irix_init_kernel_oplocks(void) ; + +/* The following definitions come from smbd/oplock_linux.c */ + +void linux_set_lease_capability(void); +int linux_set_lease_sighandler(int fd); +int linux_setlease(int fd, int leasetype); +struct kernel_oplocks *linux_init_kernel_oplocks(void) ; + +/* The following definitions come from smbd/password.c */ + +user_struct *get_valid_user_struct(uint16 vuid); +bool is_partial_auth_vuid(uint16 vuid); +user_struct *get_partial_auth_user_struct(uint16 vuid); +void invalidate_vuid(uint16 vuid); +void invalidate_all_vuids(void); +int register_initial_vuid(void); +int register_existing_vuid(uint16 vuid, + auth_serversupplied_info *server_info, + DATA_BLOB response_blob, + const char *smb_name); +void add_session_user(const char *user); +void add_session_workgroup(const char *workgroup); +const char *get_session_workgroup(void); +bool user_in_netgroup(const char *user, const char *ngname); +bool user_in_list(const char *user,const char **list); +bool authorise_login(int snum, fstring user, DATA_BLOB password, + bool *guest); + +/* The following definitions come from smbd/pipes.c */ + +void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req); +void reply_pipe_write(struct smb_request *req); +void reply_pipe_write_and_X(struct smb_request *req); +void reply_pipe_read_and_X(struct smb_request *req); +void reply_pipe_close(connection_struct *conn, struct smb_request *req); + +/* The following definitions come from smbd/posix_acls.c */ + +NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, SEC_DESC *psd); +SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl); +NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info, + SEC_DESC **ppdesc); +NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name, + uint32_t security_info, SEC_DESC **ppdesc); +int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid); +NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd); +int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode ); +int chmod_acl(connection_struct *conn, const char *name, mode_t mode); +int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir, + const char *name, mode_t mode); +int fchmod_acl(files_struct *fsp, mode_t mode); +bool set_unix_posix_default_acl(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf, + uint16 num_def_acls, const char *pdata); +bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp, const char *fname, uint16 num_acls, const char *pdata); +SEC_DESC *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fname); + +/* The following definitions come from smbd/process.c */ + +bool srv_send_smb(int fd, char *buffer, bool do_encrypt); +int srv_set_message(char *buf, + int num_words, + int num_bytes, + bool zero); +void init_smb_request(struct smb_request *req, + const uint8 *inbuf, + size_t unread_bytes, + bool encrypted); +void remove_deferred_open_smb_message(uint16 mid); +void schedule_deferred_open_smb_message(uint16 mid); +bool open_was_deferred(uint16 mid); +struct pending_message_list *get_open_deferred_message(uint16 mid); +bool push_deferred_smb_message(struct smb_request *req, + struct timeval request_time, + struct timeval timeout, + char *private_data, size_t priv_len); +struct idle_event *event_add_idle(struct event_context *event_ctx, + TALLOC_CTX *mem_ctx, + struct timeval interval, + const char *name, + bool (*handler)(const struct timeval *now, + void *private_data), + void *private_data); +NTSTATUS allow_new_trans(struct trans_state *list, int mid); +void respond_to_all_remaining_local_messages(void); +bool create_outbuf(TALLOC_CTX *mem_ctx, const char *inbuf, char **outbuf, + uint8_t num_words, uint32_t num_bytes); +void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes); +const char *smb_fn_name(int type); +void add_to_common_flags2(uint32 v); +void remove_from_common_flags2(uint32 v); +void construct_reply_common(const char *inbuf, char *outbuf); +void chain_reply(struct smb_request *req); +void check_reload(time_t t); +void smbd_process(void); + +/* The following definitions come from smbd/quotas.c */ + +bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); +bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); +bool disk_quotas(const char *path, + SMB_BIG_UINT *bsize, + SMB_BIG_UINT *dfree, + SMB_BIG_UINT *dsize); +bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); +bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); +bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); +bool disk_quotas_vxfs(const char *name, char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); +bool disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize); +bool disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize); + +/* The following definitions come from smbd/reply.c */ + +NTSTATUS check_path_syntax(char *path); +NTSTATUS check_path_syntax_wcard(char *path, bool *p_contains_wcard); +NTSTATUS check_path_syntax_posix(char *path); +size_t srvstr_get_path_wcard(TALLOC_CTX *ctx, + const char *inbuf, + uint16 smb_flags2, + char **pp_dest, + const char *src, + size_t src_len, + int flags, + NTSTATUS *err, + bool *contains_wcard); +size_t srvstr_get_path(TALLOC_CTX *ctx, + const char *inbuf, + uint16 smb_flags2, + char **pp_dest, + const char *src, + size_t src_len, + int flags, + NTSTATUS *err); +bool check_fsp_open(connection_struct *conn, struct smb_request *req, + files_struct *fsp); +bool check_fsp(connection_struct *conn, struct smb_request *req, + files_struct *fsp); +bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req, + files_struct *fsp); +bool fsp_belongs_conn(connection_struct *conn, struct smb_request *req, + files_struct *fsp); +void reply_special(char *inbuf); +void reply_tcon(struct smb_request *req); +void reply_tcon_and_X(struct smb_request *req); +void reply_unknown_new(struct smb_request *req, uint8 type); +void reply_ioctl(struct smb_request *req); +void reply_checkpath(struct smb_request *req); +void reply_getatr(struct smb_request *req); +void reply_setatr(struct smb_request *req); +void reply_dskattr(struct smb_request *req); +void reply_search(struct smb_request *req); +void reply_fclose(struct smb_request *req); +void reply_open(struct smb_request *req); +void reply_open_and_X(struct smb_request *req); +void reply_ulogoffX(struct smb_request *req); +void reply_mknew(struct smb_request *req); +void reply_ctemp(struct smb_request *req); +NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, + uint32 dirtype, const char *name_in, bool has_wild); +void reply_unlink(struct smb_request *req); +void send_file_readbraw(connection_struct *conn, + files_struct *fsp, + SMB_OFF_T startpos, + size_t nread, + ssize_t mincount); +void reply_readbraw(struct smb_request *req); +void reply_lockread(struct smb_request *req); +void reply_read(struct smb_request *req); +void reply_read_and_X(struct smb_request *req); +void error_to_writebrawerr(struct smb_request *req); +void reply_writebraw(struct smb_request *req); +void reply_writeunlock(struct smb_request *req); +void reply_write(struct smb_request *req); +bool is_valid_writeX_buffer(const uint8_t *inbuf); +void reply_write_and_X(struct smb_request *req); +void reply_lseek(struct smb_request *req); +void reply_flush(struct smb_request *req); +void reply_exit(struct smb_request *req); +void reply_close(struct smb_request *req); +void reply_writeclose(struct smb_request *req); +void reply_lock(struct smb_request *req); +void reply_unlock(struct smb_request *req); +void reply_tdis(struct smb_request *req); +void reply_echo(struct smb_request *req); +void reply_printopen(struct smb_request *req); +void reply_printclose(struct smb_request *req); +void reply_printqueue(struct smb_request *req); +void reply_printwrite(struct smb_request *req); +void reply_mkdir(struct smb_request *req); +NTSTATUS rmdir_internals(TALLOC_CTX *ctx, + connection_struct *conn, + const char *directory); +void reply_rmdir(struct smb_request *req); +NTSTATUS rename_internals_fsp(connection_struct *conn, + files_struct *fsp, + char *newname, + const char *newname_last_component, + uint32 attrs, + bool replace_if_exists); +NTSTATUS rename_internals(TALLOC_CTX *ctx, + connection_struct *conn, + struct smb_request *req, + const char *name_in, + const char *newname_in, + uint32 attrs, + bool replace_if_exists, + bool src_has_wild, + bool dest_has_wild, + uint32_t access_mask); +void reply_mv(struct smb_request *req); +NTSTATUS copy_file(TALLOC_CTX *ctx, + connection_struct *conn, + const char *src, + const char *dest1, + int ofun, + int count, + bool target_is_directory); +void reply_copy(struct smb_request *req); +uint32 get_lock_pid( char *data, int data_offset, bool large_file_format); +SMB_BIG_UINT get_lock_count( char *data, int data_offset, bool large_file_format); +SMB_BIG_UINT get_lock_offset( char *data, int data_offset, bool large_file_format, bool *err); +void reply_lockingX(struct smb_request *req); +void reply_readbmpx(struct smb_request *req); +void reply_readbs(struct smb_request *req); +void reply_setattrE(struct smb_request *req); +void reply_writebmpx(struct smb_request *req); +void reply_writebs(struct smb_request *req); +void reply_getattrE(struct smb_request *req); + +/* The following definitions come from smbd/seal.c */ + +uint16_t srv_enc_ctx(void); +bool is_encrypted_packet(const uint8_t *inbuf); +void srv_free_enc_buffer(char *buf); +NTSTATUS srv_decrypt_buffer(char *buf); +NTSTATUS srv_encrypt_buffer(char *buf, char **buf_out); +NTSTATUS srv_request_encryption_setup(connection_struct *conn, + unsigned char **ppdata, + size_t *p_data_size, + unsigned char **pparam, + size_t *p_param_size); +NTSTATUS srv_encryption_start(connection_struct *conn); +void server_encryption_shutdown(void); + +/* The following definitions come from smbd/sec_ctx.c */ + +bool unix_token_equal(const UNIX_USER_TOKEN *t1, const UNIX_USER_TOKEN *t2); +bool push_sec_ctx(void); +void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups, NT_USER_TOKEN *token); +void set_root_sec_ctx(void); +bool pop_sec_ctx(void); +void init_sec_ctx(void); + +/* The following definitions come from smbd/server.c */ + +int smbd_server_fd(void); +int get_client_fd(void); +int client_get_tcp_info(struct sockaddr_in *server, struct sockaddr_in *client); +struct event_context *smbd_event_context(void); +struct messaging_context *smbd_messaging_context(void); +struct memcache *smbd_memcache(void); +void reload_printers(void); +bool reload_services(bool test); +void exit_server(const char *const explanation); +void exit_server_cleanly(const char *const explanation); +void exit_server_fault(void); + +/* The following definitions come from smbd/service.c */ + +bool set_conn_connectpath(connection_struct *conn, const char *connectpath); +bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir); +void load_registry_shares(void); +int add_home_service(const char *service, const char *username, const char *homedir); +int find_service(fstring service); +connection_struct *make_connection_with_chdir(const char *service_in, + DATA_BLOB password, + const char *dev, uint16 vuid, + NTSTATUS *status); +connection_struct *make_connection(const char *service_in, DATA_BLOB password, + const char *pdev, uint16 vuid, + NTSTATUS *status); +void close_cnum(connection_struct *conn, uint16 vuid); + +/* The following definitions come from smbd/session.c */ + +bool session_init(void); +bool session_claim(user_struct *vuser); +void session_yield(user_struct *vuser); +int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list); + +/* The following definitions come from smbd/sesssetup.c */ + +NTSTATUS parse_spnego_mechanisms(DATA_BLOB blob_in, + DATA_BLOB *pblob_out, + char **kerb_mechOID); +void reply_sesssetup_and_X(struct smb_request *req); + +/* The following definitions come from smbd/share_access.c */ + +bool token_contains_name_in_list(const char *username, + const char *domain, + const char *sharename, + const struct nt_user_token *token, + const char **list); +bool user_ok_token(const char *username, const char *domain, + struct nt_user_token *token, int snum); +bool is_share_read_only_for_token(const char *username, + const char *domain, + struct nt_user_token *token, int snum); + +/* The following definitions come from smbd/srvstr.c */ + +size_t srvstr_push_fn(const char *function, unsigned int line, + const char *base_ptr, uint16 smb_flags2, void *dest, + const char *src, int dest_len, int flags); +ssize_t message_push_string(uint8 **outbuf, const char *str, int flags); + +/* The following definitions come from smbd/statcache.c */ + +void stat_cache_add( const char *full_orig_name, + char *translated_path, + bool case_sensitive); +bool stat_cache_lookup(connection_struct *conn, + char **pp_name, + char **pp_dirpath, + char **pp_start, + SMB_STRUCT_STAT *pst); +void send_stat_cache_delete_message(const char *name); +void stat_cache_delete(const char *name); +unsigned int fast_string_hash(TDB_DATA *key); +bool reset_stat_cache( void ); + +/* The following definitions come from smbd/statvfs.c */ + +int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf); + +/* The following definitions come from smbd/trans2.c */ + +SMB_BIG_UINT smb_roundup(connection_struct *conn, SMB_BIG_UINT val); +SMB_BIG_UINT get_allocation_size(connection_struct *conn, files_struct *fsp, const SMB_STRUCT_STAT *sbuf); +NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, + files_struct *fsp, const char *fname, + const char *ea_name, struct ea_struct *pea); +NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, + files_struct *fsp, const char *fname, + char ***pnames, size_t *pnum_names); +NTSTATUS set_ea(connection_struct *conn, files_struct *fsp, const char *fname, struct ea_list *ea_list); +struct ea_list *read_ea_list_entry(TALLOC_CTX *ctx, const char *pdata, size_t data_size, size_t *pbytes_used); +void send_trans2_replies(connection_struct *conn, + struct smb_request *req, + const char *params, + int paramsize, + const char *pdata, + int datasize, + int max_data_bytes); +unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]); +NTSTATUS hardlink_internals(TALLOC_CTX *ctx, + connection_struct *conn, + const char *oldname_in, + const char *newname_in); +NTSTATUS smb_set_file_time(connection_struct *conn, + files_struct *fsp, + const char *fname, + const SMB_STRUCT_STAT *psbuf, + struct timespec ts[2], + bool setting_write_time); +void reply_findclose(struct smb_request *req); +void reply_findnclose(struct smb_request *req); +void reply_trans2(struct smb_request *req); +void reply_transs2(struct smb_request *req); + +/* The following definitions come from smbd/uid.c */ + +bool change_to_guest(void); +void conn_clear_vuid_cache(connection_struct *conn, uint16_t vuid); +bool change_to_user(connection_struct *conn, uint16 vuid); +bool change_to_root_user(void); +bool become_authenticated_pipe_user(pipes_struct *p); +bool unbecome_authenticated_pipe_user(void); +void become_root(void); +void unbecome_root(void); +bool become_user(connection_struct *conn, uint16 vuid); +bool unbecome_user(void); + +/* The following definitions come from smbd/utmp.c */ + +void sys_utmp_claim(const char *username, const char *hostname, + const char *ip_addr_str, + const char *id_str, int id_num); +void sys_utmp_yield(const char *username, const char *hostname, + const char *ip_addr_str, + const char *id_str, int id_num); +void sys_utmp_yield(const char *username, const char *hostname, + const char *ip_addr_str, + const char *id_str, int id_num); +void sys_utmp_claim(const char *username, const char *hostname, + const char *ip_addr_str, + const char *id_str, int id_num); + +/* The following definitions come from smbd/vfs.c */ + +NTSTATUS smb_register_vfs(int version, const char *name, const vfs_op_tuple *vfs_op_tuples); +bool vfs_init_custom(connection_struct *conn, const char *vfs_object); +void *vfs_add_fsp_extension_notype(vfs_handle_struct *handle, files_struct *fsp, size_t ext_size); +void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp); +void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp); +void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp); +bool smbd_vfs_init(connection_struct *conn); +bool vfs_directory_exist(connection_struct *conn, const char *dname, SMB_STRUCT_STAT *st); +bool vfs_object_exist(connection_struct *conn,const char *fname,SMB_STRUCT_STAT *sbuf); +bool vfs_file_exist(connection_struct *conn, const char *fname,SMB_STRUCT_STAT *sbuf); +ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count); +ssize_t vfs_pread_data(files_struct *fsp, char *buf, + size_t byte_count, SMB_OFF_T offset); +ssize_t vfs_write_data(struct smb_request *req, + files_struct *fsp, + const char *buffer, + size_t N); +ssize_t vfs_pwrite_data(struct smb_request *req, + files_struct *fsp, + const char *buffer, + size_t N, + SMB_OFF_T offset); +int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len); +int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len); +int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len); +SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n); +char *vfs_readdirname(connection_struct *conn, void *p); +int vfs_ChDir(connection_struct *conn, const char *path); +char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn); +NTSTATUS check_reduced_name(connection_struct *conn, const char *fname); + +/* The following definitions come from torture/denytest.c */ + +bool torture_denytest1(int dummy); +bool torture_denytest2(int dummy); + +/* The following definitions come from torture/mangle_test.c */ + +bool torture_mangle(int dummy); + +/* The following definitions come from torture/nbio.c */ + +double nbio_total(void); +void nb_alarm(int ignore); +void nbio_shmem(int n); +void nb_setup(struct cli_state *cli); +void nb_unlink(const char *fname); +void nb_createx(const char *fname, + unsigned create_options, unsigned create_disposition, int handle); +void nb_writex(int handle, int offset, int size, int ret_size); +void nb_readx(int handle, int offset, int size, int ret_size); +void nb_close(int handle); +void nb_rmdir(const char *fname); +void nb_rename(const char *oldname, const char *newname); +void nb_qpathinfo(const char *fname); +void nb_qfileinfo(int fnum); +void nb_qfsinfo(int level); +void nb_findfirst(const char *mask); +void nb_flush(int fnum); +void nb_deltree(const char *dname); +void nb_cleanup(void); + +/* The following definitions come from torture/scanner.c */ + +bool torture_trans2_scan(int dummy); +bool torture_nttrans_scan(int dummy); + +/* The following definitions come from torture/torture.c */ + +void start_timer(void); +double end_timer(void); +void *shm_setup(int size); +bool smbcli_parse_unc(const char *unc_name, TALLOC_CTX *mem_ctx, + char **hostname, char **sharename); +void torture_open_connection_free_unclist(char **unc_list); +bool torture_open_connection(struct cli_state **c, int conn_index); +bool torture_cli_session_setup2(struct cli_state *cli, uint16 *new_vuid); +bool torture_close_connection(struct cli_state *c); +bool torture_ioctl_test(int dummy); +bool torture_chkpath_test(int dummy); + +/* The following definitions come from torture/utable.c */ + +bool torture_utable(int dummy); +bool torture_casetable(int dummy); + +/* The following definitions come from utils/passwd_util.c */ + +char *stdin_new_passwd( void); +char *get_pass( const char *prompt, bool stdin_get); + +/* The following definitions come from winbindd/idmap.c */ + +bool idmap_is_offline(void); +bool idmap_is_online(void); +NTSTATUS smb_register_idmap(int version, const char *name, + struct idmap_methods *methods); +NTSTATUS smb_register_idmap_alloc(int version, const char *name, + struct idmap_alloc_methods *methods); +void idmap_close(void); +NTSTATUS idmap_init_cache(void); +NTSTATUS idmap_allocate_uid(struct unixid *id); +NTSTATUS idmap_allocate_gid(struct unixid *id); +NTSTATUS idmap_set_uid_hwm(struct unixid *id); +NTSTATUS idmap_set_gid_hwm(struct unixid *id); +NTSTATUS idmap_backends_unixid_to_sid(const char *domname, + struct id_map *id); +NTSTATUS idmap_backends_sid_to_unixid(const char *domname, + struct id_map *id); +NTSTATUS idmap_new_mapping(const struct dom_sid *psid, enum id_type type, + struct unixid *pxid); +NTSTATUS idmap_set_mapping(const struct id_map *map); + +/* The following definitions come from winbindd/idmap_cache.c */ + +bool idmap_cache_find_sid2uid(const struct dom_sid *sid, uid_t *puid, + bool *expired); +bool idmap_cache_find_uid2sid(uid_t uid, struct dom_sid *sid, bool *expired); +void idmap_cache_set_sid2uid(const struct dom_sid *sid, uid_t uid); +bool idmap_cache_find_sid2gid(const struct dom_sid *sid, gid_t *pgid, + bool *expired); +bool idmap_cache_find_gid2sid(gid_t gid, struct dom_sid *sid, bool *expired); +void idmap_cache_set_sid2gid(const struct dom_sid *sid, gid_t gid); + + +/* The following definitions come from winbindd/idmap_nss.c */ + +NTSTATUS idmap_nss_init(void); + +/* The following definitions come from winbindd/idmap_passdb.c */ + +NTSTATUS idmap_passdb_init(void); + +/* The following definitions come from winbindd/idmap_tdb.c */ + +bool idmap_tdb_tdb_close(TDB_CONTEXT *tdbctx); +NTSTATUS idmap_alloc_tdb_init(void); +NTSTATUS idmap_tdb_init(void); + +/* The following definitions come from winbindd/idmap_util.c */ + +NTSTATUS idmap_uid_to_sid(const char *domname, DOM_SID *sid, uid_t uid); +NTSTATUS idmap_gid_to_sid(const char *domname, DOM_SID *sid, gid_t gid); +NTSTATUS idmap_sid_to_uid(const char *dom_name, DOM_SID *sid, uid_t *uid); +NTSTATUS idmap_sid_to_gid(const char *domname, DOM_SID *sid, gid_t *gid); + +/* The following definitions come from winbindd/nss_info.c */ + + +/* The following definitions come from winbindd/nss_info_template.c */ + +NTSTATUS nss_info_template_init( void ); + +#endif /* _PROTO_H_ */ diff --git a/source3/include/rap.h b/source3/include/rap.h new file mode 100644 index 0000000000..a7efb67d60 --- /dev/null +++ b/source3/include/rap.h @@ -0,0 +1,506 @@ +/* + Samba Unix/Linux SMB client library + RAP (SMB Remote Procedure Calls) defines and structures + Copyright (C) Steve French 2001 (sfrench@us.ibm.com) + Copyright (C) Jim McDonough 2001 (jmcd@us.ibm.com) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _RAP_H_ +#define _RAP_H_ + +/*****************************************************/ +/* */ +/* Additional RAP functionality */ +/* */ +/* RAP is the original SMB RPC, documented */ +/* by Microsoft and X/Open in the 1990s and */ +/* supported by most SMB/CIFS servers although */ +/* it is unlikely that any one implementation */ +/* supports all RAP command codes since some */ +/* are quite obsolete and a few are specific */ +/* to a particular network operating system */ +/* */ +/* Although it has largely been replaced */ +/* for complex remote admistration and management */ +/* (of servers) by the relatively newer */ +/* DCE/RPC based remote API (which better handles */ +/* large >64K data structures), there are many */ +/* important administrative and resource location */ +/* tasks and user tasks (e.g. password change) */ +/* that are performed via RAP. */ +/* */ +/* Although a few of the RAP calls are implemented */ +/* in the Samba client library already (clirap.c) */ +/* the new ones are in clirap2.c for easy patching */ +/* and integration and a corresponding header */ +/* file, rap.h, has been created. */ +/* */ +/* This is based on data from the CIFS spec */ +/* and the LAN Server and LAN Manager */ +/* Programming Reference books and published */ +/* RAP document and CIFS forum postings and */ +/* lots of trial and error. Additional */ +/* background information is available from the */ +/* X/Open reference book in their PC Interworking */ +/* series "IPC for SMB" and also from the */ +/* interoperability documentation in */ +/* ftp://ftp.microsoft.com/developr/drg/cifs */ +/* */ +/* Function names changed from API_ (as they are */ +/* in the CIFS specification to RAP_ in order */ +/* to avoid confusion with other API calls */ +/* sent via DCE RPC */ +/* */ +/*****************************************************/ + +/*****************************************************/ +/* */ +/* Although without pound defines (of this header) */ +/* cifsrap.c already includes support for: */ +/* */ +/* WshareEnum (API number 0, level 1) */ +/* NetServerEnum2 (API num 104, level 1) */ +/* WWkstaUserLogon (132) */ +/* SamOEMchgPasswordUser2_P (214) */ +/* */ +/* and cifsprint.c already includes support for: */ +/* */ +/* WPrintJobEnum (API num 76, level 2) */ +/* WPrintJobDel (API num 81) */ +/* */ +/*****************************************************/ + +#define RAP_WshareEnum 0 +#define RAP_WshareGetInfo 1 +#define RAP_WshareSetInfo 2 +#define RAP_WshareAdd 3 +#define RAP_WshareDel 4 +#define RAP_NetShareCheck 5 +#define RAP_WsessionEnum 6 +#define RAP_WsessionGetInfo 7 +#define RAP_WsessionDel 8 +#define RAP_WconnectionEnum 9 +#define RAP_WfileEnum 10 +#define RAP_WfileGetInfo 11 +#define RAP_WfileClose 12 +#define RAP_WserverGetInfo 13 +#define RAP_WserverSetInfo 14 +#define RAP_WserverDiskEnum 15 +#define RAP_WserverAdminCommand 16 +#define RAP_NetAuditOpen 17 +#define RAP_WauditClear 18 +#define RAP_NetErrorLogOpen 19 +#define RAP_WerrorLogClear 20 +#define RAP_NetCharDevEnum 21 +#define RAP_NetCharDevGetInfo 22 +#define RAP_WCharDevControl 23 +#define RAP_NetCharDevQEnum 24 +#define RAP_NetCharDevQGetInfo 25 +#define RAP_WCharDevQSetInfo 26 +#define RAP_WCharDevQPurge 27 +#define RAP_WCharDevQPurgeSelf 28 +#define RAP_WMessageNameEnum 29 +#define RAP_WMessageNameGetInfo 30 +#define RAP_WMessageNameAdd 31 +#define RAP_WMessageNameDel 32 +#define RAP_WMessageNameFwd 33 +#define RAP_WMessageNameUnFwd 34 +#define RAP_WMessageBufferSend 35 +#define RAP_WMessageFileSend 36 +#define RAP_WMessageLogFileSet 37 +#define RAP_WMessageLogFileGet 38 +#define RAP_WServiceEnum 39 +#define RAP_WServiceInstall 40 +#define RAP_WServiceControl 41 +#define RAP_WAccessEnum 42 +#define RAP_WAccessGetInfo 43 +#define RAP_WAccessSetInfo 44 +#define RAP_WAccessAdd 45 +#define RAP_WAccessDel 46 +#define RAP_WGroupEnum 47 +#define RAP_WGroupAdd 48 +#define RAP_WGroupDel 49 +#define RAP_WGroupAddUser 50 +#define RAP_WGroupDelUser 51 +#define RAP_WGroupGetUsers 52 +#define RAP_WUserEnum 53 +#define RAP_WUserAdd 54 +#define RAP_WUserDel 55 +#define RAP_WUserGetInfo 56 +#define RAP_WUserSetInfo 57 +#define RAP_WUserPasswordSet 58 +#define RAP_WUserGetGroups 59 +#define RAP_WWkstaSetUID 62 +#define RAP_WWkstaGetInfo 63 +#define RAP_WWkstaSetInfo 64 +#define RAP_WUseEnum 65 +#define RAP_WUseAdd 66 +#define RAP_WUseDel 67 +#define RAP_WUseGetInfo 68 +#define RAP_WPrintQEnum 69 +#define RAP_WPrintQGetInfo 70 +#define RAP_WPrintQSetInfo 71 +#define RAP_WPrintQAdd 72 +#define RAP_WPrintQDel 73 +#define RAP_WPrintQPause 74 +#define RAP_WPrintQContinue 75 +#define RAP_WPrintJobEnum 76 +#define RAP_WPrintJobGetInfo 77 +#define RAP_WPrintJobSetInfo_OLD 78 +#define RAP_WPrintJobDel 81 +#define RAP_WPrintJobPause 82 +#define RAP_WPrintJobContinue 83 +#define RAP_WPrintDestEnum 84 +#define RAP_WPrintDestGetInfo 85 +#define RAP_WPrintDestControl 86 +#define RAP_WProfileSave 87 +#define RAP_WProfileLoad 88 +#define RAP_WStatisticsGet 89 +#define RAP_WStatisticsClear 90 +#define RAP_NetRemoteTOD 91 +#define RAP_WNetBiosEnum 92 +#define RAP_WNetBiosGetInfo 93 +#define RAP_NetServerEnum 94 +#define RAP_I_NetServerEnum 95 +#define RAP_WServiceGetInfo 96 +#define RAP_WPrintQPurge 103 +#define RAP_NetServerEnum2 104 +#define RAP_WAccessGetUserPerms 105 +#define RAP_WGroupGetInfo 106 +#define RAP_WGroupSetInfo 107 +#define RAP_WGroupSetUsers 108 +#define RAP_WUserSetGroups 109 +#define RAP_WUserModalsGet 110 +#define RAP_WUserModalsSet 111 +#define RAP_WFileEnum2 112 +#define RAP_WUserAdd2 113 +#define RAP_WUserSetInfo2 114 +#define RAP_WUserPasswordSet2 115 +#define RAP_I_NetServerEnum2 116 +#define RAP_WConfigGet2 117 +#define RAP_WConfigGetAll2 118 +#define RAP_WGetDCName 119 +#define RAP_NetHandleGetInfo 120 +#define RAP_NetHandleSetInfo 121 +#define RAP_WStatisticsGet2 122 +#define RAP_WBuildGetInfo 123 +#define RAP_WFileGetInfo2 124 +#define RAP_WFileClose2 125 +#define RAP_WNetServerReqChallenge 126 +#define RAP_WNetServerAuthenticate 127 +#define RAP_WNetServerPasswordSet 128 +#define RAP_WNetAccountDeltas 129 +#define RAP_WNetAccountSync 130 +#define RAP_WUserEnum2 131 +#define RAP_WWkstaUserLogon 132 +#define RAP_WWkstaUserLogoff 133 +#define RAP_WLogonEnum 134 +#define RAP_WErrorLogRead 135 +#define RAP_NetPathType 136 +#define RAP_NetPathCanonicalize 137 +#define RAP_NetPathCompare 138 +#define RAP_NetNameValidate 139 +#define RAP_NetNameCanonicalize 140 +#define RAP_NetNameCompare 141 +#define RAP_WAuditRead 142 +#define RAP_WPrintDestAdd 143 +#define RAP_WPrintDestSetInfo 144 +#define RAP_WPrintDestDel 145 +#define RAP_WUserValidate2 146 +#define RAP_WPrintJobSetInfo 147 +#define RAP_TI_NetServerDiskEnum 148 +#define RAP_TI_NetServerDiskGetInfo 149 +#define RAP_TI_FTVerifyMirror 150 +#define RAP_TI_FTAbortVerify 151 +#define RAP_TI_FTGetInfo 152 +#define RAP_TI_FTSetInfo 153 +#define RAP_TI_FTLockDisk 154 +#define RAP_TI_FTFixError 155 +#define RAP_TI_FTAbortFix 156 +#define RAP_TI_FTDiagnoseError 157 +#define RAP_TI_FTGetDriveStats 158 +#define RAP_TI_FTErrorGetInfo 160 +#define RAP_NetAccessCheck 163 +#define RAP_NetAlertRaise 164 +#define RAP_NetAlertStart 165 +#define RAP_NetAlertStop 166 +#define RAP_NetAuditWrite 167 +#define RAP_NetIRemoteAPI 168 +#define RAP_NetServiceStatus 169 +#define RAP_NetServerRegister 170 +#define RAP_NetServerDeregister 171 +#define RAP_NetSessionEntryMake 172 +#define RAP_NetSessionEntryClear 173 +#define RAP_NetSessionEntryGetInfo 174 +#define RAP_NetSessionEntrySetInfo 175 +#define RAP_NetConnectionEntryMake 176 +#define RAP_NetConnectionEntryClear 177 +#define RAP_NetConnectionEntrySetInfo 178 +#define RAP_NetConnectionEntryGetInfo 179 +#define RAP_NetFileEntryMake 180 +#define RAP_NetFileEntryClear 181 +#define RAP_NetFileEntrySetInfo 182 +#define RAP_NetFileEntryGetInfo 183 +#define RAP_AltSrvMessageBufferSend 184 +#define RAP_AltSrvMessageFileSend 185 +#define RAP_wI_NetRplWkstaEnum 186 +#define RAP_wI_NetRplWkstaGetInfo 187 +#define RAP_wI_NetRplWkstaSetInfo 188 +#define RAP_wI_NetRplWkstaAdd 189 +#define RAP_wI_NetRplWkstaDel 190 +#define RAP_wI_NetRplProfileEnum 191 +#define RAP_wI_NetRplProfileGetInfo 192 +#define RAP_wI_NetRplProfileSetInfo 193 +#define RAP_wI_NetRplProfileAdd 194 +#define RAP_wI_NetRplProfileDel 195 +#define RAP_wI_NetRplProfileClone 196 +#define RAP_wI_NetRplBaseProfileEnum 197 +#define RAP_WIServerSetInfo 201 +#define RAP_WPrintDriverEnum 205 +#define RAP_WPrintQProcessorEnum 206 +#define RAP_WPrintPortEnum 207 +#define RAP_WNetWriteUpdateLog 208 +#define RAP_WNetAccountUpdate 209 +#define RAP_WNetAccountConfirmUpdate 210 +#define RAP_WConfigSet 211 +#define RAP_WAccountsReplicate 212 +#define RAP_SamOEMChgPasswordUser2_P 214 +#define RAP_NetServerEnum3 215 +#define RAP_WprintDriverGetInfo 250 +#define RAP_WprintDriverSetInfo 251 +#define RAP_WaliasAdd 252 +#define RAP_WaliasDel 253 +#define RAP_WaliasGetInfo 254 +#define RAP_WaliasSetInfo 255 +#define RAP_WaliasEnum 256 +#define RAP_WuserGetLogonAsn 257 +#define RAP_WuserSetLogonAsn 258 +#define RAP_WuserGetAppSel 259 +#define RAP_WuserSetAppSel 260 +#define RAP_WappAdd 261 +#define RAP_WappDel 262 +#define RAP_WappGetInfo 263 +#define RAP_WappSetInfo 264 +#define RAP_WappEnum 265 +#define RAP_WUserDCDBInit 266 +#define RAP_WDASDAdd 267 +#define RAP_WDASDDel 268 +#define RAP_WDASDGetInfo 269 +#define RAP_WDASDSetInfo 270 +#define RAP_WDASDEnum 271 +#define RAP_WDASDCheck 272 +#define RAP_WDASDCtl 273 +#define RAP_WuserRemoteLogonCheck 274 +#define RAP_WUserPasswordSet3 275 +#define RAP_WCreateRIPLMachine 276 +#define RAP_WDeleteRIPLMachine 277 +#define RAP_WGetRIPLMachineInfo 278 +#define RAP_WSetRIPLMachineInfo 279 +#define RAP_WEnumRIPLMachine 280 +#define RAP_I_ShareAdd 281 +#define RAP_AliasEnum 282 +#define RAP_WaccessApply 283 +#define RAP_WPrt16Query 284 +#define RAP_WPrt16Set 285 +#define RAP_WUserDel100 286 +#define RAP_WUserRemoteLogonCheck2 287 +#define RAP_WRemoteTODSet 294 +#define RAP_WprintJobMoveAll 295 +#define RAP_W16AppParmAdd 296 +#define RAP_W16AppParmDel 297 +#define RAP_W16AppParmGet 298 +#define RAP_W16AppParmSet 299 +#define RAP_W16RIPLMachineCreate 300 +#define RAP_W16RIPLMachineGetInfo 301 +#define RAP_W16RIPLMachineSetInfo 302 +#define RAP_W16RIPLMachineEnum 303 +#define RAP_W16RIPLMachineListParmEnum 304 +#define RAP_W16RIPLMachClassGetInfo 305 +#define RAP_W16RIPLMachClassEnum 306 +#define RAP_W16RIPLMachClassCreate 307 +#define RAP_W16RIPLMachClassSetInfo 308 +#define RAP_W16RIPLMachClassDelete 309 +#define RAP_W16RIPLMachClassLPEnum 310 +#define RAP_W16RIPLMachineDelete 311 +#define RAP_W16WSLevelGetInfo 312 +#define RAP_WserverNameAdd 313 +#define RAP_WserverNameDel 314 +#define RAP_WserverNameEnum 315 +#define RAP_I_WDASDEnum 316 +#define RAP_WDASDEnumTerminate 317 +#define RAP_WDASDSetInfo2 318 +#define MAX_API 318 + + +/* Parameter description strings for RAP calls */ +/* Names are defined name for RAP call with _REQ */ +/* appended to end. */ + +#define RAP_WFileEnum2_REQ "zzWrLehb8g8" +#define RAP_WFileGetInfo2_REQ "DWrLh" +#define RAP_WFileClose2_REQ "D" + +#define RAP_NetGroupEnum_REQ "WrLeh" +#define RAP_NetGroupAdd_REQ "WsT" +#define RAP_NetGroupDel_REQ "z" +#define RAP_NetGroupAddUser_REQ "zz" +#define RAP_NetGroupDelUser_REQ "zz" +#define RAP_NetGroupGetUsers_REQ "zWrLeh" +#define RAP_NetGroupSetUsers_REQ "zWsTW" + +#define RAP_NetUserAdd2_REQ "WsTWW" +#define RAP_NetUserEnum_REQ "WrLeh" +#define RAP_NetUserEnum2_REQ "WrLDieh" +#define RAP_NetUserGetGroups_REQ "zWrLeh" +#define RAP_NetUserSetGroups_REQ "zWsTW" +#define RAP_NetUserPasswordSet_REQ "zb16b16w" +#define RAP_NetUserPasswordSet2_REQ "zb16b16WW" +#define RAP_SAMOEMChgPasswordUser2_REQ "B516B16" +#define RAP_NetUserValidate2_REQ "Wb62WWrLhWW" + +#define RAP_NetServerEnum2_REQ "WrLehDz" +#define RAP_WserverGetInfo_REQ "WrLh" +#define RAP_NetWkstatGetInfo "WrLh" + +#define RAP_WShareAdd_REQ "WsT" +#define RAP_WShareEnum_REQ "WrLeh" +#define RAP_WShareDel_REQ "zW" +#define RAP_WWkstaGetInfo_REQ "WrLh" + +#define RAP_NetPrintQEnum_REQ "WrLeh" +#define RAP_NetPrintQGetInfo_REQ "zWrLh" + +#define RAP_NetServerAdminCommand_REQ "zhrLeh" +#define RAP_NetServiceEnum_REQ "WrLeh" +#define RAP_NetServiceControl_REQ "zWWrL" +#define RAP_NetServiceInstall_REQ "zF88sg88T" +#define RAP_NetServiceGetInfo_REQ "zWrLh" +#define RAP_NetSessionEnum_REQ "WrLeh" +#define RAP_NetSessionGetInfo_REQ "zWrLh" +#define RAP_NetSessionDel_REQ "zW" + +#define RAP_NetConnectionEnum_REQ "zWrLeh" + +#define RAP_NetWkstaUserLogoff_REQ "zzWb38WrLh" + +/* Description strings for returned data in RAP calls */ +/* I use all caps here in part to avoid accidental */ +/* name collisions */ + +#define RAP_FILE_INFO_L2 "D" +#define RAP_FILE_INFO_L3 "DWWzz" + +#define RAP_GROUP_INFO_L0 "B21" +#define RAP_GROUP_INFO_L1 "B21Bz" +#define RAP_GROUP_USERS_INFO_0 "B21" +#define RAP_GROUP_USERS_INFO_1 "B21BN" + +#define RAP_USER_INFO_L0 "B21" +#define RAP_USER_INFO_L1 "B21BB16DWzzWz" + +#define RAP_SERVER_INFO_L0 "B16" +#define RAP_SERVER_INFO_L1 "B16BBDz" +#define RAP_SERVER_INFO_L2 "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWz" +#define RAP_SERVER_INFO_L3 "B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWzDWz" +#define RAP_SERVICE_INFO_L0 "B16" +#define RAP_SERVICE_INFO_L2 "B16WDWB64" +#define RAP_SHARE_INFO_L0 "B13" +#define RAP_SHARE_INFO_L1 "B13BWz" +#define RAP_SHARE_INFO_L2 "B13BWzWWWzB9B" + +#define RAP_PRINTQ_INFO_L2 "B13BWWWzzzzzWN" +#define RAP_SMB_PRINT_JOB_L1 "WB21BB16B10zWWzDDz" + +#define RAP_SESSION_INFO_L2 "zzWWWDDDz" +#define RAP_CONNECTION_INFO_L1 "WWWWDzz" + +#define RAP_USER_LOGOFF_INFO_L1 "WDW" + +#define RAP_WKSTA_INFO_L1 "WDzzzzBBDWDWWWWWWWWWWWWWWWWWWWzzWzzW" +#define RAP_WKSTA_INFO_L10 "zzzBBzz" + +/* BB explicit packing would help in structs below */ + +/* sizes of fixed-length fields, including null terminator */ +#define RAP_GROUPNAME_LEN 21 +#define RAP_USERNAME_LEN 21 +#define RAP_SHARENAME_LEN 13 +#define RAP_UPASSWD_LEN 16 /* user password */ +#define RAP_SPASSWD_LEN 9 /* share password */ +#define RAP_MACHNAME_LEN 16 +#define RAP_SRVCNAME_LEN 16 +#define RAP_SRVCCMNT_LEN 64 +#define RAP_DATATYPE_LEN 10 + + +typedef struct rap_group_info_1 +{ + char group_name[RAP_GROUPNAME_LEN]; + char reserved1; + char * comment; +} RAP_GROUP_INFO_1; + +typedef struct rap_user_info_1 +{ + char user_name[RAP_USERNAME_LEN]; + char reserved1; + char passwrd[RAP_UPASSWD_LEN]; + uint32 pwage; + uint16 priv; + char * home_dir; + char * comment; + uint16 userflags; + char * logon_script; +} RAP_USER_INFO_1; + +typedef struct rap_service_info_2 +{ + char service_name[RAP_SRVCNAME_LEN]; + uint16 status; + uint32 installcode; + uint16 process_num; + char * comment; +} RAP_SERVICE_INFO_2; + + +typedef struct rap_share_info_0 +{ + char share_name[RAP_SHARENAME_LEN]; +} RAP_SHARE_INFO_0; + +typedef struct rap_share_info_1 +{ + char share_name[RAP_SHARENAME_LEN]; + char reserved1; + uint16 share_type; + char * comment; +} RAP_SHARE_INFO_1; + +typedef struct rap_share_info_2 +{ + char share_name[RAP_SHARENAME_LEN]; + char reserved1; + uint16 share_type; + char * comment; + uint16 perms; + uint16 maximum_users; + uint16 active_users; + char * path; + char password[RAP_SPASSWD_LEN]; + char reserved2; +} RAP_SHARE_INFO_2; + +#endif /* _RAP_H_ */ diff --git a/source3/include/rbtree.h b/source3/include/rbtree.h new file mode 100644 index 0000000000..1cfd3463a0 --- /dev/null +++ b/source3/include/rbtree.h @@ -0,0 +1,132 @@ +/* + Red Black Trees + (C) 1999 Andrea Arcangeli <andrea@suse.de> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + linux/include/linux/rbtree.h + + To use rbtrees you'll have to implement your own insert and search cores. + This will avoid us to use callbacks and to drop drammatically performances. + I know it's not the cleaner way, but in C (not in C++) to get + performances and genericity... + + Some example of insert and search follows here. The search is a plain + normal search over an ordered tree. The insert instead must be implemented + int two steps: as first thing the code must insert the element in + order as a red leaf in the tree, then the support library function + rb_insert_color() must be called. Such function will do the + not trivial work to rebalance the rbtree if necessary. + +----------------------------------------------------------------------- +static inline struct page * rb_search_page_cache(struct inode * inode, + unsigned long offset) +{ + struct rb_node * n = inode->i_rb_page_cache.rb_node; + struct page * page; + + while (n) + { + page = rb_entry(n, struct page, rb_page_cache); + + if (offset < page->offset) + n = n->rb_left; + else if (offset > page->offset) + n = n->rb_right; + else + return page; + } + return NULL; +} + +static inline struct page * __rb_insert_page_cache(struct inode * inode, + unsigned long offset, + struct rb_node * node) +{ + struct rb_node ** p = &inode->i_rb_page_cache.rb_node; + struct rb_node * parent = NULL; + struct page * page; + + while (*p) + { + parent = *p; + page = rb_entry(parent, struct page, rb_page_cache); + + if (offset < page->offset) + p = &(*p)->rb_left; + else if (offset > page->offset) + p = &(*p)->rb_right; + else + return page; + } + + rb_link_node(node, parent, p); + + return NULL; +} + +static inline struct page * rb_insert_page_cache(struct inode * inode, + unsigned long offset, + struct rb_node * node) +{ + struct page * ret; + if ((ret = __rb_insert_page_cache(inode, offset, node))) + goto out; + rb_insert_color(node, &inode->i_rb_page_cache); + out: + return ret; +} +----------------------------------------------------------------------- +*/ + +#ifndef _LINUX_RBTREE_H +#define _LINUX_RBTREE_H + +struct rb_node +{ + unsigned long rb_parent_color; + struct rb_node *rb_right; + struct rb_node *rb_left; +}; + +struct rb_root +{ + struct rb_node *rb_node; +}; + + +#define RB_ROOT (struct rb_root) { NULL, } + +#if 0 +#define rb_entry(ptr, type, member) container_of(ptr, type, member) +#endif + +void rb_insert_color(struct rb_node *, struct rb_root *); +void rb_erase(struct rb_node *, struct rb_root *); + +/* Find logical next and previous nodes in a tree */ +struct rb_node *rb_next(struct rb_node *); +struct rb_node *rb_prev(struct rb_node *); +struct rb_node *rb_first(struct rb_root *); +struct rb_node *rb_last(struct rb_root *); + +/* Fast replacement of a single node without remove/rebalance/add/rebalance */ +extern void rb_replace_node(struct rb_node *victim, struct rb_node *new_node, + struct rb_root *root); + +void rb_link_node(struct rb_node * node, struct rb_node * parent, + struct rb_node ** rb_link); + +#endif /* _LINUX_RBTREE_H */ diff --git a/source3/include/reg_db.h b/source3/include/reg_db.h new file mode 100644 index 0000000000..92448ae543 --- /dev/null +++ b/source3/include/reg_db.h @@ -0,0 +1,30 @@ +/* + Parameters for Samba's Internal Registry Database + + Copyright (C) Michael Adam 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _REG_DB_H +#define _REG_DB_H + +#define REG_TDB_FLAGS TDB_SEQNUM + +#define REGVER_V1 1 /* first db version with write support */ + +#define REG_VALUE_PREFIX "SAMBA_REGVAL" +#define REG_SECDESC_PREFIX "SAMBA_SECDESC" + +#endif /* _REG_DB_H */ diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h new file mode 100644 index 0000000000..d9159dd464 --- /dev/null +++ b/source3/include/reg_objects.h @@ -0,0 +1,172 @@ +/* + Samba's Internal Registry objects + + SMB parameters and setup + Copyright (C) Gerald Carter 2002-2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _REG_OBJECTS_H /* _REG_OBJECTS_H */ +#define _REG_OBJECTS_H + +/* structure to contain registry values */ + +typedef struct { + fstring valuename; + uint16 type; + /* this should be encapsulated in an RPC_DATA_BLOB */ + uint32 size; /* in bytes */ + uint8 *data_p; +} REGISTRY_VALUE; + +/* + * A REG_SZ string is not necessarily NULL terminated. When retrieving it from + * the net, we guarantee this however. A server might want to push it without + * the terminator though. + */ + +struct registry_string { + size_t len; + char *str; +}; + +struct registry_value { + enum winreg_Type type; + union { + uint32 dword; + uint64 qword; + struct registry_string sz; + struct { + uint32 num_strings; + char **strings; + } multi_sz; + DATA_BLOB binary; + } v; +}; + +/* container for registry values */ + +typedef struct { + uint32 num_values; + REGISTRY_VALUE **values; + int seqnum; +} REGVAL_CTR; + +/* container for registry subkey names */ + +typedef struct { + uint32 num_subkeys; + char **subkeys; + int seqnum; +} REGSUBKEY_CTR; + +/* + * + * Macros that used to reside in rpc_reg.h + * + */ + +#define HKEY_CLASSES_ROOT 0x80000000 +#define HKEY_CURRENT_USER 0x80000001 +#define HKEY_LOCAL_MACHINE 0x80000002 +#define HKEY_USERS 0x80000003 +#define HKEY_PERFORMANCE_DATA 0x80000004 + +#define KEY_HKLM "HKLM" +#define KEY_HKU "HKU" +#define KEY_HKCC "HKCC" +#define KEY_HKCR "HKCR" +#define KEY_HKPD "HKPD" +#define KEY_HKPT "HKPT" +#define KEY_HKPN "HKPN" +#define KEY_HKCU "HKCU" +#define KEY_HKDD "HKDD" +#define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services" +#define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog" +#define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares" +#define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters" +#define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions" +#define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" +#define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" +#define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports" +#define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" +#define KEY_PERFLIB "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib" +#define KEY_PERFLIB_009 "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009" +#define KEY_GROUP_POLICY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Group Policy" +#define KEY_WINLOGON "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon" +#define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" +#define KEY_SAMBA_GROUP_POLICY "HKLM\\SOFTWARE\\Samba\\Group Policy" +#define KEY_TREE_ROOT "" + +#define KEY_GP_MACHINE_POLICY "HKLM\\Software\\Policies" +#define KEY_GP_MACHINE_WIN_POLICY "HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies" +#define KEY_GP_USER_POLICY "HKCU\\Software\\Policies" +#define KEY_GP_USER_WIN_POLICY "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies" +/* + * Registry key types + * Most keys are going to be GENERIC -- may need a better name? + * HKPD and HKPT are used by reg_perfcount.c + * they are special keys that contain performance data + */ +#define REG_KEY_GENERIC 0 +#define REG_KEY_HKPD 1 +#define REG_KEY_HKPT 2 + +/* + * container for function pointers to enumeration routines + * for virtual registry view + */ + +typedef struct { + /* functions for enumerating subkeys and values */ + int (*fetch_subkeys)( const char *key, REGSUBKEY_CTR *subkeys); + int (*fetch_values) ( const char *key, REGVAL_CTR *val ); + bool (*store_subkeys)( const char *key, REGSUBKEY_CTR *subkeys ); + bool (*store_values)( const char *key, REGVAL_CTR *val ); + bool (*reg_access_check)( const char *keyname, uint32 requested, + uint32 *granted, + const NT_USER_TOKEN *token ); + WERROR (*get_secdesc)(TALLOC_CTX *mem_ctx, const char *key, + struct security_descriptor **psecdesc); + WERROR (*set_secdesc)(const char *key, + struct security_descriptor *sec_desc); + bool (*subkeys_need_update)(REGSUBKEY_CTR *subkeys); + bool (*values_need_update)(REGVAL_CTR *values); +} REGISTRY_OPS; + +typedef struct { + const char *keyname; /* full path to name of key */ + REGISTRY_OPS *ops; /* registry function hooks */ +} REGISTRY_HOOK; + + +/* structure to store the registry handles */ + +typedef struct _RegistryKey { + uint32 type; + char *name; /* full name of registry key */ + uint32 access_granted; + REGISTRY_OPS *ops; +} REGISTRY_KEY; + +struct registry_key { + REGISTRY_KEY *key; + REGSUBKEY_CTR *subkeys; + REGVAL_CTR *values; + struct nt_user_token *token; +}; + +#endif /* _REG_OBJECTS_H */ diff --git a/source3/include/regfio.h b/source3/include/regfio.h new file mode 100644 index 0000000000..63516a358d --- /dev/null +++ b/source3/include/regfio.h @@ -0,0 +1,222 @@ +/* + * Unix SMB/CIFS implementation. + * Windows NT registry I/O library + * Copyright (c) Gerald (Jerry) Carter 2005 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +/************************************************************ + * Most of this information was obtained from + * http://www.wednesday.demon.co.uk/dosreg.html + * Thanks Nigel! + ***********************************************************/ + + +#ifndef _REGFIO_H +#define _REGFIO_H + +/* Macros */ + +#define REGF_BLOCKSIZE 0x1000 +#define REGF_ALLOC_BLOCK 0x1000 + +/* header sizes for various records */ + +#define REGF_HDR_SIZE 4 +#define HBIN_HDR_SIZE 4 +#define HBIN_HEADER_REC_SIZE 0x24 +#define REC_HDR_SIZE 2 + +#define REGF_OFFSET_NONE 0xffffffff + +/* Flags for the vk records */ + +#define VK_FLAG_NAME_PRESENT 0x0001 +#define VK_DATA_IN_OFFSET 0x80000000 + +/* NK record macros */ + +#define NK_TYPE_LINKKEY 0x0010 +#define NK_TYPE_NORMALKEY 0x0020 +#define NK_TYPE_ROOTKEY 0x002c + +#define HBIN_STORE_REF(x, y) { x->hbin = y; y->ref_count++ }; +#define HBIN_REMOVE_REF(x, y) { x->hbin = NULL; y->ref_count-- /* if the count == 0; we can clean up */ }; + + +/* HBIN block */ +struct regf_hbin; +typedef struct regf_hbin { + struct regf_hbin *prev, *next; + uint32 file_off; /* my offset in the registry file */ + uint32 free_off; /* offset to free space within the hbin record */ + uint32 free_size; /* amount of data left in the block */ + int ref_count; /* how many active records are pointing to this block (not used currently) */ + + char header[HBIN_HDR_SIZE]; /* "hbin" */ + uint32 first_hbin_off; /* offset from first hbin block */ + uint32 block_size; /* block size of this blockually a multiple of 4096Kb) */ + + prs_struct ps; /* data */ + + bool dirty; /* has this hbin block been modified? */ +} REGF_HBIN; + +/* ??? List -- list of key offsets and hashed names for consistency */ + +typedef struct { + uint32 nk_off; + uint8 keycheck[sizeof(uint32)]; + char *fullname; +} REGF_HASH_REC; + +typedef struct { + REGF_HBIN *hbin; /* pointer to HBIN record (in memory) containing this nk record */ + uint32 hbin_off; /* offset from beginning of this hbin block */ + uint32 rec_size; /* ((start_offset - end_offset) & 0xfffffff8) */ + + char header[REC_HDR_SIZE]; + uint16 num_keys; + REGF_HASH_REC *hashes; +} REGF_LF_REC; + +/* Key Value */ + +typedef struct { + REGF_HBIN *hbin; /* pointer to HBIN record (in memory) containing this nk record */ + uint32 hbin_off; /* offset from beginning of this hbin block */ + uint32 rec_size; /* ((start_offset - end_offset) & 0xfffffff8) */ + uint32 rec_off; /* offset stored in the value list */ + + char header[REC_HDR_SIZE]; + char *valuename; + uint32 data_size; + uint32 data_off; + uint8 *data; + uint32 type; + uint16 flag; +} REGF_VK_REC; + + +/* Key Security */ +struct _regf_sk_rec; + +typedef struct _regf_sk_rec { + struct _regf_sk_rec *next, *prev; + REGF_HBIN *hbin; /* pointer to HBIN record (in memory) containing this nk record */ + uint32 hbin_off; /* offset from beginning of this hbin block */ + uint32 rec_size; /* ((start_offset - end_offset) & 0xfffffff8) */ + + uint32 sk_off; /* offset parsed from NK record used as a key + to lookup reference to this SK record */ + + char header[REC_HDR_SIZE]; + uint32 prev_sk_off; + uint32 next_sk_off; + uint32 ref_count; + uint32 size; + SEC_DESC *sec_desc; +} REGF_SK_REC; + +/* Key Name */ + +typedef struct { + REGF_HBIN *hbin; /* pointer to HBIN record (in memory) containing this nk record */ + uint32 hbin_off; /* offset from beginning of this hbin block */ + uint32 subkey_index; /* index to next subkey record to return */ + uint32 rec_size; /* ((start_offset - end_offset) & 0xfffffff8) */ + + /* header information */ + + char header[REC_HDR_SIZE]; + uint16 key_type; + NTTIME mtime; + uint32 parent_off; /* back pointer in registry hive */ + uint32 classname_off; + char *classname; + char *keyname; + + /* max lengths */ + + uint32 max_bytes_subkeyname; /* max subkey name * 2 */ + uint32 max_bytes_subkeyclassname; /* max subkey classname length (as if) */ + uint32 max_bytes_valuename; /* max valuename * 2 */ + uint32 max_bytes_value; /* max value data size */ + + /* unknowns */ + + uint32 unk_index; /* nigel says run time index ? */ + + /* children */ + + uint32 num_subkeys; + uint32 subkeys_off; /* hash records that point to NK records */ + uint32 num_values; + uint32 values_off; /* value lists which point to VK records */ + uint32 sk_off; /* offset to SK record */ + + /* link in the other records here */ + + REGF_LF_REC subkeys; + REGF_VK_REC *values; + REGF_SK_REC *sec_desc; + +} REGF_NK_REC; + +/* REGF block */ + +typedef struct { + /* run time information */ + + int fd; /* file descriptor */ + int open_flags; /* flags passed to the open() call */ + TALLOC_CTX *mem_ctx; /* memory context for run-time file access information */ + REGF_HBIN *block_list; /* list of open hbin blocks */ + + /* file format information */ + + char header[REGF_HDR_SIZE]; /* "regf" */ + uint32 data_offset; /* offset to record in the first (or any?) hbin block */ + uint32 last_block; /* offset to last hbin block in file */ + uint32 checksum; /* XOR of bytes 0x0000 - 0x01FB */ + NTTIME mtime; + + REGF_SK_REC *sec_desc_list; /* list of security descriptors referenced by NK records */ + + /* unknowns used to simply writing */ + + uint32 unknown1; + uint32 unknown2; + uint32 unknown3; + uint32 unknown4; + uint32 unknown5; + uint32 unknown6; + +} REGF_FILE; + +/* Function Declarations */ + +REGF_FILE* regfio_open( const char *filename, int flags, int mode ); +int regfio_close( REGF_FILE *r ); + +REGF_NK_REC* regfio_rootkey( REGF_FILE *file ); +REGF_NK_REC* regfio_fetch_subkey( REGF_FILE *file, REGF_NK_REC *nk ); +REGF_NK_REC* regfio_write_key ( REGF_FILE *file, const char *name, + REGVAL_CTR *values, REGSUBKEY_CTR *subkeys, + SEC_DESC *sec_desc, REGF_NK_REC *parent ); + + +#endif /* _REGFIO_H */ + diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h new file mode 100644 index 0000000000..684044b871 --- /dev/null +++ b/source3/include/rpc_client.h @@ -0,0 +1,74 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Gerald (Jerry) Carter 2005. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _RPC_CLIENT_H +#define _RPC_CLIENT_H + +/* autogenerated client stubs */ + +#include "librpc/gen_ndr/cli_echo.h" +#include "librpc/gen_ndr/cli_lsa.h" +#include "librpc/gen_ndr/cli_svcctl.h" +#include "librpc/gen_ndr/cli_wkssvc.h" +#include "librpc/gen_ndr/cli_eventlog.h" +#include "librpc/gen_ndr/cli_dfs.h" +#include "librpc/gen_ndr/cli_initshutdown.h" +#include "librpc/gen_ndr/cli_winreg.h" +#include "librpc/gen_ndr/cli_srvsvc.h" +#include "librpc/gen_ndr/cli_samr.h" +#include "librpc/gen_ndr/cli_netlogon.h" +#include "librpc/gen_ndr/cli_dssetup.h" +#include "librpc/gen_ndr/cli_ntsvcs.h" +#include "librpc/gen_ndr/cli_epmapper.h" +#include "librpc/gen_ndr/cli_drsuapi.h" + +#define prs_init_empty( _ps_, _ctx_, _io_ ) (void) prs_init((_ps_), 0, (_ctx_), (_io_)) + +/* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */ + +#define CLI_DO_RPC_WERR( pcli, ctx, interface, opnum, q_in, r_out, \ + q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ +{\ + SMB_ASSERT(ndr_syntax_id_equal(&pcli->abstract_syntax, interface)); \ + if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \ + return WERR_NOMEM;\ + }\ + prs_init_empty( &r_ps, ctx, UNMARSHALL );\ + if ( q_io_fn("", &q_in, &q_ps, 0) ) {\ + NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \ + if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return ntstatus_to_werror(_smb_pipe_stat_);\ + }\ + if (!r_io_fn("", &r_out, &r_ps, 0)) {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return default_error;\ + }\ + } else {\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ + return default_error;\ + }\ + prs_mem_free( &q_ps );\ + prs_mem_free( &r_ps );\ +} + +#endif /* _RPC_CLIENT_H */ diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h new file mode 100644 index 0000000000..b63f0eac5e --- /dev/null +++ b/source3/include/rpc_dce.h @@ -0,0 +1,310 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _DCE_RPC_H /* _DCE_RPC_H */ +#define _DCE_RPC_H + +/* DCE/RPC packet types */ + +enum RPC_PKT_TYPE { + RPC_REQUEST = 0x00, /* Ordinary request. */ + RPC_PING = 0x01, /* Connectionless is server alive ? */ + RPC_RESPONSE = 0x02, /* Ordinary reply. */ + RPC_FAULT = 0x03, /* Fault in processing of call. */ + RPC_WORKING = 0x04, /* Connectionless reply to a ping when server busy. */ + RPC_NOCALL = 0x05, /* Connectionless reply to a ping when server has lost part of clients call. */ + RPC_REJECT = 0x06, /* Refuse a request with a code. */ + RPC_ACK = 0x07, /* Connectionless client to server code. */ + RPC_CL_CANCEL= 0x08, /* Connectionless cancel. */ + RPC_FACK = 0x09, /* Connectionless fragment ack. Both client and server send. */ + RPC_CANCEL_ACK = 0x0A, /* Server ACK to client cancel request. */ + RPC_BIND = 0x0B, /* Bind to interface. */ + RPC_BINDACK = 0x0C, /* Server ack of bind. */ + RPC_BINDNACK = 0x0D, /* Server nack of bind. */ + RPC_ALTCONT = 0x0E, /* Alter auth. */ + RPC_ALTCONTRESP = 0x0F, /* Reply to alter auth. */ + RPC_AUTH3 = 0x10, /* not the real name! this is undocumented! */ + RPC_SHUTDOWN = 0x11, /* Server to client request to shutdown. */ + RPC_CO_CANCEL= 0x12, /* Connection-oriented cancel request. */ + RPC_ORPHANED = 0x13 /* Client telling server it's aborting a partially sent request or telling + server to stop sending replies. */ +}; + +/* DCE/RPC flags */ +#define RPC_FLG_FIRST 0x01 +#define RPC_FLG_LAST 0x02 +#define RPC_FLG_NOCALL 0x20 + + +#define SMBD_NTLMSSP_NEG_FLAGS 0x000082b1 /* ALWAYS_SIGN|NEG_NTLM|NEG_LM|NEG_SEAL|NEG_SIGN|NEG_UNICODE */ + +/* NTLMSSP signature version */ +#define NTLMSSP_SIGN_VERSION 0x01 + +/* DCE RPC auth types - extended by Microsoft. */ +#define RPC_ANONYMOUS_AUTH_TYPE 0 +#define RPC_AUTH_TYPE_KRB5_1 1 +#define RPC_SPNEGO_AUTH_TYPE 9 +#define RPC_NTLMSSP_AUTH_TYPE 10 +#define RPC_KRB5_AUTH_TYPE 16 /* Not yet implemented. */ +#define RPC_SCHANNEL_AUTH_TYPE 68 /* 0x44 */ + +/* DCE-RPC standard identifiers to indicate + signing or sealing of an RPC pipe */ +#define RPC_AUTH_LEVEL_NONE 1 +#define RPC_AUTH_LEVEL_CONNECT 2 +#define RPC_AUTH_LEVEL_CALL 3 +#define RPC_AUTH_LEVEL_PACKET 4 +#define RPC_AUTH_LEVEL_INTEGRITY 5 +#define RPC_AUTH_LEVEL_PRIVACY 6 + +#if 0 +#define RPC_PIPE_AUTH_SIGN_LEVEL 0x5 +#define RPC_PIPE_AUTH_SEAL_LEVEL 0x6 +#endif + +#define DCERPC_FAULT_OP_RNG_ERROR 0x1c010002 +#define DCERPC_FAULT_UNK_IF 0x1c010003 +#define DCERPC_FAULT_INVALID_TAG 0x1c000006 +#define DCERPC_FAULT_CONTEXT_MISMATCH 0x1c00001a +#define DCERPC_FAULT_OTHER 0x00000001 +#define DCERPC_FAULT_ACCESS_DENIED 0x00000005 +#define DCERPC_FAULT_CANT_PERFORM 0x000006d8 +#define DCERPC_FAULT_NDR 0x000006f7 + + +/* Netlogon schannel auth type and level */ +#define SCHANNEL_SIGN_SIGNATURE { 0x77, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } +#define SCHANNEL_SEAL_SIGNATURE { 0x77, 0x00, 0x7a, 0x00, 0xff, 0xff, 0x00, 0x00 } + +#define RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN 0x20 +#define RPC_AUTH_SCHANNEL_SIGN_ONLY_CHK_LEN 0x18 + +/* The 7 here seems to be required to get Win2k not to downgrade us + to NT4. Actually, anything other than 1ff would seem to do... */ +#define NETLOGON_NEG_AUTH2_FLAGS 0x000701ff +/* + (NETLOGON_NEG_ACCOUNT_LOCKOUT | + NETLOGON_NEG_PERSISTENT_SAMREPL | + NETLOGON_NEG_ARCFOUR | + NETLOGON_NEG_PROMOTION_COUNT | + NETLOGON_NEG_CHANGELOG_BDC | + NETLOGON_NEG_FULL_SYNC_REPL | + NETLOGON_NEG_MULTIPLE_SIDS | + NETLOGON_NEG_REDO | + NETLOGON_NEG_PASSWORD_CHANGE_REFUSAL | + NETLOGON_NEG_DNS_DOMAIN_TRUSTS | + NETLOGON_NEG_PASSWORD_SET2 | + NETLOGON_NEG_GETDOMAININFO) +*/ +#define NETLOGON_NEG_DOMAIN_TRUST_ACCOUNT 0x2010b000 + +/* these are the flags that ADS clients use */ +#define NETLOGON_NEG_AUTH2_ADS_FLAGS 0x600fffff +/* + (NETLOGON_NEG_ACCOUNT_LOCKOUT | + NETLOGON_NEG_PERSISTENT_SAMREPL | + NETLOGON_NEG_ARCFOUR | + NETLOGON_NEG_PROMOTION_COUNT | + NETLOGON_NEG_CHANGELOG_BDC | + NETLOGON_NEG_FULL_SYNC_REPL | + NETLOGON_NEG_MULTIPLE_SIDS | + NETLOGON_NEG_REDO | + NETLOGON_NEG_PASSWORD_CHANGE_REFUSAL | + NETLOGON_NEG_SEND_PASSWORD_INFO_PDC | + NETLOGON_NEG_GENERIC_PASSTHROUGH | + NETLOGON_NEG_CONCURRENT_RPC | + NETLOGON_NEG_AVOID_ACCOUNT_DB_REPL | + NETLOGON_NEG_AVOID_SECURITYAUTH_DB_REPL | + NETLOGON_NEG_128BIT | + NETLOGON_NEG_TRANSITIVE_TRUSTS | + NETLOGON_NEG_DNS_DOMAIN_TRUSTS | + NETLOGON_NEG_PASSWORD_SET2 | + NETLOGON_NEG_GETDOMAININFO | + NETLOGON_NEG_CROSS_FOREST_TRUSTS | + NETLOGON_NEG_AUTHENTICATED_RPC_LSASS | + NETLOGON_NEG_SCHANNEL) +*/ + +enum schannel_direction { + SENDER_IS_INITIATOR, + SENDER_IS_ACCEPTOR +}; + +/* Maximum size of the signing data in a fragment. */ +#define RPC_MAX_SIGN_SIZE 0x20 /* 32 */ + +/* Maximum PDU fragment size. */ +/* #define MAX_PDU_FRAG_LEN 0x1630 this is what wnt sets */ +#define RPC_MAX_PDU_FRAG_LEN 0x10b8 /* this is what w2k sets */ + +/* RPC_IFACE */ +typedef struct ndr_syntax_id RPC_IFACE; + +extern const struct ndr_syntax_id syntax_spoolss; + +#define RPC_IFACE_LEN (UUID_SIZE + 4) + +/* RPC_HDR - dce rpc header */ +typedef struct rpc_hdr_info { + uint8 major; /* 5 - RPC major version */ + uint8 minor; /* 0 - RPC minor version */ + uint8 pkt_type; /* RPC_PKT_TYPE - RPC response packet */ + uint8 flags; /* DCE/RPC flags */ + uint8 pack_type[4]; /* 0x1000 0000 - little-endian packed data representation */ + uint16 frag_len; /* fragment length - data size (bytes) inc header and tail. */ + uint16 auth_len; /* 0 - authentication length */ + uint32 call_id; /* call identifier. matches 12th uint32 of incoming RPC data. */ +} RPC_HDR; + +#define RPC_HEADER_LEN 16 + +/* RPC_HDR_REQ - ms request rpc header */ +typedef struct rpc_hdr_req_info { + uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ + uint16 context_id; /* presentation context identifier */ + uint16 opnum; /* opnum */ +} RPC_HDR_REQ; + +#define RPC_HDR_REQ_LEN 8 + +/* RPC_HDR_RESP - ms response rpc header */ +typedef struct rpc_hdr_resp_info { + uint32 alloc_hint; /* allocation hint - data size (bytes) minus header and tail. */ + uint16 context_id; /* 0 - presentation context identifier */ + uint8 cancel_count; /* 0 - cancel count */ + uint8 reserved; /* 0 - reserved. */ +} RPC_HDR_RESP; + +#define RPC_HDR_RESP_LEN 8 + +/* RPC_HDR_FAULT - fault rpc header */ +typedef struct rpc_hdr_fault_info { + NTSTATUS status; + uint32 reserved; /* 0x0000 0000 */ +} RPC_HDR_FAULT; + +#define RPC_HDR_FAULT_LEN 8 + +/* this seems to be the same string name depending on the name of the pipe, + * but is more likely to be linked to the interface name + * "srvsvc", "\\PIPE\\ntsvcs" + * "samr", "\\PIPE\\lsass" + * "wkssvc", "\\PIPE\\wksvcs" + * "NETLOGON", "\\PIPE\\NETLOGON" + */ +/* RPC_ADDR_STR */ +typedef struct rpc_addr_info { + uint16 len; /* length of the string including null terminator */ + fstring str; /* the string above in single byte, null terminated form */ +} RPC_ADDR_STR; + +/* RPC_HDR_BBA - bind acknowledge, and alter context response. */ +typedef struct rpc_hdr_bba_info { + uint16 max_tsize; /* maximum transmission fragment size (0x1630) */ + uint16 max_rsize; /* max receive fragment size (0x1630) */ + uint32 assoc_gid; /* associated group id (0x0) */ +} RPC_HDR_BBA; + +#define RPC_HDR_BBA_LEN 8 + +/* RPC_HDR_AUTH */ +typedef struct rpc_hdr_auth_info { + uint8 auth_type; /* See XXX_AUTH_TYPE above. */ + uint8 auth_level; /* See RPC_PIPE_AUTH_XXX_LEVEL above. */ + uint8 auth_pad_len; + uint8 auth_reserved; + uint32 auth_context_id; +} RPC_HDR_AUTH; + +#define RPC_HDR_AUTH_LEN 8 + +/* this is TEMPORARILY coded up as a specific structure */ +/* this structure comes after the bind request */ +/* RPC_AUTH_SCHANNEL_NEG */ +typedef struct rpc_auth_schannel_neg_info { + uint32 type1; /* Always zero ? */ + uint32 type2; /* Types 0x3 and 0x13 seen. Check AcquireSecurityContext() docs.... */ + fstring domain; /* calling workstations's domain */ + fstring myname; /* calling workstation's name */ +} RPC_AUTH_SCHANNEL_NEG; + +/* attached to the end of encrypted rpc requests and responses */ +/* RPC_AUTH_SCHANNEL_CHK */ +typedef struct rpc_auth_schannel_chk_info { + uint8 sig [8]; /* 77 00 7a 00 ff ff 00 00 */ + uint8 packet_digest[8]; /* checksum over the packet, MD5'ed with session key */ + uint8 seq_num[8]; /* verifier, seq num */ + uint8 confounder[8]; /* random 8-byte nonce */ +} RPC_AUTH_SCHANNEL_CHK; + +typedef struct rpc_context { + uint16 context_id; /* presentation context identifier. */ + uint8 num_transfer_syntaxes; /* the number of syntaxes */ + RPC_IFACE abstract; /* num and vers. of interface client is using */ + RPC_IFACE *transfer; /* Array of transfer interfaces. */ +} RPC_CONTEXT; + +/* RPC_BIND_REQ - ms req bind */ +typedef struct rpc_bind_req_info { + RPC_HDR_BBA bba; + uint8 num_contexts; /* the number of contexts */ + RPC_CONTEXT *rpc_context; +} RPC_HDR_RB; + +/* + * The following length is 8 bytes RPC_HDR_BBA_LEN + + * 4 bytes size of context count + + * (context_count * (4 bytes of context_id, size of transfer syntax count + RPC_IFACE_LEN bytes + + * (transfer_syntax_count * RPC_IFACE_LEN bytes))) + */ + +#define RPC_HDR_RB_LEN(rpc_hdr_rb) (RPC_HDR_BBA_LEN + 4 + \ + ((rpc_hdr_rb)->num_contexts) * (4 + RPC_IFACE_LEN + (((rpc_hdr_rb)->rpc_context->num_transfer_syntaxes)*RPC_IFACE_LEN))) + +/* RPC_RESULTS - can only cope with one reason, right now... */ +typedef struct rpc_results_info { + /* uint8[] # 4-byte alignment padding, against SMB header */ + + uint8 num_results; /* the number of results (0x01) */ + + /* uint8[] # 4-byte alignment padding, against SMB header */ + + uint16 result; /* result (0x00 = accept) */ + uint16 reason; /* reason (0x00 = no reason specified) */ +} RPC_RESULTS; + +/* RPC_HDR_BA */ +typedef struct rpc_hdr_ba_info { + RPC_HDR_BBA bba; + + RPC_ADDR_STR addr ; /* the secondary address string, as described earlier */ + RPC_RESULTS res ; /* results and reasons */ + RPC_IFACE transfer; /* the transfer syntax from the request */ +} RPC_HDR_BA; + +/* RPC_AUTH_VERIFIER */ +typedef struct rpc_auth_verif_info { + fstring signature; /* "NTLMSSP".. Ok, not quite anymore */ + uint32 msg_type; /* NTLMSSP_MESSAGE_TYPE (1,2,3) and 5 for schannel */ +} RPC_AUTH_VERIFIER; + +#endif /* _DCE_RPC_H */ diff --git a/source3/include/rpc_eventlog.h b/source3/include/rpc_eventlog.h new file mode 100644 index 0000000000..3f5d03ed63 --- /dev/null +++ b/source3/include/rpc_eventlog.h @@ -0,0 +1,123 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Marcin Krzysztof Porwit 2005. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _RPC_EVENTLOG_H /* _RPC_EVENTLOG_H */ +#define _RPC_EVENTLOG_H + +/* opcodes */ + +#define EVENTLOG_CLEAREVENTLOG 0x00 +#define EVENTLOG_CLOSEEVENTLOG 0x02 +#define EVENTLOG_GETNUMRECORDS 0x04 +#define EVENTLOG_GETOLDESTENTRY 0x05 +#define EVENTLOG_OPENEVENTLOG 0x07 +#define EVENTLOG_READEVENTLOG 0x0a + +/* Eventlog read flags */ +/* defined in librpc/gen_ndr/eventlog.h */ + +/* Event types */ +/* defined in librpc/gen_ndr/eventlog.h */ + +/* Defines for TDB keys */ +#define EVT_OLDEST_ENTRY "INFO/oldest_entry" +#define EVT_NEXT_RECORD "INFO/next_record" +#define EVT_VERSION "INFO/version" +#define EVT_MAXSIZE "INFO/maxsize" +#define EVT_RETENTION "INFO/retention" + +#define ELOG_APPL "Application" +#define ELOG_SYS "System" +#define ELOG_SEC "Security" + +typedef struct elog_tdb { + struct elog_tdb *prev, *next; + char *name; + TDB_CONTEXT *tdb; + int ref_count; +} ELOG_TDB; + +#define ELOG_TDB_CTX(x) ((x)->tdb) + + +#define EVENTLOG_DATABASE_VERSION_V1 1 + +/***********************************/ + +typedef struct +{ + POLICY_HND handle; + uint32 flags; + uint32 offset; + uint32 max_read_size; +} EVENTLOG_Q_READ_EVENTLOG; + +typedef struct { + uint32 length; + uint32 reserved1; + uint32 record_number; + uint32 time_generated; + uint32 time_written; + uint32 event_id; + uint16 event_type; + uint16 num_strings; + uint16 event_category; + uint16 reserved2; + uint32 closing_record_number; + uint32 string_offset; + uint32 user_sid_length; + uint32 user_sid_offset; + uint32 data_length; + uint32 data_offset; +} Eventlog_record; + +typedef struct { + uint32 source_name_len; + smb_ucs2_t *source_name; + uint32 computer_name_len; + smb_ucs2_t *computer_name; + uint32 sid_padding; + smb_ucs2_t *sid; + uint32 strings_len; + smb_ucs2_t *strings; + uint32 user_data_len; + char *user_data; + uint32 data_padding; +} Eventlog_data_record; + +typedef struct eventlog_entry { + Eventlog_record record; + Eventlog_data_record data_record; + uint8 *data; + uint8 *end_of_data_padding; + struct eventlog_entry *next; +} Eventlog_entry; + +typedef struct { + uint32 num_bytes_in_resp; + uint32 bytes_in_next_record; + uint32 num_records; + Eventlog_entry *entry; + uint8 *end_of_entries_padding; + uint32 sent_size; + uint32 real_size; + NTSTATUS status; +} EVENTLOG_R_READ_EVENTLOG; + +#endif /* _RPC_EVENTLOG_H */ diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h new file mode 100644 index 0000000000..b4021afd0a --- /dev/null +++ b/source3/include/rpc_lsa.h @@ -0,0 +1,59 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + Copyright (C) Gerald (Jerry) Carter 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _RPC_LSA_H /* _RPC_LSA_H */ +#define _RPC_LSA_H + +#define LSA_POLICY_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED_ACCESS |\ + LSA_POLICY_VIEW_LOCAL_INFORMATION |\ + LSA_POLICY_VIEW_AUDIT_INFORMATION |\ + LSA_POLICY_GET_PRIVATE_INFORMATION |\ + LSA_POLICY_TRUST_ADMIN |\ + LSA_POLICY_CREATE_ACCOUNT |\ + LSA_POLICY_CREATE_SECRET |\ + LSA_POLICY_CREATE_PRIVILEGE |\ + LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS |\ + LSA_POLICY_SET_AUDIT_REQUIREMENTS |\ + LSA_POLICY_AUDIT_LOG_ADMIN |\ + LSA_POLICY_SERVER_ADMIN |\ + LSA_POLICY_LOOKUP_NAMES ) + + +#define LSA_POLICY_READ ( STANDARD_RIGHTS_READ_ACCESS |\ + LSA_POLICY_VIEW_AUDIT_INFORMATION |\ + LSA_POLICY_GET_PRIVATE_INFORMATION) + +#define LSA_POLICY_WRITE ( STD_RIGHT_READ_CONTROL_ACCESS |\ + LSA_POLICY_TRUST_ADMIN |\ + LSA_POLICY_CREATE_ACCOUNT |\ + LSA_POLICY_CREATE_SECRET |\ + LSA_POLICY_CREATE_PRIVILEGE |\ + LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS |\ + LSA_POLICY_SET_AUDIT_REQUIREMENTS |\ + LSA_POLICY_AUDIT_LOG_ADMIN |\ + LSA_POLICY_SERVER_ADMIN) + +#define LSA_POLICY_EXECUTE ( STANDARD_RIGHTS_EXECUTE_ACCESS |\ + LSA_POLICY_VIEW_LOCAL_INFORMATION |\ + LSA_POLICY_LOOKUP_NAMES ) + +#endif /* _RPC_LSA_H */ diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h new file mode 100644 index 0000000000..3a3c61ecec --- /dev/null +++ b/source3/include/rpc_misc.h @@ -0,0 +1,342 @@ +/* + Unix SMB/CIFS implementation. + + Copyright (C) Andrew Tridgell 1992-1997 + Copyright (C) Luke Kenneth Casson Leighton 1996-1997 + Copyright (C) Paul Ashton 1997 + Copyright (C) Gerald (Jerry) Carter 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _RPC_MISC_H /* _RPC_MISC_H */ +#define _RPC_MISC_H + +#define SMB_RPC_INTERFACE_VERSION 1 +#define PRS_POINTER_CAST bool (*)(const char*, prs_struct*, int, void*) + +enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2, UNI_BROKEN_NON_NULL = 3, UNI_STR_DBLTERMINATE = 4 }; + + + +/********************************************************************** + * well-known RIDs - Relative IDs + **********************************************************************/ + +/* RIDs - Well-known users ... */ +#define DOMAIN_USER_RID_ADMIN (0x000001F4L) +#define DOMAIN_USER_RID_GUEST (0x000001F5L) +#define DOMAIN_USER_RID_KRBTGT (0x000001F6L) + +/* RIDs - well-known groups ... */ +#define DOMAIN_GROUP_RID_ADMINS (0x00000200L) +#define DOMAIN_GROUP_RID_USERS (0x00000201L) +#define DOMAIN_GROUP_RID_GUESTS (0x00000202L) +#define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L) + +#define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L) +#define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L) +#define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L) +#define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L) + +/* is the following the right number? I bet it is --simo +#define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L) +*/ + +/* RIDs - well-known aliases ... */ +#define BUILTIN_ALIAS_RID_ADMINS (0x00000220L) +#define BUILTIN_ALIAS_RID_USERS (0x00000221L) +#define BUILTIN_ALIAS_RID_GUESTS (0x00000222L) +#define BUILTIN_ALIAS_RID_POWER_USERS (0x00000223L) + +#define BUILTIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) +#define BUILTIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) +#define BUILTIN_ALIAS_RID_PRINT_OPS (0x00000226L) +#define BUILTIN_ALIAS_RID_BACKUP_OPS (0x00000227L) + +#define BUILTIN_ALIAS_RID_REPLICATOR (0x00000228L) +#define BUILTIN_ALIAS_RID_RAS_SERVERS (0x00000229L) +#define BUILTIN_ALIAS_RID_PRE_2K_ACCESS (0x0000022aL) + + +/********************************************************************** + * Masks for mappings between unix uid and gid types and + * NT RIDS. + **********************************************************************/ + +#define BASE_RID (0x000003E8L) + +/* Take the bottom bit. */ +#define RID_TYPE_MASK 1 +#define RID_MULTIPLIER 2 + +/* The two common types. */ +#define USER_RID_TYPE 0 +#define GROUP_RID_TYPE 1 + + + +/********************************************************************** + * RPC policy handle used pretty much everywhere + **********************************************************************/ + +typedef struct policy_handle POLICY_HND; +typedef struct { + uint32 ptr_hnd; /* pointer to enumeration handle */ + uint32 handle; /* enumeration handle */ +} ENUM_HND; + +#define OUR_HANDLE(hnd) (((hnd)==NULL) ? "NULL" :\ + ( IVAL((hnd)->uuid.node,2) == (uint32)sys_getpid() ? "OURS" : \ + "OTHER")), ((unsigned int)IVAL((hnd)->uuid.node,2)),\ + ((unsigned int)sys_getpid() ) + + +/********************************************************************** + * Buffer Headers -- use by SEC_DESC_BUF in winreg and netlogon code + **********************************************************************/ + +/* TODO: replace this with an encompassing buffer structure */ +typedef struct { + uint32 buf_max_len; + uint32 buf_len; +} BUFHDR; + +/* this is a BUFHDR + a pointer to a buffer */ +typedef struct { + uint32 info_level; + uint32 length; /* uint8 chars */ + uint32 buffer; +} BUFHDR2; + +/* generic buffer ? wrapped around void*? */ +typedef struct { + uint32 size; + uint32 buffer; +} BUFHDR4; + + +/********************************************************************** + * Buffers + **********************************************************************/ + +/* buffer used by \winreg\ calls to fill in arbitrary REG_XXX values. + It *may* look like a UNISTR2 but it is *not*. This is not a goof + by the winreg developers. It is a generic buffer. buffer length + is stored in bytes (not # of uint16's) */ + +typedef struct { + uint32 buf_max_len; + uint32 offset; + uint32 buf_len; + uint16 *buffer; +} REGVAL_BUFFER; + +/* generic rpc version of the DATA_BLOB. Just a length and uint8 array */ + +typedef struct { + uint32 buf_len; + uint8 *buffer; +} RPC_DATA_BLOB; + +/********************************************************************** + * Buffers use by spoolss (i might be able to replace it with + * an RPC_DATA_BLOB) + **********************************************************************/ + +typedef struct { + uint32 buf_len; + uint16 *buffer; /* data */ +} BUFFER5; + + +/********************************************************************** + * Unicode and basic string headers + **********************************************************************/ + +typedef struct { + uint16 str_str_len; + uint16 str_max_len; + uint32 buffer; /* non-zero */ +} STRHDR; + +typedef struct { + uint16 uni_str_len; + uint16 uni_max_len; + uint32 buffer; +} UNIHDR; + +/********************************************************************** + * UNICODE string variations + **********************************************************************/ + + +typedef struct { /* UNISTR - unicode string size and buffer */ + uint16 *buffer; /* unicode characters. ***MUST*** be + little-endian. ***MUST*** be null-terminated */ +} UNISTR; + +typedef struct { /* UNISTR2 - unicode string size (in + uint16 unicode chars) and buffer */ + uint32 uni_max_len; + uint32 offset; + uint32 uni_str_len; + uint16 *buffer; /* unicode characters. ***MUST*** be little-endian. + **must** be null-terminated and the uni_str_len + should include the NULL character */ +} UNISTR2; + +/* i think this is the same as a BUFFER5 used in the spoolss code --jerry */ +/* not sure about how the termination matches between the uint16 buffers thought */ + +typedef struct { /* UNISTR3 - XXXX not sure about this structure */ + uint32 uni_str_len; + UNISTR str; +} UNISTR3; + +typedef struct { /* Buffer wrapped around a UNISTR2 */ + uint16 length; /* number of bytes not counting NULL terminatation */ + uint16 size; /* number of bytes including NULL terminatation */ + UNISTR2 *string; +} UNISTR4; + +typedef struct { + uint32 count; + UNISTR4 *strings; +} UNISTR4_ARRAY; + + +/********************************************************************** + * String variations + **********************************************************************/ + +typedef struct { /* STRING2 - string size (in uint8 chars) and buffer */ + uint32 str_max_len; + uint32 offset; + uint32 str_str_len; + uint8 *buffer; /* uint8 characters. **NOT** necessarily null-terminated */ +} STRING2; + + + + +/********************************************************************** + * Domain SID structures + **********************************************************************/ + +typedef struct { + uint32 num_auths; /* length, bytes, including length of len :-) */ + DOM_SID sid; +} DOM_SID2; + + +/********************************************************************** + * Domain SID structures + **********************************************************************/ + +/* DOM_RID - domain RID structure for ntlsa pipe */ +typedef struct { + uint16 type; /* value is SID_NAME_USE enum */ + uint32 rid; + uint32 rid_idx; /* referenced domain index */ +} DOM_RID; + +/* DOM_RID2 - second domain RID structure for ntlsa pipe */ +typedef struct { + uint16 type; /* value is SID_NAME_USE enum */ + uint32 rid; + uint32 rid_idx; /* referenced domain index */ + uint32 unknown; +} DOM_RID2; + +typedef struct { /* DOM_RID3 - domain RID structure for samr pipe */ + uint32 rid; /* domain-relative (to a SID) id */ + uint32 type1; /* value is 0x1 */ + uint32 ptr_type; /* undocumented pointer */ + uint32 type2; /* value is 0x1 */ + uint32 unk; /* value is 0x2 */ +} DOM_RID3; + +/* DOM_RID4 - rid + user attributes */ +typedef struct domrid4_info +{ + uint32 unknown; + uint16 attr; + uint32 rid; /* user RID */ +} DOM_RID4; + +/* DOM_GID - group id + user attributes */ +typedef struct { + uint32 g_rid; /* a group RID */ + uint32 attr; +} DOM_GID; + +/********************************************************************** + * ???? + **********************************************************************/ + +/* DOM_CLNT_SRV - client / server names */ +typedef struct clnt_srv_info { + uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ + UNISTR2 uni_logon_srv; /* logon server name */ + uint32 undoc_buffer2; /* undocumented 32 bit buffer pointer */ + UNISTR2 uni_comp_name; /* client machine name */ +} DOM_CLNT_SRV; + +/* DOM_LOG_INFO - login info */ +typedef struct log_info { + uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */ + UNISTR2 uni_logon_srv; /* logon server name */ + UNISTR2 uni_acct_name; /* account name */ + uint16 sec_chan; /* secure channel type */ + UNISTR2 uni_comp_name; /* client machine name */ +} DOM_LOG_INFO; + +/* DOM_CHAL - challenge info */ +typedef struct chal_info { + unsigned char data[8]; /* credentials */ +} DOM_CHAL; + +/* DOM_CREDs - timestamped client or server credentials */ +typedef struct cred_info { + DOM_CHAL challenge; /* credentials */ + UTIME timestamp; /* credential time-stamp */ +} DOM_CRED; + +/* DOM_CLNT_INFO - client info */ +typedef struct clnt_info { + DOM_LOG_INFO login; + DOM_CRED cred; +} DOM_CLNT_INFO; + +/* DOM_CLNT_INFO2 - client info */ +typedef struct clnt_info2 { + DOM_CLNT_SRV login; + uint32 ptr_cred; + DOM_CRED cred; +} DOM_CLNT_INFO2; + +/* DOM_LOGON_ID - logon id */ +typedef struct logon_info { + uint32 low; + uint32 high; +} DOM_LOGON_ID; + +/* OWF INFO */ +typedef struct owf_info { + uint8 data[16]; +} OWF_INFO; + + +#endif /* _RPC_MISC_H */ diff --git a/source3/include/rpc_ntsvcs.h b/source3/include/rpc_ntsvcs.h new file mode 100644 index 0000000000..0056d16eb9 --- /dev/null +++ b/source3/include/rpc_ntsvcs.h @@ -0,0 +1,69 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Gerald (Jerry) Carter 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _RPC_NTSVCS_H /* _RPC_NTSVCS_H */ +#define _RPC_NTSVCS_H + +/* ntsvcs pipe */ + +#define NTSVCS_GET_VERSION 0x02 +#define NTSVCS_VALIDATE_DEVICE_INSTANCE 0x06 +#define NTSVCS_GET_ROOT_DEVICE_INSTANCE 0x07 +#define NTSVCS_GET_DEVICE_LIST 0x0a +#define NTSVCS_GET_DEVICE_LIST_SIZE 0x0b +#define NTSVCS_GET_DEVICE_REG_PROPERTY 0x0d +#define NTSVCS_HW_PROFILE_FLAGS 0x28 +#define NTSVCS_GET_HW_PROFILE_INFO 0x29 +#define NTSVCS_GET_VERSION_INTERNAL 0x3e + + +/**************************/ + +typedef struct { + UNISTR2 *devicename; + uint32 buffer_size; + uint32 flags; +} NTSVCS_Q_GET_DEVICE_LIST; + +typedef struct { + UNISTR2 devicepath; + uint32 needed; + WERROR status; +} NTSVCS_R_GET_DEVICE_LIST; + +/**************************/ + +typedef struct { + UNISTR2 devicepath; + uint32 property; + uint32 unknown2; + uint32 buffer_size1; + uint32 buffer_size2; + uint32 unknown5; +} NTSVCS_Q_GET_DEVICE_REG_PROPERTY; + +typedef struct { + uint32 unknown1; + REGVAL_BUFFER value; + uint32 size; + uint32 needed; + WERROR status; +} NTSVCS_R_GET_DEVICE_REG_PROPERTY; + +#endif /* _RPC_NTSVCS_H */ diff --git a/source3/include/rpc_perfcount.h b/source3/include/rpc_perfcount.h new file mode 100644 index 0000000000..0cb2fdc212 --- /dev/null +++ b/source3/include/rpc_perfcount.h @@ -0,0 +1,126 @@ +#ifndef _RPC_PERFCOUNT_H +#define _RPC_PERFCOUNT_H +/* + * Unix SMB/CIFS implementation. + * Virtual Windows Registry Layer + * + * Copyright (C) Marcin Krzysztof Porwit 2005, + * Copyright (C) Gerald (Jerry) Carter 2005. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +typedef struct perf_counter_definition +{ + /* sizeof(PERF_COUNTER_DEFINITION) */ + uint32 ByteLength; + uint32 CounterNameTitleIndex; + uint32 CounterNameTitlePointer; + uint32 CounterHelpTitleIndex; + uint32 CounterHelpTitlePointer; + uint32 DefaultScale; + uint32 DetailLevel; + uint32 CounterType; + uint32 CounterSize; + uint32 CounterOffset; +} +PERF_COUNTER_DEFINITION; + +typedef struct perf_counter_block +{ + /* Total size of the data block, including all data plus this header */ + uint32 ByteLength; + uint8 *data; +} +PERF_COUNTER_BLOCK; + +typedef struct perf_instance_definition +{ + /* Total size of the instance definition, including the length of the terminated Name string */ + uint32 ByteLength; + uint32 ParentObjectTitleIndex; + uint32 ParentObjectTitlePointer; + uint32 UniqueID; + /* From the start of the PERF_INSTANCE_DEFINITION, the byte offset to the start of the Name string */ + uint32 NameOffset; + uint32 NameLength; + /* Unicode string containing the name for the instance */ + uint8 *data; + PERF_COUNTER_BLOCK counter_data; +} +PERF_INSTANCE_DEFINITION; + +typedef struct perf_object_type +{ + /* Total size of the object block, including all PERF_INSTANCE_DEFINITIONs, + PERF_COUNTER_DEFINITIONs and PERF_COUNTER_BLOCKs in bytes */ + uint32 TotalByteLength; + /* Size of this PERF_OBJECT_TYPE plus all PERF_COUNTER_DEFINITIONs in bytes */ + uint32 DefinitionLength; + /* Size of this PERF_OBJECT_TYPE */ + uint32 HeaderLength; + uint32 ObjectNameTitleIndex; + uint32 ObjectNameTitlePointer; + uint32 ObjectHelpTitleIndex; + uint32 ObjectHelpTitlePointer; + uint32 DetailLevel; + uint32 NumCounters; + uint32 DefaultCounter; + uint32 NumInstances; + uint32 CodePage; + uint64 PerfTime; + uint64 PerfFreq; + PERF_COUNTER_DEFINITION *counters; + PERF_INSTANCE_DEFINITION *instances; + PERF_COUNTER_BLOCK counter_data; +} +PERF_OBJECT_TYPE; + +/* PerfCounter Inner Buffer structs */ +typedef struct perf_data_block +{ + /* hardcoded to read "P.E.R.F" */ + uint16 Signature[4]; + uint32 LittleEndian; + /* both currently hardcoded to 1 */ + uint32 Version; + uint32 Revision; + /* bytes of PERF_OBJECT_TYPE data, does NOT include the PERF_DATA_BLOCK */ + uint32 TotalByteLength; + /* size of PERF_DATA_BLOCK including the uint8 *data */ + uint32 HeaderLength; + /* number of PERF_OBJECT_TYPE structures encoded */ + uint32 NumObjectTypes; + uint32 DefaultObject; + SYSTEMTIME SystemTime; + /* This will guarantee that we're on a 64-bit boundary before we encode + PerfTime, and having it there will make my offset math much easier. */ + uint32 Padding; + /* Now when I'm marshalling this, I'll need to call prs_align_uint64() + before I start encodint the uint64 structs */ + /* clock rate * seconds uptime */ + uint64 PerfTime; + /* The clock rate of the CPU */ + uint64 PerfFreq; + /* used for high-res timers -- for now PerfTime * 10e7 */ + uint64 PerfTime100nSec; + uint32 SystemNameLength; + uint32 SystemNameOffset; + /* The SystemName, in unicode, terminated */ + uint8* data; + PERF_OBJECT_TYPE *objects; +} +PERF_DATA_BLOCK; + +#endif /* _RPC_PERFCOUNT_H */ diff --git a/source3/include/rpc_perfcount_defs.h b/source3/include/rpc_perfcount_defs.h new file mode 100644 index 0000000000..6c84c270e5 --- /dev/null +++ b/source3/include/rpc_perfcount_defs.h @@ -0,0 +1,93 @@ +#ifndef _RPC_PERFCOUNT_DEFS_H +#define _RPC_PERFCOUNT_DEFS_H +/* + * Unix SMB/CIFS implementation. + * Virtual Windows Registry Layer + * + * Copyright (C) Marcin Krzysztof Porwit 2005, + * Copyright (C) Gerald (Jerry) Carter 2005. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +/* + * The following #defines match what is in winperf.h. + * See that include file for more details, or look up + * "Performance Data Format" on MSDN + * + * Rather than including them in rpc_perfcount.h, they + * were broken out into a separate .h file so that they + * can be included by other programs that need this info + * without pulling in everything else samba-related. + */ + +#define PERF_NO_INSTANCES -1 +#define PERF_NO_UNIQUE_ID -1 + +/* These determine the data size */ +#define PERF_SIZE_DWORD 0x00000000 +#define PERF_SIZE_LARGE 0x00000100 +#define PERF_SIZE_ZERO 0x00000200 +#define PERF_SIZE_VARIABLE_LEN 0x00000300 + +/* These determine the usage of the counter */ +#define PERF_TYPE_NUMBER 0x00000000 +#define PERF_TYPE_COUNTER 0x00000400 +#define PERF_TYPE_TEXT 0x00000800 +#define PERF_TYPE_ZERO 0x00000C00 + +/* If PERF_TYPE_NUMBER was selected, these provide display information */ +#define PERF_NUMBER_HEX 0x00000000 +#define PERF_NUMBER_DECIMAL 0x00010000 +#define PERF_NUMBER_DEC_1000 0x00020000 + +/* If PERF_TYPE_COUNTER was selected, these provide display information */ +#define PERF_COUNTER_VALUE 0x00000000 +#define PERF_COUNTER_RATE 0x00010000 +#define PERF_COUNTER_FRACTION 0x00020000 +#define PERF_COUNTER_BASE 0x00030000 +#define PERF_COUNTER_ELAPSED 0x00040000 +#define PERF_COUNTER_QUEUELEN 0x00050000 +#define PERF_COUNTER_HISTOGRAM 0x00060000 +#define PERF_COUNTER_PRECISION 0x00070000 + +/* If PERF_TYPE_TEXT was selected, these provide display information */ +#define PERF_TEXT_UNICODE 0x00000000 +#define PERF_TEXT_ASCII 0x00010000 + +/* These provide information for which tick count to use when computing elapsed interval */ +#define PERF_TIMER_TICK 0x00000000 +#define PERF_TIMER_100NS 0x00100000 +#define PERF_OBJECT_TIMER 0x00200000 + +/* These affect how the data is manipulated prior to being displayed */ +#define PERF_DELTA_COUNTER 0x00400000 +#define PERF_DELTA_BASE 0x00800000 +#define PERF_INVERSE_COUNTER 0x01000000 +#define PERF_MULTI_COUNTER 0x02000000 + +/* These determine if any text gets added when the value is displayed */ +#define PERF_DISPLAY_NO_SUFFIX 0x00000000 +#define PERF_DISPLAY_PER_SEC 0x10000000 +#define PERF_DISPLAY_PERCENT 0x20000000 +#define PERF_DISPLAY_SECONDS 0x30000000 +#define PERF_DISPLAY_NOSHOW 0x40000000 + +/* These determine the DetailLevel of the counter */ +#define PERF_DETAIL_NOVICE 100 +#define PERF_DETAIL_ADVANCED 200 +#define PERF_DETAIL_EXPERT 300 +#define PERF_DETAIL_WIZARD 400 + +#endif /* _RPC_PERFCOUNT_DEFS_H */ diff --git a/source3/include/rpc_secdes.h b/source3/include/rpc_secdes.h new file mode 100644 index 0000000000..83103b7386 --- /dev/null +++ b/source3/include/rpc_secdes.h @@ -0,0 +1,496 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-2000 + Copyright (C) Luke Kenneth Casson Leighton 1996-2000 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _RPC_SECDES_H /* _RPC_SECDES_H */ +#define _RPC_SECDES_H + +/* for ADS */ +#define SEC_RIGHTS_LIST_CONTENTS 0x4 +#define SEC_RIGHTS_LIST_OBJECT 0x80 +#define SEC_RIGHTS_READ_ALL_PROP 0x10 +#define SEC_RIGHTS_READ_PERMS 0x20000 +#define SEC_RIGHTS_WRITE_ALL_VALID 0x8 +#define SEC_RIGHTS_WRITE_ALL_PROP 0x20 +#define SEC_RIGHTS_MODIFY_OWNER 0x80000 +#define SEC_RIGHTS_MODIFY_PERMS 0x40000 +#define SEC_RIGHTS_CREATE_CHILD 0x1 +#define SEC_RIGHTS_DELETE_CHILD 0x2 +#define SEC_RIGHTS_DELETE_SUBTREE 0x40 +#define SEC_RIGHTS_DELETE 0x10000 /* advanced/special/object/delete */ +#define SEC_RIGHTS_EXTENDED 0x100 /* change/reset password, receive/send as*/ +#define SEC_RIGHTS_CHANGE_PASSWD SEC_RIGHTS_EXTENDED +#define SEC_RIGHTS_RESET_PASSWD SEC_RIGHTS_EXTENDED +#define SEC_RIGHTS_FULL_CTRL 0xf01ff + +#define SEC_ACE_OBJECT_PRESENT 0x00000001 /* thanks for Jim McDonough <jmcd@us.ibm.com> */ +#define SEC_ACE_OBJECT_INHERITED_PRESENT 0x00000002 + +/* + * New Windows 2000 bits. + */ +#define SE_DESC_DACL_AUTO_INHERIT_REQ 0x0100 +#define SE_DESC_SACL_AUTO_INHERIT_REQ 0x0200 +#define SE_DESC_DACL_AUTO_INHERITED 0x0400 +#define SE_DESC_SACL_AUTO_INHERITED 0x0800 +#define SE_DESC_DACL_PROTECTED 0x1000 +#define SE_DESC_SACL_PROTECTED 0x2000 + +/* security information */ +#define OWNER_SECURITY_INFORMATION 0x00000001 +#define GROUP_SECURITY_INFORMATION 0x00000002 +#define DACL_SECURITY_INFORMATION 0x00000004 +#define SACL_SECURITY_INFORMATION 0x00000008 +/* Extra W2K flags. */ +#define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000 +#define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000 +#define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000 +#define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000 + +#define ALL_SECURITY_INFORMATION (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|\ + DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION|\ + UNPROTECTED_SACL_SECURITY_INFORMATION|\ + UNPROTECTED_DACL_SECURITY_INFORMATION|\ + PROTECTED_SACL_SECURITY_INFORMATION|\ + PROTECTED_DACL_SECURITY_INFORMATION) + +/* SEC_ACCESS */ +typedef uint32 SEC_ACCESS; + +/* SEC_ACE */ +typedef struct security_ace SEC_ACE; +#define SEC_ACE_HEADER_SIZE (2 * sizeof(uint8) + sizeof(uint16) + sizeof(uint32)) + +#ifndef ACL_REVISION +#define ACL_REVISION 0x3 +#endif + +#ifndef _SEC_ACL +/* SEC_ACL */ +typedef struct security_acl SEC_ACL; +#define SEC_ACL_HEADER_SIZE (2 * sizeof(uint16) + sizeof(uint32)) +#define _SEC_ACL +#endif + +#ifndef SEC_DESC_REVISION +#define SEC_DESC_REVISION 0x1 +#endif + +#ifndef _SEC_DESC +/* SEC_DESC */ +typedef struct security_descriptor SEC_DESC; +#define SEC_DESC_HEADER_SIZE (2 * sizeof(uint16) + 4 * sizeof(uint32)) +#define _SEC_DESC +#endif + +#ifndef _SEC_DESC_BUF +/* SEC_DESC_BUF */ +typedef struct sec_desc_buf SEC_DESC_BUF; +#define _SEC_DESC_BUF +#endif + +/* A type to describe the mapping of generic access rights to object + specific access rights. */ + +struct generic_mapping { + uint32 generic_read; + uint32 generic_write; + uint32 generic_execute; + uint32 generic_all; +}; + +struct standard_mapping { + uint32 std_read; + uint32 std_write; + uint32 std_execute; + uint32 std_all; +}; + + +/* Security Access Masks Rights */ + +#define SPECIFIC_RIGHTS_MASK 0x0000FFFF +#define STANDARD_RIGHTS_MASK 0x00FF0000 +#define GENERIC_RIGHTS_MASK 0xF0000000 + +#define SEC_RIGHT_SYSTEM_SECURITY 0x01000000 +#define SEC_RIGHT_MAXIMUM_ALLOWED 0x02000000 + +/* Generic access rights */ + +#define GENERIC_RIGHT_ALL_ACCESS 0x10000000 +#define GENERIC_RIGHT_EXECUTE_ACCESS 0x20000000 +#define GENERIC_RIGHT_WRITE_ACCESS 0x40000000 +#define GENERIC_RIGHT_READ_ACCESS 0x80000000 + +/* Standard access rights. */ + +#define STD_RIGHT_DELETE_ACCESS 0x00010000 +#define STD_RIGHT_READ_CONTROL_ACCESS 0x00020000 +#define STD_RIGHT_WRITE_DAC_ACCESS 0x00040000 +#define STD_RIGHT_WRITE_OWNER_ACCESS 0x00080000 +#define STD_RIGHT_SYNCHRONIZE_ACCESS 0x00100000 + +#define STD_RIGHT_ALL_ACCESS 0x001F0000 + +/* Combinations of standard masks. */ +#define STANDARD_RIGHTS_ALL_ACCESS STD_RIGHT_ALL_ACCESS /* 0x001f0000 */ +#define STANDARD_RIGHTS_MODIFY_ACCESS STD_RIGHT_READ_CONTROL_ACCESS /* 0x00020000 */ +#define STANDARD_RIGHTS_EXECUTE_ACCESS STD_RIGHT_READ_CONTROL_ACCESS /* 0x00020000 */ +#define STANDARD_RIGHTS_READ_ACCESS STD_RIGHT_READ_CONTROL_ACCESS /* 0x00020000 */ +#define STANDARD_RIGHTS_WRITE_ACCESS \ + (STD_RIGHT_WRITE_OWNER_ACCESS | \ + STD_RIGHT_WRITE_DAC_ACCESS | \ + STD_RIGHT_DELETE_ACCESS) /* 0x000d0000 */ +#define STANDARD_RIGHTS_REQUIRED_ACCESS \ + (STD_RIGHT_DELETE_ACCESS | \ + STD_RIGHT_READ_CONTROL_ACCESS | \ + STD_RIGHT_WRITE_DAC_ACCESS | \ + STD_RIGHT_WRITE_OWNER_ACCESS) /* 0x000f0000 */ + +/* File Object specific access rights */ + +#define SA_RIGHT_FILE_READ_DATA 0x00000001 +#define SA_RIGHT_FILE_WRITE_DATA 0x00000002 +#define SA_RIGHT_FILE_APPEND_DATA 0x00000004 +#define SA_RIGHT_FILE_READ_EA 0x00000008 +#define SA_RIGHT_FILE_WRITE_EA 0x00000010 +#define SA_RIGHT_FILE_EXECUTE 0x00000020 +#define SA_RIGHT_FILE_DELETE_CHILD 0x00000040 +#define SA_RIGHT_FILE_READ_ATTRIBUTES 0x00000080 +#define SA_RIGHT_FILE_WRITE_ATTRIBUTES 0x00000100 + +#define SA_RIGHT_FILE_ALL_ACCESS 0x000001FF + +#define GENERIC_RIGHTS_FILE_ALL_ACCESS \ + (STANDARD_RIGHTS_REQUIRED_ACCESS| \ + STD_RIGHT_SYNCHRONIZE_ACCESS | \ + SA_RIGHT_FILE_ALL_ACCESS) + +#define GENERIC_RIGHTS_FILE_READ \ + (STANDARD_RIGHTS_READ_ACCESS | \ + STD_RIGHT_SYNCHRONIZE_ACCESS | \ + SA_RIGHT_FILE_READ_DATA | \ + SA_RIGHT_FILE_READ_ATTRIBUTES | \ + SA_RIGHT_FILE_READ_EA) + +#define GENERIC_RIGHTS_FILE_WRITE \ + (STANDARD_RIGHTS_WRITE_ACCESS | \ + STD_RIGHT_SYNCHRONIZE_ACCESS | \ + SA_RIGHT_FILE_WRITE_DATA | \ + SA_RIGHT_FILE_WRITE_ATTRIBUTES | \ + SA_RIGHT_FILE_WRITE_EA | \ + SA_RIGHT_FILE_APPEND_DATA) + +#define GENERIC_RIGHTS_FILE_EXECUTE \ + (STANDARD_RIGHTS_EXECUTE_ACCESS | \ + STD_RIGHT_SYNCHRONIZE_ACCESS | \ + SA_RIGHT_FILE_READ_ATTRIBUTES | \ + SA_RIGHT_FILE_EXECUTE) + +#define GENERIC_RIGHTS_FILE_MODIFY \ + (STANDARD_RIGHTS_MODIFY_ACCESS | \ + STD_RIGHT_SYNCHRONIZE_ACCESS | \ + STD_RIGHT_DELETE_ACCESS | \ + SA_RIGHT_FILE_WRITE_ATTRIBUTES | \ + SA_RIGHT_FILE_READ_ATTRIBUTES | \ + SA_RIGHT_FILE_EXECUTE | \ + SA_RIGHT_FILE_WRITE_EA | \ + SA_RIGHT_FILE_READ_EA | \ + SA_RIGHT_FILE_APPEND_DATA | \ + SA_RIGHT_FILE_WRITE_DATA | \ + SA_RIGHT_FILE_READ_DATA) + +/* SAM server specific access rights */ + +#define SA_RIGHT_SAM_CONNECT_SERVER 0x00000001 +#define SA_RIGHT_SAM_SHUTDOWN_SERVER 0x00000002 +#define SA_RIGHT_SAM_INITIALISE_SERVER 0x00000004 +#define SA_RIGHT_SAM_CREATE_DOMAIN 0x00000008 +#define SA_RIGHT_SAM_ENUM_DOMAINS 0x00000010 +#define SA_RIGHT_SAM_OPEN_DOMAIN 0x00000020 + +#define SA_RIGHT_SAM_ALL_ACCESS 0x0000003F + +#define GENERIC_RIGHTS_SAM_ALL_ACCESS \ + (STANDARD_RIGHTS_REQUIRED_ACCESS| \ + SA_RIGHT_SAM_ALL_ACCESS) + +#define GENERIC_RIGHTS_SAM_READ \ + (STANDARD_RIGHTS_READ_ACCESS | \ + SA_RIGHT_SAM_ENUM_DOMAINS) + +#define GENERIC_RIGHTS_SAM_WRITE \ + (STANDARD_RIGHTS_WRITE_ACCESS | \ + SA_RIGHT_SAM_CREATE_DOMAIN | \ + SA_RIGHT_SAM_INITIALISE_SERVER | \ + SA_RIGHT_SAM_SHUTDOWN_SERVER) + +#define GENERIC_RIGHTS_SAM_EXECUTE \ + (STANDARD_RIGHTS_EXECUTE_ACCESS | \ + SA_RIGHT_SAM_OPEN_DOMAIN | \ + SA_RIGHT_SAM_CONNECT_SERVER) + + +/* Domain Object specific access rights */ + +#define SA_RIGHT_DOMAIN_LOOKUP_INFO_1 0x00000001 +#define SA_RIGHT_DOMAIN_SET_INFO_1 0x00000002 +#define SA_RIGHT_DOMAIN_LOOKUP_INFO_2 0x00000004 +#define SA_RIGHT_DOMAIN_SET_INFO_2 0x00000008 +#define SA_RIGHT_DOMAIN_CREATE_USER 0x00000010 +#define SA_RIGHT_DOMAIN_CREATE_GROUP 0x00000020 +#define SA_RIGHT_DOMAIN_CREATE_ALIAS 0x00000040 +#define SA_RIGHT_DOMAIN_LOOKUP_ALIAS_BY_MEM 0x00000080 +#define SA_RIGHT_DOMAIN_ENUM_ACCOUNTS 0x00000100 +#define SA_RIGHT_DOMAIN_OPEN_ACCOUNT 0x00000200 +#define SA_RIGHT_DOMAIN_SET_INFO_3 0x00000400 + +#define SA_RIGHT_DOMAIN_ALL_ACCESS 0x000007FF + +#define GENERIC_RIGHTS_DOMAIN_ALL_ACCESS \ + (STANDARD_RIGHTS_REQUIRED_ACCESS| \ + SA_RIGHT_DOMAIN_ALL_ACCESS) + +#define GENERIC_RIGHTS_DOMAIN_READ \ + (STANDARD_RIGHTS_READ_ACCESS | \ + SA_RIGHT_DOMAIN_LOOKUP_ALIAS_BY_MEM | \ + SA_RIGHT_DOMAIN_LOOKUP_INFO_2) + +#define GENERIC_RIGHTS_DOMAIN_WRITE \ + (STANDARD_RIGHTS_WRITE_ACCESS | \ + SA_RIGHT_DOMAIN_SET_INFO_3 | \ + SA_RIGHT_DOMAIN_CREATE_ALIAS | \ + SA_RIGHT_DOMAIN_CREATE_GROUP | \ + SA_RIGHT_DOMAIN_CREATE_USER | \ + SA_RIGHT_DOMAIN_SET_INFO_2 | \ + SA_RIGHT_DOMAIN_SET_INFO_1) + +#define GENERIC_RIGHTS_DOMAIN_EXECUTE \ + (STANDARD_RIGHTS_EXECUTE_ACCESS | \ + SA_RIGHT_DOMAIN_OPEN_ACCOUNT | \ + SA_RIGHT_DOMAIN_ENUM_ACCOUNTS | \ + SA_RIGHT_DOMAIN_LOOKUP_INFO_1) + + +/* User Object specific access rights */ + +#define SA_RIGHT_USER_GET_NAME_ETC 0x00000001 +#define SA_RIGHT_USER_GET_LOCALE 0x00000002 +#define SA_RIGHT_USER_SET_LOC_COM 0x00000004 +#define SA_RIGHT_USER_GET_LOGONINFO 0x00000008 +#define SA_RIGHT_USER_ACCT_FLAGS_EXPIRY 0x00000010 +#define SA_RIGHT_USER_SET_ATTRIBUTES 0x00000020 +#define SA_RIGHT_USER_CHANGE_PASSWORD 0x00000040 +#define SA_RIGHT_USER_SET_PASSWORD 0x00000080 +#define SA_RIGHT_USER_GET_GROUPS 0x00000100 +#define SA_RIGHT_USER_READ_GROUP_MEM 0x00000200 +#define SA_RIGHT_USER_CHANGE_GROUP_MEM 0x00000400 + +#define SA_RIGHT_USER_ALL_ACCESS 0x000007FF + +#define GENERIC_RIGHTS_USER_ALL_ACCESS \ + (STANDARD_RIGHTS_REQUIRED_ACCESS| \ + SA_RIGHT_USER_ALL_ACCESS) /* 0x000f07ff */ + +#define GENERIC_RIGHTS_USER_READ \ + (STANDARD_RIGHTS_READ_ACCESS | \ + SA_RIGHT_USER_READ_GROUP_MEM | \ + SA_RIGHT_USER_GET_GROUPS | \ + SA_RIGHT_USER_ACCT_FLAGS_EXPIRY | \ + SA_RIGHT_USER_GET_LOGONINFO | \ + SA_RIGHT_USER_GET_LOCALE) /* 0x0002031a */ + +#define GENERIC_RIGHTS_USER_WRITE \ + (STANDARD_RIGHTS_WRITE_ACCESS | \ + SA_RIGHT_USER_CHANGE_PASSWORD | \ + SA_RIGHT_USER_SET_LOC_COM | \ + SA_RIGHT_USER_SET_ATTRIBUTES | \ + SA_RIGHT_USER_SET_PASSWORD | \ + SA_RIGHT_USER_CHANGE_GROUP_MEM) /* 0x000204e4 */ + +#define GENERIC_RIGHTS_USER_EXECUTE \ + (STANDARD_RIGHTS_EXECUTE_ACCESS | \ + SA_RIGHT_USER_CHANGE_PASSWORD | \ + SA_RIGHT_USER_GET_NAME_ETC ) /* 0x00020041 */ + + +/* Group Object specific access rights */ + +#define SA_RIGHT_GROUP_LOOKUP_INFO 0x00000001 +#define SA_RIGHT_GROUP_SET_INFO 0x00000002 +#define SA_RIGHT_GROUP_ADD_MEMBER 0x00000004 +#define SA_RIGHT_GROUP_REMOVE_MEMBER 0x00000008 +#define SA_RIGHT_GROUP_GET_MEMBERS 0x00000010 + +#define SA_RIGHT_GROUP_ALL_ACCESS 0x0000001F + +#define GENERIC_RIGHTS_GROUP_ALL_ACCESS \ + (STANDARD_RIGHTS_REQUIRED_ACCESS| \ + SA_RIGHT_GROUP_ALL_ACCESS) /* 0x000f001f */ + +#define GENERIC_RIGHTS_GROUP_READ \ + (STANDARD_RIGHTS_READ_ACCESS | \ + SA_RIGHT_GROUP_GET_MEMBERS) /* 0x00020010 */ + +#define GENERIC_RIGHTS_GROUP_WRITE \ + (STANDARD_RIGHTS_WRITE_ACCESS | \ + SA_RIGHT_GROUP_REMOVE_MEMBER | \ + SA_RIGHT_GROUP_ADD_MEMBER | \ + SA_RIGHT_GROUP_SET_INFO ) /* 0x0002000e */ + +#define GENERIC_RIGHTS_GROUP_EXECUTE \ + (STANDARD_RIGHTS_EXECUTE_ACCESS | \ + SA_RIGHT_GROUP_LOOKUP_INFO) /* 0x00020001 */ + + +/* Alias Object specific access rights */ + +#define SA_RIGHT_ALIAS_ADD_MEMBER 0x00000001 +#define SA_RIGHT_ALIAS_REMOVE_MEMBER 0x00000002 +#define SA_RIGHT_ALIAS_GET_MEMBERS 0x00000004 +#define SA_RIGHT_ALIAS_LOOKUP_INFO 0x00000008 +#define SA_RIGHT_ALIAS_SET_INFO 0x00000010 + +#define SA_RIGHT_ALIAS_ALL_ACCESS 0x0000001F + +#define GENERIC_RIGHTS_ALIAS_ALL_ACCESS \ + (STANDARD_RIGHTS_REQUIRED_ACCESS| \ + SA_RIGHT_ALIAS_ALL_ACCESS) /* 0x000f001f */ + +#define GENERIC_RIGHTS_ALIAS_READ \ + (STANDARD_RIGHTS_READ_ACCESS | \ + SA_RIGHT_ALIAS_GET_MEMBERS ) /* 0x00020004 */ + +#define GENERIC_RIGHTS_ALIAS_WRITE \ + (STANDARD_RIGHTS_WRITE_ACCESS | \ + SA_RIGHT_ALIAS_REMOVE_MEMBER | \ + SA_RIGHT_ALIAS_ADD_MEMBER | \ + SA_RIGHT_ALIAS_SET_INFO ) /* 0x00020013 */ + +#define GENERIC_RIGHTS_ALIAS_EXECUTE \ + (STANDARD_RIGHTS_EXECUTE_ACCESS | \ + SA_RIGHT_ALIAS_LOOKUP_INFO ) /* 0x00020008 */ + +/* + * Acces bits for the svcctl objects + */ + +/* Service Control Manager Bits */ + +#if 0 +#define SC_RIGHT_MGR_CONNECT 0x0001 +#define SC_RIGHT_MGR_CREATE_SERVICE 0x0002 +#define SC_RIGHT_MGR_ENUMERATE_SERVICE 0x0004 +#define SC_RIGHT_MGR_LOCK 0x0008 +#define SC_RIGHT_MGR_QUERY_LOCK_STATUS 0x0010 +#define SC_RIGHT_MGR_MODIFY_BOOT_CONFIG 0x0020 + +#endif + +#define SC_MANAGER_READ_ACCESS \ + ( STANDARD_RIGHTS_READ_ACCESS | \ + SC_RIGHT_MGR_CONNECT | \ + SC_RIGHT_MGR_ENUMERATE_SERVICE | \ + SC_RIGHT_MGR_QUERY_LOCK_STATUS ) + +#define SC_MANAGER_EXECUTE_ACCESS SC_MANAGER_READ_ACCESS + +#define SC_MANAGER_WRITE_ACCESS \ + ( STANDARD_RIGHTS_REQUIRED_ACCESS | \ + SC_MANAGER_READ_ACCESS | \ + SC_RIGHT_MGR_CREATE_SERVICE | \ + SC_RIGHT_MGR_LOCK | \ + SC_RIGHT_MGR_MODIFY_BOOT_CONFIG ) + +#define SC_MANAGER_ALL_ACCESS SC_MANAGER_WRITE_ACCESS + +/* Service Object Bits */ + +#if 0 +#define SC_RIGHT_SVC_QUERY_CONFIG 0x0001 +#define SC_RIGHT_SVC_CHANGE_CONFIG 0x0002 +#define SC_RIGHT_SVC_QUERY_STATUS 0x0004 +#define SC_RIGHT_SVC_ENUMERATE_DEPENDENTS 0x0008 +#define SC_RIGHT_SVC_START 0x0010 +#define SC_RIGHT_SVC_STOP 0x0020 +#define SC_RIGHT_SVC_PAUSE_CONTINUE 0x0040 +#define SC_RIGHT_SVC_INTERROGATE 0x0080 +#define SC_RIGHT_SVC_USER_DEFINED_CONTROL 0x0100 + +#endif + +#define SERVICE_READ_ACCESS \ + ( STANDARD_RIGHTS_READ_ACCESS | \ + SC_RIGHT_SVC_ENUMERATE_DEPENDENTS | \ + SC_RIGHT_SVC_INTERROGATE | \ + SC_RIGHT_SVC_QUERY_CONFIG | \ + SC_RIGHT_SVC_QUERY_STATUS | \ + SC_RIGHT_SVC_USER_DEFINED_CONTROL ) + +#define SERVICE_EXECUTE_ACCESS \ + ( SERVICE_READ_ACCESS | \ + SC_RIGHT_SVC_START | \ + SC_RIGHT_SVC_STOP | \ + SC_RIGHT_SVC_PAUSE_CONTINUE ) + +#define SERVICE_WRITE_ACCESS \ + ( STANDARD_RIGHTS_REQUIRED_ACCESS | \ + SERVICE_READ_ACCESS | \ + SERVICE_EXECUTE_ACCESS | \ + SC_RIGHT_SVC_CHANGE_CONFIG ) + +#define SERVICE_ALL_ACCESS SERVICE_WRITE_ACCESS + +/* + * Access Bits for registry ACLS + */ + +/* used by registry ACLs */ + +#define SEC_RIGHTS_QUERY_VALUE 0x00000001 +#define SEC_RIGHTS_SET_VALUE 0x00000002 +#define SEC_RIGHTS_CREATE_SUBKEY 0x00000004 +#define SEC_RIGHTS_ENUM_SUBKEYS 0x00000008 +#define SEC_RIGHTS_NOTIFY 0x00000010 +#define SEC_RIGHTS_CREATE_LINK 0x00000020 +#define SEC_RIGHTS_MAXIMUM_ALLOWED 0x02000000 + + +#define REG_KEY_READ \ + ( STANDARD_RIGHTS_READ_ACCESS |\ + SEC_RIGHTS_QUERY_VALUE |\ + SEC_RIGHTS_ENUM_SUBKEYS |\ + SEC_RIGHTS_NOTIFY ) + +#define REG_KEY_EXECUTE REG_KEY_READ + +#define REG_KEY_WRITE \ + ( STANDARD_RIGHTS_WRITE_ACCESS |\ + SEC_RIGHTS_SET_VALUE |\ + SEC_RIGHTS_CREATE_SUBKEY ) + +#define REG_KEY_ALL \ + ( STANDARD_RIGHTS_REQUIRED_ACCESS |\ + REG_KEY_READ |\ + REG_KEY_WRITE |\ + SEC_RIGHTS_CREATE_LINK ) + + +#endif /* _RPC_SECDES_H */ diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h new file mode 100644 index 0000000000..98f6110f7a --- /dev/null +++ b/source3/include/rpc_spoolss.h @@ -0,0 +1,2224 @@ +/* + Unix SMB/Netbios implementation. + + Copyright (C) Andrew Tridgell 1992-2000, + Copyright (C) Luke Kenneth Casson Leighton 1996-2000, + Copyright (C) Jean Francois Micouleau 1998-2000. + Copyright (C) Gerald Carter 2001-2006. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _RPC_SPOOLSS_H /* _RPC_SPOOLSS_H */ +#define _RPC_SPOOLSS_H + +/* spoolss pipe: this are the calls which are not implemented ... +#define SPOOLSS_GETPRINTERDRIVER 0x0b +#define SPOOLSS_READPRINTER 0x16 +#define SPOOLSS_WAITFORPRINTERCHANGE 0x1c +#define SPOOLSS_ADDPORT 0x25 +#define SPOOLSS_CONFIGUREPORT 0x26 +#define SPOOLSS_DELETEPORT 0x27 +#define SPOOLSS_CREATEPRINTERIC 0x28 +#define SPOOLSS_PLAYGDISCRIPTONPRINTERIC 0x29 +#define SPOOLSS_DELETEPRINTERIC 0x2a +#define SPOOLSS_ADDPRINTERCONNECTION 0x2b +#define SPOOLSS_DELETEPRINTERCONNECTION 0x2c +#define SPOOLSS_PRINTERMESSAGEBOX 0x2d +#define SPOOLSS_ADDMONITOR 0x2e +#define SPOOLSS_DELETEMONITOR 0x2f +#define SPOOLSS_DELETEPRINTPROCESSOR 0x30 +#define SPOOLSS_ADDPRINTPROVIDOR 0x31 +#define SPOOLSS_DELETEPRINTPROVIDOR 0x32 +#define SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION 0x36 +#define SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION 0x37 +#define SPOOLSS_ROUTERFINDFIRSTPRINTERNOTIFICATIONOLD 0x39 +#define SPOOLSS_ADDPORTEX 0x3d +#define SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFICATION0x3e +#define SPOOLSS_SPOOLERINIT 0x3f +#define SPOOLSS_RESETPRINTEREX 0x40 +*/ + +/* those are implemented */ +#define SPOOLSS_ENUMPRINTERS 0x00 +#define SPOOLSS_OPENPRINTER 0x01 +#define SPOOLSS_SETJOB 0x02 +#define SPOOLSS_GETJOB 0x03 +#define SPOOLSS_ENUMJOBS 0x04 +#define SPOOLSS_ADDPRINTER 0x05 +#define SPOOLSS_DELETEPRINTER 0x06 +#define SPOOLSS_SETPRINTER 0x07 +#define SPOOLSS_GETPRINTER 0x08 +#define SPOOLSS_ADDPRINTERDRIVER 0x09 +#define SPOOLSS_ENUMPRINTERDRIVERS 0x0a +#define SPOOLSS_GETPRINTERDRIVERDIRECTORY 0x0c +#define SPOOLSS_DELETEPRINTERDRIVER 0x0d +#define SPOOLSS_ADDPRINTPROCESSOR 0x0e +#define SPOOLSS_ENUMPRINTPROCESSORS 0x0f +#define SPOOLSS_GETPRINTPROCESSORDIRECTORY 0x10 +#define SPOOLSS_STARTDOCPRINTER 0x11 +#define SPOOLSS_STARTPAGEPRINTER 0x12 +#define SPOOLSS_WRITEPRINTER 0x13 +#define SPOOLSS_ENDPAGEPRINTER 0x14 +#define SPOOLSS_ABORTPRINTER 0x15 +#define SPOOLSS_ENDDOCPRINTER 0x17 +#define SPOOLSS_ADDJOB 0x18 +#define SPOOLSS_SCHEDULEJOB 0x19 +#define SPOOLSS_GETPRINTERDATA 0x1a +#define SPOOLSS_SETPRINTERDATA 0x1b +#define SPOOLSS_CLOSEPRINTER 0x1d +#define SPOOLSS_ADDFORM 0x1e +#define SPOOLSS_DELETEFORM 0x1f +#define SPOOLSS_GETFORM 0x20 +#define SPOOLSS_SETFORM 0x21 +#define SPOOLSS_ENUMFORMS 0x22 +#define SPOOLSS_ENUMPORTS 0x23 +#define SPOOLSS_ENUMMONITORS 0x24 +#define SPOOLSS_ENUMPRINTPROCDATATYPES 0x33 +#define SPOOLSS_RESETPRINTER 0x34 +#define SPOOLSS_GETPRINTERDRIVER2 0x35 +#define SPOOLSS_FCPN 0x38 /* FindClosePrinterNotify */ +#define SPOOLSS_REPLYOPENPRINTER 0x3a +#define SPOOLSS_ROUTERREPLYPRINTER 0x3b +#define SPOOLSS_REPLYCLOSEPRINTER 0x3c +#define SPOOLSS_RFFPCNEX 0x41 /* RemoteFindFirstPrinterChangeNotifyEx */ +#define SPOOLSS_RRPCN 0x42 /* RouteRefreshPrinterChangeNotification */ +#define SPOOLSS_RFNPCNEX 0x43 /* RemoteFindNextPrinterChangeNotifyEx */ +#define SPOOLSS_OPENPRINTEREX 0x45 +#define SPOOLSS_ADDPRINTEREX 0x46 +#define SPOOLSS_ENUMPRINTERDATA 0x48 +#define SPOOLSS_DELETEPRINTERDATA 0x49 +#define SPOOLSS_SETPRINTERDATAEX 0x4d +#define SPOOLSS_GETPRINTERDATAEX 0x4e +#define SPOOLSS_ENUMPRINTERDATAEX 0x4f +#define SPOOLSS_ENUMPRINTERKEY 0x50 +#define SPOOLSS_DELETEPRINTERDATAEX 0x51 +#define SPOOLSS_DELETEPRINTERKEY 0x52 +#define SPOOLSS_DELETEPRINTERDRIVEREX 0x54 +#define SPOOLSS_XCVDATAPORT 0x58 +#define SPOOLSS_ADDPRINTERDRIVEREX 0x59 + +/* + * Special strings for the OpenPrinter() call. See the MSDN DDK + * docs on the XcvDataPort() for more details. + */ + +#define SPL_LOCAL_PORT "Local Port" +#define SPL_TCPIP_PORT "Standard TCP/IP Port" +#define SPL_XCV_MONITOR_LOCALMON ",XcvMonitor Local Port" +#define SPL_XCV_MONITOR_TCPMON ",XcvMonitor Standard TCP/IP Port" + + +#define PRINTER_CONTROL_UNPAUSE 0x00000000 +#define PRINTER_CONTROL_PAUSE 0x00000001 +#define PRINTER_CONTROL_RESUME 0x00000002 +#define PRINTER_CONTROL_PURGE 0x00000003 +#define PRINTER_CONTROL_SET_STATUS 0x00000004 + +#define PRINTER_STATUS_OK 0x00000000 +#define PRINTER_STATUS_PAUSED 0x00000001 +#define PRINTER_STATUS_ERROR 0x00000002 +#define PRINTER_STATUS_PENDING_DELETION 0x00000004 +#define PRINTER_STATUS_PAPER_JAM 0x00000008 + +#define PRINTER_STATUS_PAPER_OUT 0x00000010 +#define PRINTER_STATUS_MANUAL_FEED 0x00000020 +#define PRINTER_STATUS_PAPER_PROBLEM 0x00000040 +#define PRINTER_STATUS_OFFLINE 0x00000080 + +#define PRINTER_STATUS_IO_ACTIVE 0x00000100 +#define PRINTER_STATUS_BUSY 0x00000200 +#define PRINTER_STATUS_PRINTING 0x00000400 +#define PRINTER_STATUS_OUTPUT_BIN_FULL 0x00000800 + +#define PRINTER_STATUS_NOT_AVAILABLE 0x00001000 +#define PRINTER_STATUS_WAITING 0x00002000 +#define PRINTER_STATUS_PROCESSING 0x00004000 +#define PRINTER_STATUS_INITIALIZING 0x00008000 + +#define PRINTER_STATUS_WARMING_UP 0x00010000 +#define PRINTER_STATUS_TONER_LOW 0x00020000 +#define PRINTER_STATUS_NO_TONER 0x00040000 +#define PRINTER_STATUS_PAGE_PUNT 0x00080000 + +#define PRINTER_STATUS_USER_INTERVENTION 0x00100000 +#define PRINTER_STATUS_OUT_OF_MEMORY 0x00200000 +#define PRINTER_STATUS_DOOR_OPEN 0x00400000 +#define PRINTER_STATUS_SERVER_UNKNOWN 0x00800000 + +#define PRINTER_STATUS_POWER_SAVE 0x01000000 + +#define SERVER_ACCESS_ADMINISTER 0x00000001 +#define SERVER_ACCESS_ENUMERATE 0x00000002 +#define PRINTER_ACCESS_ADMINISTER 0x00000004 +#define PRINTER_ACCESS_USE 0x00000008 +#define JOB_ACCESS_ADMINISTER 0x00000010 +#define JOB_ACCESS_READ 0x00000020 + +/* JOB status codes. */ + +#define JOB_STATUS_QUEUED 0x0000 +#define JOB_STATUS_PAUSED 0x0001 +#define JOB_STATUS_ERROR 0x0002 +#define JOB_STATUS_DELETING 0x0004 +#define JOB_STATUS_SPOOLING 0x0008 +#define JOB_STATUS_PRINTING 0x0010 +#define JOB_STATUS_OFFLINE 0x0020 +#define JOB_STATUS_PAPEROUT 0x0040 +#define JOB_STATUS_PRINTED 0x0080 +#define JOB_STATUS_DELETED 0x0100 +#define JOB_STATUS_BLOCKED 0x0200 +#define JOB_STATUS_USER_INTERVENTION 0x0400 + +/* Access rights for print servers */ +#define SERVER_ALL_ACCESS STANDARD_RIGHTS_REQUIRED_ACCESS|SERVER_ACCESS_ADMINISTER|SERVER_ACCESS_ENUMERATE +#define SERVER_READ STANDARD_RIGHTS_READ_ACCESS|SERVER_ACCESS_ENUMERATE +#define SERVER_WRITE STANDARD_RIGHTS_WRITE_ACCESS|SERVER_ACCESS_ADMINISTER|SERVER_ACCESS_ENUMERATE +#define SERVER_EXECUTE STANDARD_RIGHTS_EXECUTE_ACCESS|SERVER_ACCESS_ENUMERATE + +/* Access rights for printers */ +#define PRINTER_ALL_ACCESS STANDARD_RIGHTS_REQUIRED_ACCESS|PRINTER_ACCESS_ADMINISTER|PRINTER_ACCESS_USE +#define PRINTER_READ STANDARD_RIGHTS_READ_ACCESS|PRINTER_ACCESS_USE +#define PRINTER_WRITE STANDARD_RIGHTS_WRITE_ACCESS|PRINTER_ACCESS_USE +#define PRINTER_EXECUTE STANDARD_RIGHTS_EXECUTE_ACCESS|PRINTER_ACCESS_USE + +/* Access rights for jobs */ +#define JOB_ALL_ACCESS STANDARD_RIGHTS_REQUIRED_ACCESS|JOB_ACCESS_ADMINISTER|JOB_ACCESS_READ|PRINTER_ACCESS_USE +#define JOB_READ STANDARD_RIGHTS_READ_ACCESS|JOB_ACCESS_ADMINISTER|JOB_ACCESS_READ +#define JOB_WRITE STANDARD_RIGHTS_WRITE_ACCESS|JOB_ACCESS_ADMINISTER|PRINTER_ACCESS_USE +#define JOB_EXECUTE STANDARD_RIGHTS_EXECUTE_ACCESS|JOB_ACCESS_ADMINISTER|PRINTER_ACCESS_USE + +/* ACE masks for the various print permissions */ + +#define PRINTER_ACE_FULL_CONTROL (GENERIC_ALL_ACCESS|PRINTER_ALL_ACCESS) +#define PRINTER_ACE_MANAGE_DOCUMENTS (GENERIC_ALL_ACCESS|READ_CONTROL_ACCESS) +#define PRINTER_ACE_PRINT (GENERIC_EXECUTE_ACCESS|READ_CONTROL_ACCESS|PRINTER_ACCESS_USE) + + +/* Notify field types */ + +#define NOTIFY_ONE_VALUE 1 /* Notify data is stored in value1 */ +#define NOTIFY_TWO_VALUE 2 /* Notify data is stored in value2 */ +#define NOTIFY_POINTER 3 /* Data is a pointer to a buffer */ +#define NOTIFY_STRING 4 /* Data is a pointer to a buffer w/length */ +#define NOTIFY_SECDESC 5 /* Data is a security descriptor */ + +#define PRINTER_NOTIFY_TYPE 0x00 +#define JOB_NOTIFY_TYPE 0x01 +#define PRINT_TABLE_END 0xFF + +#define MAX_PRINTER_NOTIFY 26 +#define MAX_JOB_NOTIFY 24 + +#define MAX_NOTIFY_TYPE_FOR_NOW 26 + +#define PRINTER_NOTIFY_SERVER_NAME 0x00 +#define PRINTER_NOTIFY_PRINTER_NAME 0x01 +#define PRINTER_NOTIFY_SHARE_NAME 0x02 +#define PRINTER_NOTIFY_PORT_NAME 0x03 +#define PRINTER_NOTIFY_DRIVER_NAME 0x04 +#define PRINTER_NOTIFY_COMMENT 0x05 +#define PRINTER_NOTIFY_LOCATION 0x06 +#define PRINTER_NOTIFY_DEVMODE 0x07 +#define PRINTER_NOTIFY_SEPFILE 0x08 +#define PRINTER_NOTIFY_PRINT_PROCESSOR 0x09 +#define PRINTER_NOTIFY_PARAMETERS 0x0A +#define PRINTER_NOTIFY_DATATYPE 0x0B +#define PRINTER_NOTIFY_SECURITY_DESCRIPTOR 0x0C +#define PRINTER_NOTIFY_ATTRIBUTES 0x0D +#define PRINTER_NOTIFY_PRIORITY 0x0E +#define PRINTER_NOTIFY_DEFAULT_PRIORITY 0x0F +#define PRINTER_NOTIFY_START_TIME 0x10 +#define PRINTER_NOTIFY_UNTIL_TIME 0x11 +#define PRINTER_NOTIFY_STATUS 0x12 +#define PRINTER_NOTIFY_STATUS_STRING 0x13 +#define PRINTER_NOTIFY_CJOBS 0x14 +#define PRINTER_NOTIFY_AVERAGE_PPM 0x15 +#define PRINTER_NOTIFY_TOTAL_PAGES 0x16 +#define PRINTER_NOTIFY_PAGES_PRINTED 0x17 +#define PRINTER_NOTIFY_TOTAL_BYTES 0x18 +#define PRINTER_NOTIFY_BYTES_PRINTED 0x19 + +#define JOB_NOTIFY_PRINTER_NAME 0x00 +#define JOB_NOTIFY_MACHINE_NAME 0x01 +#define JOB_NOTIFY_PORT_NAME 0x02 +#define JOB_NOTIFY_USER_NAME 0x03 +#define JOB_NOTIFY_NOTIFY_NAME 0x04 +#define JOB_NOTIFY_DATATYPE 0x05 +#define JOB_NOTIFY_PRINT_PROCESSOR 0x06 +#define JOB_NOTIFY_PARAMETERS 0x07 +#define JOB_NOTIFY_DRIVER_NAME 0x08 +#define JOB_NOTIFY_DEVMODE 0x09 +#define JOB_NOTIFY_STATUS 0x0A +#define JOB_NOTIFY_STATUS_STRING 0x0B +#define JOB_NOTIFY_SECURITY_DESCRIPTOR 0x0C +#define JOB_NOTIFY_DOCUMENT 0x0D +#define JOB_NOTIFY_PRIORITY 0x0E +#define JOB_NOTIFY_POSITION 0x0F +#define JOB_NOTIFY_SUBMITTED 0x10 +#define JOB_NOTIFY_START_TIME 0x11 +#define JOB_NOTIFY_UNTIL_TIME 0x12 +#define JOB_NOTIFY_TIME 0x13 +#define JOB_NOTIFY_TOTAL_PAGES 0x14 +#define JOB_NOTIFY_PAGES_PRINTED 0x15 +#define JOB_NOTIFY_TOTAL_BYTES 0x16 +#define JOB_NOTIFY_BYTES_PRINTED 0x17 + +#define PRINTER_NOTIFY_OPTIONS_REFRESH 0x01 + +#define PRINTER_CHANGE_ADD_PRINTER 0x00000001 +#define PRINTER_CHANGE_SET_PRINTER 0x00000002 +#define PRINTER_CHANGE_DELETE_PRINTER 0x00000004 +#define PRINTER_CHANGE_FAILED_CONNECTION_PRINTER 0x00000008 +#define PRINTER_CHANGE_PRINTER (PRINTER_CHANGE_ADD_PRINTER | \ + PRINTER_CHANGE_SET_PRINTER | \ + PRINTER_CHANGE_DELETE_PRINTER | \ + PRINTER_CHANGE_FAILED_CONNECTION_PRINTER ) + +#define PRINTER_CHANGE_ADD_JOB 0x00000100 +#define PRINTER_CHANGE_SET_JOB 0x00000200 +#define PRINTER_CHANGE_DELETE_JOB 0x00000400 +#define PRINTER_CHANGE_WRITE_JOB 0x00000800 +#define PRINTER_CHANGE_JOB (PRINTER_CHANGE_ADD_JOB | \ + PRINTER_CHANGE_SET_JOB | \ + PRINTER_CHANGE_DELETE_JOB | \ + PRINTER_CHANGE_WRITE_JOB ) + +#define PRINTER_CHANGE_ADD_FORM 0x00010000 +#define PRINTER_CHANGE_SET_FORM 0x00020000 +#define PRINTER_CHANGE_DELETE_FORM 0x00040000 +#define PRINTER_CHANGE_FORM (PRINTER_CHANGE_ADD_FORM | \ + PRINTER_CHANGE_SET_FORM | \ + PRINTER_CHANGE_DELETE_FORM ) + +#define PRINTER_CHANGE_ADD_PORT 0x00100000 +#define PRINTER_CHANGE_CONFIGURE_PORT 0x00200000 +#define PRINTER_CHANGE_DELETE_PORT 0x00400000 +#define PRINTER_CHANGE_PORT (PRINTER_CHANGE_ADD_PORT | \ + PRINTER_CHANGE_CONFIGURE_PORT | \ + PRINTER_CHANGE_DELETE_PORT ) + +#define PRINTER_CHANGE_ADD_PRINT_PROCESSOR 0x01000000 +#define PRINTER_CHANGE_DELETE_PRINT_PROCESSOR 0x04000000 +#define PRINTER_CHANGE_PRINT_PROCESSOR (PRINTER_CHANGE_ADD_PRINT_PROCESSOR | \ + PRINTER_CHANGE_DELETE_PRINT_PROCESSOR ) + +#define PRINTER_CHANGE_ADD_PRINTER_DRIVER 0x10000000 +#define PRINTER_CHANGE_SET_PRINTER_DRIVER 0x20000000 +#define PRINTER_CHANGE_DELETE_PRINTER_DRIVER 0x40000000 +#define PRINTER_CHANGE_PRINTER_DRIVER (PRINTER_CHANGE_ADD_PRINTER_DRIVER | \ + PRINTER_CHANGE_SET_PRINTER_DRIVER | \ + PRINTER_CHANGE_DELETE_PRINTER_DRIVER ) + +#define PRINTER_CHANGE_TIMEOUT 0x80000000 +#define PRINTER_CHANGE_ALL (PRINTER_CHANGE_JOB | \ + PRINTER_CHANGE_FORM | \ + PRINTER_CHANGE_PORT | \ + PRINTER_CHANGE_PRINT_PROCESSOR | \ + PRINTER_CHANGE_PRINTER_DRIVER ) + +#define PRINTER_NOTIFY_INFO_DISCARDED 0x1 + +/* + * Set of macros for flagging what changed in the PRINTER_INFO_2 struct + * when sending messages to other smbd's + */ +#define PRINTER_MESSAGE_NULL 0x00000000 +#define PRINTER_MESSAGE_DRIVER 0x00000001 +#define PRINTER_MESSAGE_COMMENT 0x00000002 +#define PRINTER_MESSAGE_PRINTERNAME 0x00000004 +#define PRINTER_MESSAGE_LOCATION 0x00000008 +#define PRINTER_MESSAGE_DEVMODE 0x00000010 /* not curently supported */ +#define PRINTER_MESSAGE_SEPFILE 0x00000020 +#define PRINTER_MESSAGE_PRINTPROC 0x00000040 +#define PRINTER_MESSAGE_PARAMS 0x00000080 +#define PRINTER_MESSAGE_DATATYPE 0x00000100 +#define PRINTER_MESSAGE_SECDESC 0x00000200 +#define PRINTER_MESSAGE_CJOBS 0x00000400 +#define PRINTER_MESSAGE_PORT 0x00000800 +#define PRINTER_MESSAGE_SHARENAME 0x00001000 +#define PRINTER_MESSAGE_ATTRIBUTES 0x00002000 + +typedef struct printer_message_info { + uint32 low; /* PRINTER_CHANGE_XXX */ + uint32 high; /* PRINTER_CHANGE_XXX */ + fstring printer_name; + uint32 flags; /* PRINTER_MESSAGE_XXX */ +} +PRINTER_MESSAGE_INFO; + +/* + * The printer attributes. + * I #defined all of them (grabbed form MSDN) + * I'm only using: + * ( SHARED | NETWORK | RAW_ONLY ) + * RAW_ONLY _MUST_ be present otherwise NT will send an EMF file + */ + +#define PRINTER_ATTRIBUTE_QUEUED 0x00000001 +#define PRINTER_ATTRIBUTE_DIRECT 0x00000002 +#define PRINTER_ATTRIBUTE_DEFAULT 0x00000004 +#define PRINTER_ATTRIBUTE_SHARED 0x00000008 + +#define PRINTER_ATTRIBUTE_NETWORK 0x00000010 +#define PRINTER_ATTRIBUTE_HIDDEN 0x00000020 +#define PRINTER_ATTRIBUTE_LOCAL 0x00000040 +#define PRINTER_ATTRIBUTE_ENABLE_DEVQ 0x00000080 + +#define PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS 0x00000100 +#define PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST 0x00000200 +#define PRINTER_ATTRIBUTE_WORK_OFFLINE 0x00000400 +#define PRINTER_ATTRIBUTE_ENABLE_BIDI 0x00000800 + +#define PRINTER_ATTRIBUTE_RAW_ONLY 0x00001000 +#define PRINTER_ATTRIBUTE_PUBLISHED 0x00002000 + +#define PRINTER_ATTRIBUTE_SAMBA (PRINTER_ATTRIBUTE_RAW_ONLY|\ + PRINTER_ATTRIBUTE_SHARED|\ + PRINTER_ATTRIBUTE_LOCAL) +#define PRINTER_ATTRIBUTE_NOT_SAMBA (PRINTER_ATTRIBUTE_NETWORK) + +#define NO_PRIORITY 0 +#define MAX_PRIORITY 99 +#define MIN_PRIORITY 1 +#define DEF_PRIORITY 1 + +/* the flags of the query */ +#define PRINTER_ENUM_DEFAULT 0x00000001 +#define PRINTER_ENUM_LOCAL 0x00000002 +#define PRINTER_ENUM_CONNECTIONS 0x00000004 +#define PRINTER_ENUM_FAVORITE 0x00000004 +#define PRINTER_ENUM_NAME 0x00000008 +#define PRINTER_ENUM_REMOTE 0x00000010 +#define PRINTER_ENUM_SHARED 0x00000020 +#define PRINTER_ENUM_NETWORK 0x00000040 + +/* the flags of each printers */ +#define PRINTER_ENUM_UNKNOWN_8 0x00000008 +#define PRINTER_ENUM_EXPAND 0x00004000 +#define PRINTER_ENUM_CONTAINER 0x00008000 +#define PRINTER_ENUM_ICONMASK 0x00ff0000 +#define PRINTER_ENUM_ICON1 0x00010000 +#define PRINTER_ENUM_ICON2 0x00020000 +#define PRINTER_ENUM_ICON3 0x00040000 +#define PRINTER_ENUM_ICON4 0x00080000 +#define PRINTER_ENUM_ICON5 0x00100000 +#define PRINTER_ENUM_ICON6 0x00200000 +#define PRINTER_ENUM_ICON7 0x00400000 +#define PRINTER_ENUM_ICON8 0x00800000 + +/* FLAGS for SPOOLSS_DELETEPRINTERDRIVEREX */ + +#define DPD_DELETE_UNUSED_FILES 0x00000001 +#define DPD_DELETE_SPECIFIC_VERSION 0x00000002 +#define DPD_DELETE_ALL_FILES 0x00000004 + +#define DRIVER_ANY_VERSION 0xffffffff +#define DRIVER_MAX_VERSION 4 + +/* FLAGS for SPOOLSS_ADDPRINTERDRIVEREX */ + +#define APD_STRICT_UPGRADE 0x00000001 +#define APD_STRICT_DOWNGRADE 0x00000002 +#define APD_COPY_ALL_FILES 0x00000004 +#define APD_COPY_NEW_FILES 0x00000008 + + +/* this struct is undocumented */ +/* thanks to the ddk ... */ +typedef struct { + uint32 size; /* length of user_name & client_name + 2? */ + UNISTR2 *client_name; + UNISTR2 *user_name; + uint32 build; + uint32 major; + uint32 minor; + uint32 processor; +} SPOOL_USER_1; + +typedef struct { + uint32 level; + union { + SPOOL_USER_1 *user1; + } user; +} SPOOL_USER_CTR; + +/* + * various bits in the DEVICEMODE.fields member + */ + +#define DEVMODE_ORIENTATION 0x00000001 +#define DEVMODE_PAPERSIZE 0x00000002 +#define DEVMODE_PAPERLENGTH 0x00000004 +#define DEVMODE_PAPERWIDTH 0x00000008 +#define DEVMODE_SCALE 0x00000010 +#define DEVMODE_POSITION 0x00000020 +#define DEVMODE_NUP 0x00000040 +#define DEVMODE_COPIES 0x00000100 +#define DEVMODE_DEFAULTSOURCE 0x00000200 +#define DEVMODE_PRINTQUALITY 0x00000400 +#define DEVMODE_COLOR 0x00000800 +#define DEVMODE_DUPLEX 0x00001000 +#define DEVMODE_YRESOLUTION 0x00002000 +#define DEVMODE_TTOPTION 0x00004000 +#define DEVMODE_COLLATE 0x00008000 +#define DEVMODE_FORMNAME 0x00010000 +#define DEVMODE_LOGPIXELS 0x00020000 +#define DEVMODE_BITSPERPEL 0x00040000 +#define DEVMODE_PELSWIDTH 0x00080000 +#define DEVMODE_PELSHEIGHT 0x00100000 +#define DEVMODE_DISPLAYFLAGS 0x00200000 +#define DEVMODE_DISPLAYFREQUENCY 0x00400000 +#define DEVMODE_ICMMETHOD 0x00800000 +#define DEVMODE_ICMINTENT 0x01000000 +#define DEVMODE_MEDIATYPE 0x02000000 +#define DEVMODE_DITHERTYPE 0x04000000 +#define DEVMODE_PANNINGWIDTH 0x08000000 +#define DEVMODE_PANNINGHEIGHT 0x10000000 + + +/* + * Devicemode structure + */ + +typedef struct devicemode +{ + UNISTR devicename; + uint16 specversion; + uint16 driverversion; + uint16 size; + uint16 driverextra; + uint32 fields; + uint16 orientation; + uint16 papersize; + uint16 paperlength; + uint16 paperwidth; + uint16 scale; + uint16 copies; + uint16 defaultsource; + uint16 printquality; + uint16 color; + uint16 duplex; + uint16 yresolution; + uint16 ttoption; + uint16 collate; + UNISTR formname; + uint16 logpixels; + uint32 bitsperpel; + uint32 pelswidth; + uint32 pelsheight; + uint32 displayflags; + uint32 displayfrequency; + uint32 icmmethod; + uint32 icmintent; + uint32 mediatype; + uint32 dithertype; + uint32 reserved1; + uint32 reserved2; + uint32 panningwidth; + uint32 panningheight; + uint8 *dev_private; +} +DEVICEMODE; + +typedef struct _devmode_cont +{ + uint32 size; + uint32 devmode_ptr; + DEVICEMODE *devmode; +} +DEVMODE_CTR; + +typedef struct _printer_default +{ + uint32 datatype_ptr; + UNISTR2 datatype; + DEVMODE_CTR devmode_cont; + uint32 access_required; +} +PRINTER_DEFAULT; + +/********************************************/ + +typedef struct { + UNISTR2 *printername; + PRINTER_DEFAULT printer_default; +} SPOOL_Q_OPEN_PRINTER; + +typedef struct { + POLICY_HND handle; /* handle used along all transactions (20*uint8) */ + WERROR status; +} SPOOL_R_OPEN_PRINTER; + +/********************************************/ + +typedef struct { + UNISTR2 *printername; + PRINTER_DEFAULT printer_default; + uint32 user_switch; + SPOOL_USER_CTR user_ctr; +} SPOOL_Q_OPEN_PRINTER_EX; + +typedef struct { + POLICY_HND handle; /* handle used along all transactions (20*uint8) */ + WERROR status; +} SPOOL_R_OPEN_PRINTER_EX; + +/********************************************/ + +typedef struct spool_notify_option_type +{ + uint16 type; + uint16 reserved0; + uint32 reserved1; + uint32 reserved2; + uint32 count; + uint32 fields_ptr; + uint32 count2; + uint16 fields[MAX_NOTIFY_TYPE_FOR_NOW]; +} +SPOOL_NOTIFY_OPTION_TYPE; + +typedef struct spool_notify_option_type_ctr +{ + uint32 count; + SPOOL_NOTIFY_OPTION_TYPE *type; +} +SPOOL_NOTIFY_OPTION_TYPE_CTR; + + + +typedef struct s_header_type +{ + uint32 type; + union + { + uint32 value; + UNISTR string; + } + data; +} +HEADER_TYPE; + + +typedef struct spool_q_getprinterdata +{ + POLICY_HND handle; + UNISTR2 valuename; + uint32 size; +} +SPOOL_Q_GETPRINTERDATA; + +typedef struct spool_r_getprinterdata +{ + uint32 type; + uint32 size; + uint8 *data; + uint32 needed; + WERROR status; +} +SPOOL_R_GETPRINTERDATA; + +typedef struct spool_q_deleteprinterdata +{ + POLICY_HND handle; + UNISTR2 valuename; +} +SPOOL_Q_DELETEPRINTERDATA; + +typedef struct spool_r_deleteprinterdata +{ + WERROR status; +} +SPOOL_R_DELETEPRINTERDATA; + +typedef struct spool_q_closeprinter +{ + POLICY_HND handle; +} +SPOOL_Q_CLOSEPRINTER; + +typedef struct spool_r_closeprinter +{ + POLICY_HND handle; + WERROR status; +} +SPOOL_R_CLOSEPRINTER; + +typedef struct spool_q_startpageprinter +{ + POLICY_HND handle; +} +SPOOL_Q_STARTPAGEPRINTER; + +typedef struct spool_r_startpageprinter +{ + WERROR status; +} +SPOOL_R_STARTPAGEPRINTER; + +typedef struct spool_q_endpageprinter +{ + POLICY_HND handle; +} +SPOOL_Q_ENDPAGEPRINTER; + +typedef struct spool_r_endpageprinter +{ + WERROR status; +} +SPOOL_R_ENDPAGEPRINTER; + + +typedef struct spool_q_deleteprinterdriver +{ + uint32 server_ptr; + UNISTR2 server; + UNISTR2 arch; + UNISTR2 driver; +} +SPOOL_Q_DELETEPRINTERDRIVER; + +typedef struct spool_r_deleteprinterdriver +{ + WERROR status; +} +SPOOL_R_DELETEPRINTERDRIVER; + +typedef struct spool_q_deleteprinterdriverex +{ + uint32 server_ptr; + UNISTR2 server; + UNISTR2 arch; + UNISTR2 driver; + uint32 delete_flags; + uint32 version; +} +SPOOL_Q_DELETEPRINTERDRIVEREX; + +typedef struct spool_r_deleteprinterdriverex +{ + WERROR status; +} +SPOOL_R_DELETEPRINTERDRIVEREX; + + +typedef struct spool_doc_info_1 +{ + uint32 p_docname; + uint32 p_outputfile; + uint32 p_datatype; + UNISTR2 docname; + UNISTR2 outputfile; + UNISTR2 datatype; +} +DOC_INFO_1; + +typedef struct spool_doc_info +{ + uint32 switch_value; + DOC_INFO_1 doc_info_1; +} +DOC_INFO; + +typedef struct spool_doc_info_container +{ + uint32 level; + DOC_INFO docinfo; +} +DOC_INFO_CONTAINER; + +typedef struct spool_q_startdocprinter +{ + POLICY_HND handle; + DOC_INFO_CONTAINER doc_info_container; +} +SPOOL_Q_STARTDOCPRINTER; + +typedef struct spool_r_startdocprinter +{ + uint32 jobid; + WERROR status; +} +SPOOL_R_STARTDOCPRINTER; + +typedef struct spool_q_enddocprinter +{ + POLICY_HND handle; +} +SPOOL_Q_ENDDOCPRINTER; + +typedef struct spool_r_enddocprinter +{ + WERROR status; +} +SPOOL_R_ENDDOCPRINTER; + +typedef struct spool_q_writeprinter +{ + POLICY_HND handle; + uint32 buffer_size; + uint8 *buffer; + uint32 buffer_size2; +} +SPOOL_Q_WRITEPRINTER; + +typedef struct spool_r_writeprinter +{ + uint32 buffer_written; + WERROR status; +} +SPOOL_R_WRITEPRINTER; + +typedef struct spool_notify_option +{ + uint32 version; + uint32 flags; + uint32 count; + uint32 option_type_ptr; + SPOOL_NOTIFY_OPTION_TYPE_CTR ctr; +} +SPOOL_NOTIFY_OPTION; + +typedef struct spool_notify_info_data +{ + uint16 type; + uint16 field; + uint32 reserved; + uint32 id; + union { + uint32 value[2]; + struct { + uint32 length; + uint16 *string; + } data; + struct { + uint32 size; + SEC_DESC *desc; + } sd; + } + notify_data; + uint32 size; + uint32 enc_type; +} SPOOL_NOTIFY_INFO_DATA; + +typedef struct spool_notify_info +{ + uint32 version; + uint32 flags; + uint32 count; + SPOOL_NOTIFY_INFO_DATA *data; +} +SPOOL_NOTIFY_INFO; + +/* If the struct name looks obscure, yes it is ! */ +/* RemoteFindFirstPrinterChangeNotificationEx query struct */ +typedef struct spoolss_q_rffpcnex +{ + POLICY_HND handle; + uint32 flags; + uint32 options; + uint32 localmachine_ptr; + UNISTR2 localmachine; + uint32 printerlocal; + uint32 option_ptr; + SPOOL_NOTIFY_OPTION *option; +} +SPOOL_Q_RFFPCNEX; + +typedef struct spool_r_rffpcnex +{ + WERROR status; +} +SPOOL_R_RFFPCNEX; + +/* Remote Find Next Printer Change Notify Ex */ +typedef struct spool_q_rfnpcnex +{ + POLICY_HND handle; + uint32 change; + uint32 option_ptr; + SPOOL_NOTIFY_OPTION *option; +} +SPOOL_Q_RFNPCNEX; + +typedef struct spool_r_rfnpcnex +{ + uint32 info_ptr; + SPOOL_NOTIFY_INFO info; + WERROR status; +} +SPOOL_R_RFNPCNEX; + +/* Find Close Printer Notify */ +typedef struct spool_q_fcpn +{ + POLICY_HND handle; +} +SPOOL_Q_FCPN; + +typedef struct spool_r_fcpn +{ + WERROR status; +} +SPOOL_R_FCPN; + + +typedef struct printer_info_0 +{ + UNISTR printername; + UNISTR servername; + uint32 cjobs; + uint32 total_jobs; + uint32 total_bytes; + + uint16 year; + uint16 month; + uint16 dayofweek; + uint16 day; + uint16 hour; + uint16 minute; + uint16 second; + uint16 milliseconds; + + uint32 global_counter; + uint32 total_pages; + + uint16 major_version; + uint16 build_version; + + uint32 unknown7; + uint32 unknown8; + uint32 unknown9; + uint32 session_counter; + uint32 unknown11; + uint32 printer_errors; + uint32 unknown13; + uint32 unknown14; + uint32 unknown15; + uint32 unknown16; + uint32 change_id; + uint32 unknown18; + uint32 status; + uint32 unknown20; + uint32 c_setprinter; + + uint16 unknown22; + uint16 unknown23; + uint16 unknown24; + uint16 unknown25; + uint16 unknown26; + uint16 unknown27; + uint16 unknown28; + uint16 unknown29; +} PRINTER_INFO_0; + +typedef struct printer_info_1 +{ + uint32 flags; + UNISTR description; + UNISTR name; + UNISTR comment; +} +PRINTER_INFO_1; + +typedef struct printer_info_2 +{ + UNISTR servername; + UNISTR printername; + UNISTR sharename; + UNISTR portname; + UNISTR drivername; + UNISTR comment; + UNISTR location; + DEVICEMODE *devmode; + UNISTR sepfile; + UNISTR printprocessor; + UNISTR datatype; + UNISTR parameters; + SEC_DESC *secdesc; + uint32 attributes; + uint32 priority; + uint32 defaultpriority; + uint32 starttime; + uint32 untiltime; + uint32 status; + uint32 cjobs; + uint32 averageppm; +} +PRINTER_INFO_2; + +typedef struct printer_info_3 +{ + SEC_DESC *secdesc; +} +PRINTER_INFO_3; + +typedef struct printer_info_4 +{ + UNISTR printername; + UNISTR servername; + uint32 attributes; +} +PRINTER_INFO_4; + +typedef struct printer_info_5 +{ + UNISTR printername; + UNISTR portname; + uint32 attributes; + uint32 device_not_selected_timeout; + uint32 transmission_retry_timeout; +} +PRINTER_INFO_5; + +typedef struct printer_info_6 +{ + uint32 status; +} +PRINTER_INFO_6; + +#define SPOOL_DS_PUBLISH 1 +#define SPOOL_DS_UPDATE 2 +#define SPOOL_DS_UNPUBLISH 4 +#define SPOOL_DS_PENDING 0x80000000 + +typedef struct printer_info_7 +{ + UNISTR guid; /* text form of printer guid */ + uint32 action; +} +PRINTER_INFO_7; + +typedef struct spool_q_enumprinters +{ + uint32 flags; + uint32 servername_ptr; + UNISTR2 servername; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ENUMPRINTERS; + +typedef struct printer_info_ctr_info +{ + PRINTER_INFO_0 *printers_0; + PRINTER_INFO_1 *printers_1; + PRINTER_INFO_2 *printers_2; + PRINTER_INFO_3 *printers_3; + PRINTER_INFO_4 *printers_4; + PRINTER_INFO_5 *printers_5; + PRINTER_INFO_7 *printers_7; +} +PRINTER_INFO_CTR; + +typedef struct spool_r_enumprinters +{ + RPC_BUFFER *buffer; + uint32 needed; /* bytes needed */ + uint32 returned; /* number of printers */ + WERROR status; +} +SPOOL_R_ENUMPRINTERS; + + +typedef struct spool_q_getprinter +{ + POLICY_HND handle; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_GETPRINTER; + +typedef struct printer_info_info +{ + union + { + PRINTER_INFO_0 *info0; + PRINTER_INFO_1 *info1; + PRINTER_INFO_2 *info2; + void *info; + } printer; +} PRINTER_INFO; + +typedef struct spool_r_getprinter +{ + RPC_BUFFER *buffer; + uint32 needed; + WERROR status; +} SPOOL_R_GETPRINTER; + +typedef struct driver_info_1 +{ + UNISTR name; +} DRIVER_INFO_1; + +typedef struct driver_info_2 +{ + uint32 version; + UNISTR name; + UNISTR architecture; + UNISTR driverpath; + UNISTR datafile; + UNISTR configfile; +} DRIVER_INFO_2; + +typedef struct driver_info_3 +{ + uint32 version; + UNISTR name; + UNISTR architecture; + UNISTR driverpath; + UNISTR datafile; + UNISTR configfile; + UNISTR helpfile; + uint16 *dependentfiles; + UNISTR monitorname; + UNISTR defaultdatatype; +} +DRIVER_INFO_3; + +typedef struct driver_info_6 +{ + uint32 version; + UNISTR name; + UNISTR architecture; + UNISTR driverpath; + UNISTR datafile; + UNISTR configfile; + UNISTR helpfile; + uint16 *dependentfiles; + UNISTR monitorname; + UNISTR defaultdatatype; + uint16* previousdrivernames; + NTTIME driver_date; + uint32 padding; + uint32 driver_version_low; + uint32 driver_version_high; + UNISTR mfgname; + UNISTR oem_url; + UNISTR hardware_id; + UNISTR provider; +} +DRIVER_INFO_6; + +typedef struct driver_info_info +{ + DRIVER_INFO_1 *info1; + DRIVER_INFO_2 *info2; + DRIVER_INFO_3 *info3; + DRIVER_INFO_6 *info6; +} +PRINTER_DRIVER_CTR; + +typedef struct spool_q_getprinterdriver2 +{ + POLICY_HND handle; + uint32 architecture_ptr; + UNISTR2 architecture; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; + uint32 clientmajorversion; + uint32 clientminorversion; +} +SPOOL_Q_GETPRINTERDRIVER2; + +typedef struct spool_r_getprinterdriver2 +{ + RPC_BUFFER *buffer; + uint32 needed; + uint32 servermajorversion; + uint32 serverminorversion; + WERROR status; +} +SPOOL_R_GETPRINTERDRIVER2; + + +typedef struct add_jobinfo_1 +{ + UNISTR path; + uint32 job_number; +} +ADD_JOBINFO_1; + + +typedef struct spool_q_addjob +{ + POLICY_HND handle; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ADDJOB; + +typedef struct spool_r_addjob +{ + RPC_BUFFER *buffer; + uint32 needed; + WERROR status; +} +SPOOL_R_ADDJOB; + +/* + * I'm really wondering how many different time formats + * I will have to cope with + * + * JFM, 09/13/98 In a mad mood ;-( +*/ +typedef struct systemtime +{ + uint16 year; + uint16 month; + uint16 dayofweek; + uint16 day; + uint16 hour; + uint16 minute; + uint16 second; + uint16 milliseconds; +} +SYSTEMTIME; + +typedef struct s_job_info_1 +{ + uint32 jobid; + UNISTR printername; + UNISTR machinename; + UNISTR username; + UNISTR document; + UNISTR datatype; + UNISTR text_status; + uint32 status; + uint32 priority; + uint32 position; + uint32 totalpages; + uint32 pagesprinted; + SYSTEMTIME submitted; +} +JOB_INFO_1; + +typedef struct s_job_info_2 +{ + uint32 jobid; + UNISTR printername; + UNISTR machinename; + UNISTR username; + UNISTR document; + UNISTR notifyname; + UNISTR datatype; + UNISTR printprocessor; + UNISTR parameters; + UNISTR drivername; + DEVICEMODE *devmode; + UNISTR text_status; +/* SEC_DESC sec_desc;*/ + uint32 status; + uint32 priority; + uint32 position; + uint32 starttime; + uint32 untiltime; + uint32 totalpages; + uint32 size; + SYSTEMTIME submitted; + uint32 timeelapsed; + uint32 pagesprinted; +} +JOB_INFO_2; + +typedef struct spool_q_enumjobs +{ + POLICY_HND handle; + uint32 firstjob; + uint32 numofjobs; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ENUMJOBS; + +typedef struct job_info_ctr_info +{ + union + { + JOB_INFO_1 *job_info_1; + JOB_INFO_2 *job_info_2; + void *info; + } job; + +} JOB_INFO_CTR; + +typedef struct spool_r_enumjobs +{ + RPC_BUFFER *buffer; + uint32 needed; + uint32 returned; + WERROR status; +} +SPOOL_R_ENUMJOBS; + +typedef struct spool_q_schedulejob +{ + POLICY_HND handle; + uint32 jobid; +} +SPOOL_Q_SCHEDULEJOB; + +typedef struct spool_r_schedulejob +{ + WERROR status; +} +SPOOL_R_SCHEDULEJOB; + +typedef struct s_port_info_1 +{ + UNISTR port_name; +} +PORT_INFO_1; + +typedef struct s_port_info_2 +{ + UNISTR port_name; + UNISTR monitor_name; + UNISTR description; + uint32 port_type; + uint32 reserved; +} +PORT_INFO_2; + +/* Port Type bits */ +#define PORT_TYPE_WRITE 0x0001 +#define PORT_TYPE_READ 0x0002 +#define PORT_TYPE_REDIRECTED 0x0004 +#define PORT_TYPE_NET_ATTACHED 0x0008 + +typedef struct spool_q_enumports +{ + uint32 name_ptr; + UNISTR2 name; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ENUMPORTS; + +typedef struct port_info_ctr_info +{ + union + { + PORT_INFO_1 *info_1; + PORT_INFO_2 *info_2; + } + port; + +} +PORT_INFO_CTR; + +typedef struct spool_r_enumports +{ + RPC_BUFFER *buffer; + uint32 needed; /* bytes needed */ + uint32 returned; /* number of printers */ + WERROR status; +} +SPOOL_R_ENUMPORTS; + +#define JOB_CONTROL_PAUSE 1 +#define JOB_CONTROL_RESUME 2 +#define JOB_CONTROL_CANCEL 3 +#define JOB_CONTROL_RESTART 4 +#define JOB_CONTROL_DELETE 5 + +typedef struct job_info_info +{ + union + { + JOB_INFO_1 job_info_1; + JOB_INFO_2 job_info_2; + } + job; + +} +JOB_INFO; + +typedef struct spool_q_setjob +{ + POLICY_HND handle; + uint32 jobid; + uint32 level; + JOB_INFO ctr; + uint32 command; + +} +SPOOL_Q_SETJOB; + +typedef struct spool_r_setjob +{ + WERROR status; + +} +SPOOL_R_SETJOB; + +typedef struct spool_q_enumprinterdrivers +{ + uint32 name_ptr; + UNISTR2 name; + uint32 environment_ptr; + UNISTR2 environment; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ENUMPRINTERDRIVERS; + +typedef struct spool_r_enumprinterdrivers +{ + RPC_BUFFER *buffer; + uint32 needed; + uint32 returned; + WERROR status; +} +SPOOL_R_ENUMPRINTERDRIVERS; + +#define FORM_USER 0 +#define FORM_BUILTIN 1 +#define FORM_PRINTER 2 + +typedef struct spool_form_1 +{ + uint32 flag; + UNISTR name; + uint32 width; + uint32 length; + uint32 left; + uint32 top; + uint32 right; + uint32 bottom; +} +FORM_1; + +typedef struct spool_q_enumforms +{ + POLICY_HND handle; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ENUMFORMS; + +typedef struct spool_r_enumforms +{ + RPC_BUFFER *buffer; + uint32 needed; + uint32 numofforms; + WERROR status; +} +SPOOL_R_ENUMFORMS; + +typedef struct spool_q_getform +{ + POLICY_HND handle; + UNISTR2 formname; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_GETFORM; + +typedef struct spool_r_getform +{ + RPC_BUFFER *buffer; + uint32 needed; + WERROR status; +} +SPOOL_R_GETFORM; + +typedef struct spool_printer_info_level_1 +{ + uint32 flags; + uint32 description_ptr; + uint32 name_ptr; + uint32 comment_ptr; + UNISTR2 description; + UNISTR2 name; + UNISTR2 comment; +} SPOOL_PRINTER_INFO_LEVEL_1; + +typedef struct spool_printer_info_level_2 +{ + uint32 servername_ptr; + uint32 printername_ptr; + uint32 sharename_ptr; + uint32 portname_ptr; + uint32 drivername_ptr; + uint32 comment_ptr; + uint32 location_ptr; + uint32 devmode_ptr; + uint32 sepfile_ptr; + uint32 printprocessor_ptr; + uint32 datatype_ptr; + uint32 parameters_ptr; + uint32 secdesc_ptr; + uint32 attributes; + uint32 priority; + uint32 default_priority; + uint32 starttime; + uint32 untiltime; + uint32 status; + uint32 cjobs; + uint32 averageppm; + UNISTR2 servername; + UNISTR2 printername; + UNISTR2 sharename; + UNISTR2 portname; + UNISTR2 drivername; + UNISTR2 comment; + UNISTR2 location; + UNISTR2 sepfile; + UNISTR2 printprocessor; + UNISTR2 datatype; + UNISTR2 parameters; +} +SPOOL_PRINTER_INFO_LEVEL_2; + +typedef struct spool_printer_info_level_3 +{ + uint32 secdesc_ptr; +} +SPOOL_PRINTER_INFO_LEVEL_3; + +typedef struct spool_printer_info_level_7 +{ + uint32 guid_ptr; + uint32 action; + UNISTR2 guid; +} +SPOOL_PRINTER_INFO_LEVEL_7; + +typedef struct spool_printer_info_level +{ + uint32 level; + uint32 info_ptr; + SPOOL_PRINTER_INFO_LEVEL_1 *info_1; + SPOOL_PRINTER_INFO_LEVEL_2 *info_2; + SPOOL_PRINTER_INFO_LEVEL_3 *info_3; + SPOOL_PRINTER_INFO_LEVEL_7 *info_7; +} +SPOOL_PRINTER_INFO_LEVEL; + +typedef struct spool_printer_driver_info_level_3 +{ + uint32 cversion; + uint32 name_ptr; + uint32 environment_ptr; + uint32 driverpath_ptr; + uint32 datafile_ptr; + uint32 configfile_ptr; + uint32 helpfile_ptr; + uint32 monitorname_ptr; + uint32 defaultdatatype_ptr; + uint32 dependentfilessize; + uint32 dependentfiles_ptr; + + UNISTR2 name; + UNISTR2 environment; + UNISTR2 driverpath; + UNISTR2 datafile; + UNISTR2 configfile; + UNISTR2 helpfile; + UNISTR2 monitorname; + UNISTR2 defaultdatatype; + BUFFER5 dependentfiles; + +} +SPOOL_PRINTER_DRIVER_INFO_LEVEL_3; + +/* SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure */ +typedef struct { + uint32 version; + uint32 name_ptr; + uint32 environment_ptr; + uint32 driverpath_ptr; + uint32 datafile_ptr; + uint32 configfile_ptr; + uint32 helpfile_ptr; + uint32 monitorname_ptr; + uint32 defaultdatatype_ptr; + uint32 dependentfiles_len; + uint32 dependentfiles_ptr; + uint32 previousnames_len; + uint32 previousnames_ptr; + NTTIME driverdate; + uint64 driverversion; + uint32 dummy4; + uint32 mfgname_ptr; + uint32 oemurl_ptr; + uint32 hardwareid_ptr; + uint32 provider_ptr; + UNISTR2 name; + UNISTR2 environment; + UNISTR2 driverpath; + UNISTR2 datafile; + UNISTR2 configfile; + UNISTR2 helpfile; + UNISTR2 monitorname; + UNISTR2 defaultdatatype; + BUFFER5 dependentfiles; + BUFFER5 previousnames; + UNISTR2 mfgname; + UNISTR2 oemurl; + UNISTR2 hardwareid; + UNISTR2 provider; +} SPOOL_PRINTER_DRIVER_INFO_LEVEL_6; + + +typedef struct spool_printer_driver_info_level +{ + uint32 level; + uint32 ptr; + SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 *info_3; + SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; +} +SPOOL_PRINTER_DRIVER_INFO_LEVEL; + + +typedef struct spool_q_setprinter +{ + POLICY_HND handle; + uint32 level; + SPOOL_PRINTER_INFO_LEVEL info; + SEC_DESC_BUF *secdesc_ctr; + DEVMODE_CTR devmode_ctr; + + uint32 command; + +} +SPOOL_Q_SETPRINTER; + +typedef struct spool_r_setprinter +{ + WERROR status; +} +SPOOL_R_SETPRINTER; + +/********************************************/ + +typedef struct { + POLICY_HND handle; +} SPOOL_Q_DELETEPRINTER; + +typedef struct { + POLICY_HND handle; + WERROR status; +} SPOOL_R_DELETEPRINTER; + +/********************************************/ + +typedef struct { + POLICY_HND handle; +} SPOOL_Q_ABORTPRINTER; + +typedef struct { + WERROR status; +} SPOOL_R_ABORTPRINTER; + + +/********************************************/ + +typedef struct { + UNISTR2 *server_name; + uint32 level; + SPOOL_PRINTER_INFO_LEVEL info; + DEVMODE_CTR devmode_ctr; + SEC_DESC_BUF *secdesc_ctr; + uint32 user_switch; + SPOOL_USER_CTR user_ctr; +} SPOOL_Q_ADDPRINTEREX; + +typedef struct { + POLICY_HND handle; + WERROR status; +} SPOOL_R_ADDPRINTEREX; + +/********************************************/ + +typedef struct spool_q_addprinterdriver +{ + uint32 server_name_ptr; + UNISTR2 server_name; + uint32 level; + SPOOL_PRINTER_DRIVER_INFO_LEVEL info; +} +SPOOL_Q_ADDPRINTERDRIVER; + +typedef struct spool_r_addprinterdriver +{ + WERROR status; +} +SPOOL_R_ADDPRINTERDRIVER; + +typedef struct spool_q_addprinterdriverex +{ + uint32 server_name_ptr; + UNISTR2 server_name; + uint32 level; + SPOOL_PRINTER_DRIVER_INFO_LEVEL info; + uint32 copy_flags; +} +SPOOL_Q_ADDPRINTERDRIVEREX; + +typedef struct spool_r_addprinterdriverex +{ + WERROR status; +} +SPOOL_R_ADDPRINTERDRIVEREX; + + +typedef struct driver_directory_1 +{ + UNISTR name; +} +DRIVER_DIRECTORY_1; + +typedef struct driver_info_ctr_info +{ + DRIVER_DIRECTORY_1 *info1; +} +DRIVER_DIRECTORY_CTR; + +typedef struct spool_q_getprinterdriverdirectory +{ + uint32 name_ptr; + UNISTR2 name; + uint32 environment_ptr; + UNISTR2 environment; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_GETPRINTERDRIVERDIR; + +typedef struct spool_r_getprinterdriverdirectory +{ + RPC_BUFFER *buffer; + uint32 needed; + WERROR status; +} +SPOOL_R_GETPRINTERDRIVERDIR; + +typedef struct spool_q_addprintprocessor +{ + uint32 server_ptr; + UNISTR2 server; + UNISTR2 environment; + UNISTR2 path; + UNISTR2 name; +} +SPOOL_Q_ADDPRINTPROCESSOR; + +typedef struct spool_r_addprintprocessor +{ + WERROR status; +} +SPOOL_R_ADDPRINTPROCESSOR; + + +typedef struct spool_q_enumprintprocessors +{ + uint32 name_ptr; + UNISTR2 name; + uint32 environment_ptr; + UNISTR2 environment; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ENUMPRINTPROCESSORS; + +typedef struct printprocessor_1 +{ + UNISTR name; +} +PRINTPROCESSOR_1; + +typedef struct spool_r_enumprintprocessors +{ + RPC_BUFFER *buffer; + uint32 needed; + uint32 returned; + WERROR status; +} +SPOOL_R_ENUMPRINTPROCESSORS; + +typedef struct spool_q_enumprintprocdatatypes +{ + uint32 name_ptr; + UNISTR2 name; + uint32 processor_ptr; + UNISTR2 processor; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ENUMPRINTPROCDATATYPES; + +typedef struct ppdatatype_1 +{ + UNISTR name; +} +PRINTPROCDATATYPE_1; + +typedef struct spool_r_enumprintprocdatatypes +{ + RPC_BUFFER *buffer; + uint32 needed; + uint32 returned; + WERROR status; +} +SPOOL_R_ENUMPRINTPROCDATATYPES; + +typedef struct printmonitor_1 +{ + UNISTR name; +} +PRINTMONITOR_1; + +typedef struct printmonitor_2 +{ + UNISTR name; + UNISTR environment; + UNISTR dll_name; +} +PRINTMONITOR_2; + +typedef struct spool_q_enumprintmonitors +{ + uint32 name_ptr; + UNISTR2 name; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_ENUMPRINTMONITORS; + +typedef struct spool_r_enumprintmonitors +{ + RPC_BUFFER *buffer; + uint32 needed; + uint32 returned; + WERROR status; +} +SPOOL_R_ENUMPRINTMONITORS; + + +typedef struct spool_q_enumprinterdata +{ + POLICY_HND handle; + uint32 index; + uint32 valuesize; + uint32 datasize; +} +SPOOL_Q_ENUMPRINTERDATA; + +typedef struct spool_r_enumprinterdata +{ + uint32 valuesize; + uint16 *value; + uint32 realvaluesize; + uint32 type; + uint32 datasize; + uint8 *data; + uint32 realdatasize; + WERROR status; +} +SPOOL_R_ENUMPRINTERDATA; + +typedef struct spool_q_setprinterdata +{ + POLICY_HND handle; + UNISTR2 value; + uint32 type; + uint32 max_len; + uint8 *data; + uint32 real_len; + uint32 numeric_data; +} +SPOOL_Q_SETPRINTERDATA; + +typedef struct spool_r_setprinterdata +{ + WERROR status; +} +SPOOL_R_SETPRINTERDATA; + +typedef struct spool_q_resetprinter +{ + POLICY_HND handle; + uint32 datatype_ptr; + UNISTR2 datatype; + DEVMODE_CTR devmode_ctr; + +} SPOOL_Q_RESETPRINTER; + +typedef struct spool_r_resetprinter +{ + WERROR status; +} +SPOOL_R_RESETPRINTER; + + + +typedef struct _form +{ + uint32 flags; + uint32 name_ptr; + uint32 size_x; + uint32 size_y; + uint32 left; + uint32 top; + uint32 right; + uint32 bottom; + UNISTR2 name; +} +FORM; + +typedef struct spool_q_addform +{ + POLICY_HND handle; + uint32 level; + uint32 level2; /* This should really be part of the FORM structure */ + FORM form; +} +SPOOL_Q_ADDFORM; + +typedef struct spool_r_addform +{ + WERROR status; +} +SPOOL_R_ADDFORM; + +typedef struct spool_q_setform +{ + POLICY_HND handle; + UNISTR2 name; + uint32 level; + uint32 level2; + FORM form; +} +SPOOL_Q_SETFORM; + +typedef struct spool_r_setform +{ + WERROR status; +} +SPOOL_R_SETFORM; + +typedef struct spool_q_deleteform +{ + POLICY_HND handle; + UNISTR2 name; +} +SPOOL_Q_DELETEFORM; + +typedef struct spool_r_deleteform +{ + WERROR status; +} +SPOOL_R_DELETEFORM; + +typedef struct spool_q_getjob +{ + POLICY_HND handle; + uint32 jobid; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_GETJOB; + +typedef struct pjob_info_info +{ + union + { + JOB_INFO_1 *job_info_1; + JOB_INFO_2 *job_info_2; + void *info; + } + job; + +} +PJOB_INFO; + +typedef struct spool_r_getjob +{ + RPC_BUFFER *buffer; + uint32 needed; + WERROR status; +} +SPOOL_R_GETJOB; + +typedef struct spool_q_replyopenprinter +{ + UNISTR2 string; + uint32 printer; + uint32 type; + uint32 unknown0; + uint32 unknown1; +} +SPOOL_Q_REPLYOPENPRINTER; + +typedef struct spool_r_replyopenprinter +{ + POLICY_HND handle; + WERROR status; +} +SPOOL_R_REPLYOPENPRINTER; + +typedef struct spool_q_routerreplyprinter +{ + POLICY_HND handle; + uint32 condition; + uint32 unknown1; /* 0x00000001 */ + uint32 change_id; + uint8 unknown2[5]; /* 0x0000000001 */ +} +SPOOL_Q_ROUTERREPLYPRINTER; + +typedef struct spool_r_routerreplyprinter +{ + WERROR status; +} +SPOOL_R_ROUTERREPLYPRINTER; + +typedef struct spool_q_replycloseprinter +{ + POLICY_HND handle; +} +SPOOL_Q_REPLYCLOSEPRINTER; + +typedef struct spool_r_replycloseprinter +{ + POLICY_HND handle; + WERROR status; +} +SPOOL_R_REPLYCLOSEPRINTER; + +typedef struct spool_q_rrpcn +{ + POLICY_HND handle; + uint32 change_low; + uint32 change_high; + uint32 unknown0; + uint32 unknown1; + uint32 info_ptr; + SPOOL_NOTIFY_INFO info; +} +SPOOL_Q_REPLY_RRPCN; + +typedef struct spool_r_rrpcn +{ + uint32 unknown0; + WERROR status; +} +SPOOL_R_REPLY_RRPCN; + +typedef struct spool_q_getprinterdataex +{ + POLICY_HND handle; + UNISTR2 keyname; + UNISTR2 valuename; + uint32 size; +} +SPOOL_Q_GETPRINTERDATAEX; + +typedef struct spool_r_getprinterdataex +{ + uint32 type; + uint32 size; + uint8 *data; + uint32 needed; + WERROR status; +} +SPOOL_R_GETPRINTERDATAEX; + +typedef struct spool_q_setprinterdataex +{ + POLICY_HND handle; + UNISTR2 key; + UNISTR2 value; + uint32 type; + uint32 max_len; + uint8 *data; + uint32 real_len; + uint32 numeric_data; +} +SPOOL_Q_SETPRINTERDATAEX; + +typedef struct spool_r_setprinterdataex +{ + WERROR status; +} +SPOOL_R_SETPRINTERDATAEX; + + +typedef struct spool_q_deleteprinterdataex +{ + POLICY_HND handle; + UNISTR2 keyname; + UNISTR2 valuename; +} +SPOOL_Q_DELETEPRINTERDATAEX; + +typedef struct spool_r_deleteprinterdataex +{ + WERROR status; +} +SPOOL_R_DELETEPRINTERDATAEX; + + +typedef struct spool_q_enumprinterkey +{ + POLICY_HND handle; + UNISTR2 key; + uint32 size; +} +SPOOL_Q_ENUMPRINTERKEY; + +typedef struct spool_r_enumprinterkey +{ + BUFFER5 keys; + uint32 needed; /* in bytes */ + WERROR status; +} +SPOOL_R_ENUMPRINTERKEY; + +typedef struct spool_q_deleteprinterkey +{ + POLICY_HND handle; + UNISTR2 keyname; +} +SPOOL_Q_DELETEPRINTERKEY; + +typedef struct spool_r_deleteprinterkey +{ + WERROR status; +} +SPOOL_R_DELETEPRINTERKEY; + +typedef struct printer_enum_values +{ + UNISTR valuename; + uint32 value_len; + uint32 type; + uint8 *data; + uint32 data_len; + +} +PRINTER_ENUM_VALUES; + +typedef struct printer_enum_values_ctr +{ + uint32 size; + uint32 size_of_array; + PRINTER_ENUM_VALUES *values; +} +PRINTER_ENUM_VALUES_CTR; + +typedef struct spool_q_enumprinterdataex +{ + POLICY_HND handle; + UNISTR2 key; + uint32 size; +} +SPOOL_Q_ENUMPRINTERDATAEX; + +typedef struct spool_r_enumprinterdataex +{ + PRINTER_ENUM_VALUES_CTR ctr; + uint32 needed; + uint32 returned; + WERROR status; +} +SPOOL_R_ENUMPRINTERDATAEX; + +typedef struct printprocessor_directory_1 +{ + UNISTR name; +} +PRINTPROCESSOR_DIRECTORY_1; + +typedef struct spool_q_getprintprocessordirectory +{ + UNISTR2 name; + UNISTR2 environment; + uint32 level; + RPC_BUFFER *buffer; + uint32 offered; +} +SPOOL_Q_GETPRINTPROCESSORDIRECTORY; + +typedef struct spool_r_getprintprocessordirectory +{ + RPC_BUFFER *buffer; + uint32 needed; + WERROR status; +} +SPOOL_R_GETPRINTPROCESSORDIRECTORY; + +/**************************************/ + +#define MAX_PORTNAME 64 +#define MAX_NETWORK_NAME 49 +#define MAX_SNMP_COMM_NAME 33 +#define MAX_QUEUE_NAME 33 +#define MAX_IPADDR_STRING 17 + +typedef struct { + uint16 portname[MAX_PORTNAME]; + uint32 version; + uint32 protocol; + uint32 size; + uint32 reserved; + uint16 hostaddress[MAX_NETWORK_NAME]; + uint16 snmpcommunity[MAX_SNMP_COMM_NAME]; + uint32 dblspool; + uint16 queue[MAX_QUEUE_NAME]; + uint16 ipaddress[MAX_IPADDR_STRING]; + uint32 port; + uint32 snmpenabled; + uint32 snmpdevindex; +} SPOOL_PORT_DATA_1; + +typedef struct { + POLICY_HND handle; + UNISTR2 dataname; + RPC_BUFFER indata; + uint32 indata_len; + uint32 offered; + uint32 unknown; +} SPOOL_Q_XCVDATAPORT; + +typedef struct { + RPC_BUFFER outdata; + uint32 needed; + uint32 unknown; + WERROR status; +} SPOOL_R_XCVDATAPORT; + +#define PRINTER_DRIVER_VERSION 2 +#define PRINTER_DRIVER_ARCHITECTURE "Windows NT x86" + +#endif /* _RPC_SPOOLSS_H */ + diff --git a/source3/include/rpc_svcctl.h b/source3/include/rpc_svcctl.h new file mode 100644 index 0000000000..aa1d1662c8 --- /dev/null +++ b/source3/include/rpc_svcctl.h @@ -0,0 +1,259 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1997, + Copyright (C) Gerald (Jerry) Carter 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */ +#define _RPC_SVCCTL_H + +/* svcctl pipe */ + +#define SVCCTL_CLOSE_SERVICE 0x00 +#define SVCCTL_CONTROL_SERVICE 0x01 +#define SVCCTL_LOCK_SERVICE_DB 0x03 +#define SVCCTL_QUERY_SERVICE_SEC 0x04 +#define SVCCTL_SET_SERVICE_SEC 0x05 +#define SVCCTL_QUERY_STATUS 0x06 +#define SVCCTL_UNLOCK_SERVICE_DB 0x08 +#define SVCCTL_ENUM_DEPENDENT_SERVICES_W 0x0d +#define SVCCTL_ENUM_SERVICES_STATUS_W 0x0e +#define SVCCTL_OPEN_SCMANAGER_W 0x0f +#define SVCCTL_OPEN_SERVICE_W 0x10 +#define SVCCTL_QUERY_SERVICE_CONFIG_W 0x11 +#define SVCCTL_START_SERVICE_W 0x13 +#define SVCCTL_GET_DISPLAY_NAME 0x14 +#define SVCCTL_QUERY_SERVICE_CONFIG2_W 0x27 +#define SVCCTL_QUERY_SERVICE_STATUSEX_W 0x28 + +/* ANSI versions not implemented currently +#define SVCCTL_ENUM_SERVICES_STATUS_A 0x0e +#define SVCCTL_OPEN_SCMANAGER_A 0x1b +*/ + +/* SERVER_STATUS - type */ + +#define SVCCTL_TYPE_WIN32 0x00000030 +#define SVCCTL_TYPE_DRIVER 0x0000000f + +/* SERVER_STATUS - state */ +#define SVCCTL_STATE_ACTIVE 0x00000001 +#define SVCCTL_STATE_INACTIVE 0x00000002 +#define SVCCTL_STATE_ALL ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE ) + +/* SERVER_STATUS - CurrentState */ + +#define SVCCTL_STATE_UNKNOWN 0x00000000 /* only used internally to smbd */ +#define SVCCTL_STOPPED 0x00000001 +#define SVCCTL_START_PENDING 0x00000002 +#define SVCCTL_STOP_PENDING 0x00000003 +#define SVCCTL_RUNNING 0x00000004 +#define SVCCTL_CONTINUE_PENDING 0x00000005 +#define SVCCTL_PAUSE_PENDING 0x00000006 +#define SVCCTL_PAUSED 0x00000007 + +/* SERVER_STATUS - ControlAccepted */ + +#define SVCCTL_ACCEPT_NONE 0x00000000 +#define SVCCTL_ACCEPT_STOP 0x00000001 +#define SVCCTL_ACCEPT_PAUSE_CONTINUE 0x00000002 +#define SVCCTL_ACCEPT_SHUTDOWN 0x00000004 +#define SVCCTL_ACCEPT_PARAMCHANGE 0x00000008 +#define SVCCTL_ACCEPT_NETBINDCHANGE 0x00000010 +#define SVCCTL_ACCEPT_HARDWAREPROFILECHANGE 0x00000020 +#define SVCCTL_ACCEPT_POWEREVENT 0x00000040 + +/* SERVER_STATUS - ControlAccepted */ +#define SVCCTL_SVC_ERROR_IGNORE 0x00000000 +#define SVCCTL_SVC_ERROR_NORMAL 0x00000001 +#define SVCCTL_SVC_ERROR_CRITICAL 0x00000002 +#define SVCCTL_SVC_ERROR_SEVERE 0x00000003 + +/* QueryServiceConfig2 options */ +#define SERVICE_CONFIG_DESCRIPTION 0x00000001 +#define SERVICE_CONFIG_FAILURE_ACTIONS 0x00000002 + + +/* Service Config - values for ServiceType field*/ + +#define SVCCTL_KERNEL_DRVR 0x00000001 /* doubtful we'll have these */ +#define SVCCTL_FILE_SYSTEM_DRVR 0x00000002 +#define SVCCTL_WIN32_OWN_PROC 0x00000010 +#define SVCCTL_WIN32_SHARED_PROC 0x00000020 +#define SVCCTL_WIN32_INTERACTIVE 0x00000100 + +/* Service Config - values for StartType field */ +#define SVCCTL_BOOT_START 0x00000000 +#define SVCCTL_SYSTEM_START 0x00000001 +#define SVCCTL_AUTO_START 0x00000002 +#define SVCCTL_DEMAND_START 0x00000003 +#define SVCCTL_DISABLED 0x00000004 + +/* Service Controls */ + +#define SVCCTL_CONTROL_STOP 0x00000001 +#define SVCCTL_CONTROL_PAUSE 0x00000002 +#define SVCCTL_CONTROL_CONTINUE 0x00000003 +#define SVCCTL_CONTROL_INTERROGATE 0x00000004 +#define SVCCTL_CONTROL_SHUTDOWN 0x00000005 + +#define SVC_HANDLE_IS_SCM 0x0000001 +#define SVC_HANDLE_IS_SERVICE 0x0000002 +#define SVC_HANDLE_IS_DBLOCK 0x0000003 + +#define SVC_STATUS_PROCESS_INFO 0x00000000 + +/* where we assume the location of the service control scripts */ +#define SVCCTL_SCRIPT_DIR "svcctl" + +/* utility structures for RPCs */ + +/* + * "struct SERVICE_STATUS" comes from librpc/gen_ndr/svcctl.h + */ + +typedef struct SERVICE_STATUS SERVICE_STATUS; + +typedef struct { + SERVICE_STATUS status; + uint32 process_id; + uint32 service_flags; +} SERVICE_STATUS_PROCESS; + + +typedef struct { + UNISTR servicename; + UNISTR displayname; + SERVICE_STATUS status; +} ENUM_SERVICES_STATUS; + +typedef struct { + uint32 service_type; + uint32 start_type; + uint32 error_control; + UNISTR2 *executablepath; + UNISTR2 *loadordergroup; + uint32 tag_id; + UNISTR2 *dependencies; + UNISTR2 *startname; + UNISTR2 *displayname; +} SERVICE_CONFIG; + +typedef struct { + uint32 unknown; + UNISTR description; +} SERVICE_DESCRIPTION; + +typedef struct { + uint32 type; + uint32 delay; +} SC_ACTION; + +typedef struct { + uint32 reset_period; + UNISTR2 *rebootmsg; /* i have no idea if these are UNISTR2's. I can't get a good trace */ + UNISTR2 *command; + uint32 num_actions; + SC_ACTION *actions; +} SERVICE_FAILURE_ACTIONS; + +/* + * dispatch table of functions to handle the =ServiceControl API + */ + +typedef struct { + /* functions for enumerating subkeys and values */ + WERROR (*stop_service)( const char *service, SERVICE_STATUS *status ); + WERROR (*start_service) ( const char *service ); + WERROR (*service_status)( const char *service, SERVICE_STATUS *status ); +} SERVICE_CONTROL_OPS; + +/* structure to store the service handle information */ + +typedef struct _ServiceInfo { + uint8 type; + char *name; + uint32 access_granted; + SERVICE_CONTROL_OPS *ops; +} SERVICE_INFO; + + +/* rpc structures */ + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 type; + uint32 state; + uint32 buffer_size; + uint32 *resume; +} SVCCTL_Q_ENUM_SERVICES_STATUS; + +typedef struct { + RPC_BUFFER buffer; + uint32 needed; + uint32 returned; + uint32 *resume; + WERROR status; +} SVCCTL_R_ENUM_SERVICES_STATUS; + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 buffer_size; +} SVCCTL_Q_QUERY_SERVICE_CONFIG; + +typedef struct { + SERVICE_CONFIG config; + uint32 needed; + WERROR status; +} SVCCTL_R_QUERY_SERVICE_CONFIG; + + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 level; + uint32 buffer_size; +} SVCCTL_Q_QUERY_SERVICE_CONFIG2; + +typedef struct { + RPC_BUFFER buffer; + uint32 needed; + WERROR status; +} SVCCTL_R_QUERY_SERVICE_CONFIG2; + + +/**************************/ + +typedef struct { + POLICY_HND handle; + uint32 level; + uint32 buffer_size; +} SVCCTL_Q_QUERY_SERVICE_STATUSEX; + +typedef struct { + RPC_BUFFER buffer; + uint32 needed; + WERROR status; +} SVCCTL_R_QUERY_SERVICE_STATUSEX; + +#endif /* _RPC_SVCCTL_H */ + diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h new file mode 100644 index 0000000000..c030acf8fd --- /dev/null +++ b/source3/include/safe_string.h @@ -0,0 +1,226 @@ +/* + Unix SMB/CIFS implementation. + Safe string handling routines. + Copyright (C) Andrew Tridgell 1994-1998 + Copyright (C) Andrew Bartlett <abartlet@samba.org> 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _SAFE_STRING_H +#define _SAFE_STRING_H + +#ifndef _SPLINT_ /* http://www.splint.org */ + +/* Some macros to ensure people don't use buffer overflow vulnerable string + functions. */ + +#ifdef bcopy +#undef bcopy +#endif /* bcopy */ +#define bcopy(src,dest,size) __ERROR__XX__NEVER_USE_BCOPY___; + +#ifdef strcpy +#undef strcpy +#endif /* strcpy */ +#define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___; + +#ifdef strcat +#undef strcat +#endif /* strcat */ +#define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___; + +#ifdef sprintf +#undef sprintf +#endif /* sprintf */ +#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__; + +/* + * strcasecmp/strncasecmp aren't an error, but it means you're not thinking about + * multibyte. Don't use them. JRA. + */ +#ifdef strcasecmp +#undef strcasecmp +#endif +#define strcasecmp __ERROR__XX__NEVER_USE_STRCASECMP__; + +#ifdef strncasecmp +#undef strncasecmp +#endif +#define strncasecmp __ERROR__XX__NEVER_USE_STRNCASECMP__; + +#endif /* !_SPLINT_ */ + +#ifdef DEVELOPER +#define SAFE_STRING_FUNCTION_NAME FUNCTION_MACRO +#define SAFE_STRING_LINE __LINE__ +#else +#define SAFE_STRING_FUNCTION_NAME ("") +#define SAFE_STRING_LINE (0) +#endif + +/* We need a number of different prototypes for our + non-existant fuctions */ +char * __unsafe_string_function_usage_here__(void); + +size_t __unsafe_string_function_usage_here_size_t__(void); + +size_t __unsafe_string_function_usage_here_char__(void); + +#ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS + +/* if the compiler will optimize out function calls, then use this to tell if we are + have the correct types (this works only where sizeof() returns the size of the buffer, not + the size of the pointer). */ + +#define CHECK_STRING_SIZE(d, len) (sizeof(d) != (len) && sizeof(d) != sizeof(char *)) + +#else /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */ + +#endif /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */ + +#define safe_strcpy_base(dest, src, base, size) \ + safe_strcpy(dest, src, size-PTR_DIFF(dest,base)-1) + +/* String copy functions - macro hell below adds 'type checking' (limited, + but the best we can do in C) and may tag with function name/number to + record the last 'clobber region' on that string */ + +#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1) +#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1) +#define nstrcpy(d,s) safe_strcpy((d), (s),sizeof(nstring)-1) +#define unstrcpy(d,s) safe_strcpy((d), (s),sizeof(unstring)-1) + +/* the addition of the DEVELOPER checks in safe_strcpy means we must + * update a lot of code. To make this a little easier here are some + * functions that provide the lengths with less pain */ + +/* Inside the _fn variants of these is a call to clobber_region(), - + * which might destroy the stack on a buggy function. We help the + * debugging process by putting the function and line who last caused + * a clobbering into a static buffer. If the program crashes at + * address 0xf1f1f1f1 then this function is probably, but not + * necessarily, to blame. */ + +/* overmalloc_safe_strcpy: DEPRECATED! Used when you know the + * destination buffer is longer than maxlength, but you don't know how + * long. This is not a good situation, because we can't do the normal + * sanity checks. Don't use in new code! */ + +#define overmalloc_safe_strcpy(dest,src,maxlength) \ + safe_strcpy_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + dest,src,maxlength) + +#define safe_strcpy(dest,src,maxlength) \ + safe_strcpy_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + dest,src,maxlength) + +#define safe_strcat(dest,src,maxlength) \ + safe_strcat_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + dest,src,maxlength) + +#define push_string(base_ptr, dest, src, dest_len, flags) \ + push_string_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + base_ptr, 0, dest, src, dest_len, flags) + +#define pull_string(base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) \ + pull_string_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) + +#define pull_string_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \ + pull_string_talloc_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + ctx, base_ptr, smb_flags2, dest, src, src_len, flags) + +#define clistr_push(cli, dest, src, dest_len, flags) \ + clistr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + cli, dest, src, dest_len, flags) + +#define clistr_pull(cli, dest, src, dest_len, src_len, flags) \ + clistr_pull_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + cli, dest, src, dest_len, src_len, flags) + +#define clistr_pull_talloc(ctx, cli, pp_dest, src, src_len, flags) \ + clistr_pull_talloc_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + ctx, cli, pp_dest, src, src_len, flags) + +#define srvstr_push(base_ptr, smb_flags2, dest, src, dest_len, flags) \ + srvstr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + base_ptr, smb_flags2, dest, src, dest_len, flags) + +#define alpha_strcpy(dest,src,other_safe_chars,maxlength) \ + alpha_strcpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE, \ + dest,src,other_safe_chars,maxlength) + +#define StrnCpy(dest,src,n) \ + StrnCpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE, \ + dest,src,n) + +#ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS + +/* if the compiler will optimize out function calls, then use this to tell if we are + have the correct types (this works only where sizeof() returns the size of the buffer, not + the size of the pointer). */ + +#define safe_strcpy_fn2(fn_name, fn_line, d, s, max_len) \ + (CHECK_STRING_SIZE(d, max_len+1) \ + ? __unsafe_string_function_usage_here__() \ + : safe_strcpy_fn(fn_name, fn_line, (d), (s), (max_len))) + +#define safe_strcat_fn2(fn_name, fn_line, d, s, max_len) \ + (CHECK_STRING_SIZE(d, max_len+1) \ + ? __unsafe_string_function_usage_here__() \ + : safe_strcat_fn(fn_name, fn_line, (d), (s), (max_len))) + +#define push_string_fn2(fn_name, fn_line, base_ptr, flags2, dest, src, dest_len, flags) \ + (CHECK_STRING_SIZE(dest, dest_len) \ + ? __unsafe_string_function_usage_here_size_t__() \ + : push_string_fn(fn_name, fn_line, base_ptr, flags2, dest, src, dest_len, flags)) + +#define pull_string_fn2(fn_name, fn_line, base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) \ + (CHECK_STRING_SIZE(dest, dest_len) \ + ? __unsafe_string_function_usage_here_size_t__() \ + : pull_string_fn(fn_name, fn_line, base_ptr, smb_flags2, dest, src, dest_len, src_len, flags)) + +#define pull_string_talloc_fn2(fn_name, fn_line, ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \ + pull_string_talloc_fn(fn_name, fn_line, ctx, base_ptr, smb_flags2, dest, src, src_len, flags) + +#define clistr_push_fn2(fn_name, fn_line, cli, dest, src, dest_len, flags) \ + (CHECK_STRING_SIZE(dest, dest_len) \ + ? __unsafe_string_function_usage_here_size_t__() \ + : clistr_push_fn(fn_name, fn_line, cli, dest, src, dest_len, flags)) + +#define clistr_pull_fn2(fn_name, fn_line, cli, dest, src, dest_len, srclen, flags) \ + (CHECK_STRING_SIZE(dest, dest_len) \ + ? __unsafe_string_function_usage_here_size_t__() \ + : clistr_pull_fn(fn_name, fn_line, cli, dest, src, dest_len, srclen, flags)) + +#define srvstr_push_fn2(fn_name, fn_line, base_ptr, smb_flags2, dest, src, dest_len, flags) \ + (CHECK_STRING_SIZE(dest, dest_len) \ + ? __unsafe_string_function_usage_here_size_t__() \ + : srvstr_push_fn(fn_name, fn_line, base_ptr, smb_flags2, dest, src, dest_len, flags)) + +#else + +#define safe_strcpy_fn2 safe_strcpy_fn +#define safe_strcat_fn2 safe_strcat_fn +#define push_string_fn2 push_string_fn +#define pull_string_fn2 pull_string_fn +#define pull_string_talloc_fn2 pull_string_talloc_fn +#define clistr_push_fn2 clistr_push_fn +#define clistr_pull_fn2 clistr_pull_fn +#define srvstr_push_fn2 srvstr_push_fn + +#endif + +#endif diff --git a/source3/include/samba_linux_quota.h b/source3/include/samba_linux_quota.h new file mode 100644 index 0000000000..8dbbec237f --- /dev/null +++ b/source3/include/samba_linux_quota.h @@ -0,0 +1,335 @@ +#ifndef _SAMBA_LINUX_QUOTA_H_ +#define _SAMBA_LINUX_QUOTA_H_ +/* + Unix SMB/CIFS implementation. + Copyright (C) Andrew Tridgell 1994-2002 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* + This file is needed because Quota support on Linux has + been broken since Linus kernel 2.4.x. It will only get + better (and this file be removed) when all the distributions + ship a glibc with a working quota.h file. This is very + bad. JRA. + + Original file came from Christoph Hellwig <hch@infradead.org>. + Massaged into one nasty include file (to stop us having to + add multiple files into Samba just for Linux braindamage) + by JRA. +*/ + +#undef QUOTABLOCK_SIZE + +#ifndef _QUOTAIO_LINUX_V1 +#define _QUOTAIO_LINUX_V1 + +/* + * Headerfile for old quotafile format + */ + +#include <sys/types.h> + +#define V1_DQBLK_SIZE_BITS 10 +#define V1_DQBLK_SIZE (1 << V1_DQBLK_SIZE_BITS) /* Size of one quota block in bytes in old format */ + +#define V1_DQOFF(__id) ((loff_t) ((__id) * sizeof(struct v1_disk_dqblk))) + +/* Structure of quota on disk */ +struct v1_disk_dqblk { + u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ + u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ + u_int32_t dqb_curblocks; /* current block count */ + u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ + u_int32_t dqb_isoftlimit; /* preferred limit on inodes */ + u_int32_t dqb_curinodes; /* current # allocated inodes */ + time_t dqb_btime; /* time limit for excessive disk use */ + time_t dqb_itime; /* time limit for excessive files */ +} __attribute__ ((packed)); + +/* Structure used for communication with kernel */ +struct v1_kern_dqblk { + u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ + u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ + u_int32_t dqb_curblocks; /* current block count */ + u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ + u_int32_t dqb_isoftlimit; /* preferred inode limit */ + u_int32_t dqb_curinodes; /* current # allocated inodes */ + time_t dqb_btime; /* time limit for excessive disk use */ + time_t dqb_itime; /* time limit for excessive files */ +}; + +struct v1_dqstats { + u_int32_t lookups; + u_int32_t drops; + u_int32_t reads; + u_int32_t writes; + u_int32_t cache_hits; + u_int32_t allocated_dquots; + u_int32_t free_dquots; + u_int32_t syncs; +}; + +#ifndef Q_V1_GETQUOTA +#define Q_V1_GETQUOTA 0x300 +#endif +#ifndef Q_V1_SETQUOTA +#define Q_V1_SETQUOTA 0x400 +#endif + +#endif /* _QUOTAIO_LINUX_V1 */ + +/* + * + * Header file for disk format of new quotafile format + * + */ + +#ifndef _QUOTAIO_LINUX_V2 +#define _QUOTAIO_LINUX_V2 + +#include <sys/types.h> + +#ifndef _QUOTA_LINUX +#define _QUOTA_LINUX + +#include <sys/types.h> + +typedef u_int32_t qid_t; /* Type in which we store ids in memory */ +typedef u_int64_t qsize_t; /* Type in which we store size limitations */ + +#define MAXQUOTAS 2 +#define USRQUOTA 0 /* element used for user quotas */ +#define GRPQUOTA 1 /* element used for group quotas */ + +/* + * Definitions for the default names of the quotas files. + */ +#define INITQFNAMES { \ + "user", /* USRQUOTA */ \ + "group", /* GRPQUOTA */ \ + "undefined", \ +} + +/* + * Definitions of magics and versions of current quota files + */ +#define INITQMAGICS {\ + 0xd9c01f11, /* USRQUOTA */\ + 0xd9c01927 /* GRPQUOTA */\ +} + +/* Size of blocks in which are counted size limits in generic utility parts */ +#define QUOTABLOCK_BITS 10 +#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) + +/* Conversion routines from and to quota blocks */ +#define qb2kb(x) ((x) << (QUOTABLOCK_BITS-10)) +#define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10)) +#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS) + +/* + * Command definitions for the 'quotactl' system call. + * The commands are broken into a main command defined below + * and a subcommand that is used to convey the type of + * quota that is being manipulated (see above). + */ +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) + +#define Q_6_5_QUOTAON 0x0100 /* enable quotas */ +#define Q_6_5_QUOTAOFF 0x0200 /* disable quotas */ +#define Q_6_5_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ + +#define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ +#define Q_QUOTAON 0x800002 /* turn quotas on */ +#define Q_QUOTAOFF 0x800003 /* turn quotas off */ +#define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ +#define Q_GETINFO 0x800005 /* get information about quota files */ +#define Q_SETINFO 0x800006 /* set information about quota files */ +#define Q_GETQUOTA 0x800007 /* get user quota structure */ +#define Q_SETQUOTA 0x800008 /* set user quota structure */ + +/* + * Quota structure used for communication with userspace via quotactl + * Following flags are used to specify which fields are valid + */ +#define QIF_BLIMITS 1 +#define QIF_SPACE 2 +#define QIF_ILIMITS 4 +#define QIF_INODES 8 +#define QIF_BTIME 16 +#define QIF_ITIME 32 +#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) +#define QIF_USAGE (QIF_SPACE | QIF_INODES) +#define QIF_TIMES (QIF_BTIME | QIF_ITIME) +#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) + +struct if_dqblk { + u_int64_t dqb_bhardlimit; + u_int64_t dqb_bsoftlimit; + u_int64_t dqb_curspace; + u_int64_t dqb_ihardlimit; + u_int64_t dqb_isoftlimit; + u_int64_t dqb_curinodes; + u_int64_t dqb_btime; + u_int64_t dqb_itime; + u_int32_t dqb_valid; +}; + +/* + * Structure used for setting quota information about file via quotactl + * Following flags are used to specify which fields are valid + */ +#define IIF_BGRACE 1 +#define IIF_IGRACE 2 +#define IIF_FLAGS 4 +#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) + +struct if_dqinfo { + u_int64_t dqi_bgrace; + u_int64_t dqi_igrace; + u_int32_t dqi_flags; + u_int32_t dqi_valid; +}; + +/* Quota format identifiers */ +#define QFMT_VFS_OLD 1 +#define QFMT_VFS_V0 2 + +/* Flags supported by kernel */ +#define V1_DQF_RSQUASH 1 + +/* Ioctl for getting quota size */ +#include <sys/ioctl.h> +#ifndef FIOQSIZE + #if defined(__alpha__) || defined(__powerpc__) || defined(__sh__) || defined(__sparc__) || defined(__sparc64__) + #define FIOQSIZE _IOR('f', 128, loff_t) + #elif defined(__arm__) || defined(__mc68000__) || defined(__s390__) + #define FIOQSIZE 0x545E + #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__ia64__) || defined(__parisc__) || defined(__cris__) || defined(__hppa__) + #define FIOQSIZE 0x5460 + #elif defined(__mips__) || defined(__mips64__) + #define FIOQSIZE 0x6667 + #endif +#endif + +long quotactl __P((int, const char *, qid_t, caddr_t)); + +#endif /* _QUOTA_LINUX */ + +#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */ +#define V2_DQBLKSIZE_BITS 10 +#define V2_DQBLKSIZE (1 << V2_DQBLKSIZE_BITS) /* Size of block with quota structures */ +#define V2_DQTREEOFF 1 /* Offset of tree in file in blOcks */ +#define V2_DQTREEDEPTH 4 /* Depth of quota tree */ +#define V2_DQSTRINBLK ((V2_DQBLKSIZE - sizeof(struct v2_disk_dqdbheader)) / sizeof(struct v2_disk_dqblk)) /* Number of entries in one blocks */ +#define V2_GETIDINDEX(id, depth) (((id) >> ((V2_DQTREEDEPTH-(depth)-1)*8)) & 0xff) +#define V2_GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)(buf)) + sizeof(struct v2_disk_dqdbheader))) +#define INIT_V2_VERSIONS { 0, 0} + +struct v2_disk_dqheader { + u_int32_t dqh_magic; /* Magic number identifying file */ + u_int32_t dqh_version; /* File version */ +} __attribute__ ((packed)); + +/* Flags for version specific files */ +#define V2_DQF_MASK 0x0000 /* Mask for all valid ondisk flags */ + +/* Header with type and version specific information */ +struct v2_disk_dqinfo { + u_int32_t dqi_bgrace; /* Time before block soft limit becomes hard limit */ + u_int32_t dqi_igrace; /* Time before inode soft limit becomes hard limit */ + u_int32_t dqi_flags; /* Flags for quotafile (DQF_*) */ + u_int32_t dqi_blocks; /* Number of blocks in file */ + u_int32_t dqi_free_blk; /* Number of first free block in the list */ + u_int32_t dqi_free_entry; /* Number of block with at least one free entry */ +} __attribute__ ((packed)); + +/* + * Structure of header of block with quota structures. It is padded to 16 bytes so + * there will be space for exactly 18 quota-entries in a block + */ +struct v2_disk_dqdbheader { + u_int32_t dqdh_next_free; /* Number of next block with free entry */ + u_int32_t dqdh_prev_free; /* Number of previous block with free entry */ + u_int16_t dqdh_entries; /* Number of valid entries in block */ + u_int16_t dqdh_pad1; + u_int32_t dqdh_pad2; +} __attribute__ ((packed)); + +/* Structure of quota for one user on disk */ +struct v2_disk_dqblk { + u_int32_t dqb_id; /* id this quota applies to */ + u_int32_t dqb_ihardlimit; /* absolute limit on allocated inodes */ + u_int32_t dqb_isoftlimit; /* preferred inode limit */ + u_int32_t dqb_curinodes; /* current # allocated inodes */ + u_int32_t dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */ + u_int32_t dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */ + u_int64_t dqb_curspace; /* current space occupied (in bytes) */ + u_int64_t dqb_btime; /* time limit for excessive disk use */ + u_int64_t dqb_itime; /* time limit for excessive inode use */ +} __attribute__ ((packed)); + +/* Structure of quota for communication with kernel */ +struct v2_kern_dqblk { + unsigned int dqb_ihardlimit; + unsigned int dqb_isoftlimit; + unsigned int dqb_curinodes; + unsigned int dqb_bhardlimit; + unsigned int dqb_bsoftlimit; + qsize_t dqb_curspace; + time_t dqb_btime; + time_t dqb_itime; +}; + +/* Structure of quotafile info for communication with kernel */ +struct v2_kern_dqinfo { + unsigned int dqi_bgrace; + unsigned int dqi_igrace; + unsigned int dqi_flags; + unsigned int dqi_blocks; + unsigned int dqi_free_blk; + unsigned int dqi_free_entry; +}; + +/* Structure with gathered statistics from kernel */ +struct v2_dqstats { + u_int32_t lookups; + u_int32_t drops; + u_int32_t reads; + u_int32_t writes; + u_int32_t cache_hits; + u_int32_t allocated_dquots; + u_int32_t free_dquots; + u_int32_t syncs; + u_int32_t version; +}; + +#ifndef Q_V2_GETQUOTA +#define Q_V2_GETQUOTA 0x0D00 +#endif +#ifndef Q_V2_SETQUOTA +#define Q_V2_SETQUOTA 0x0E00 +#endif + +#endif /* _QUOTAIO_LINUX_V2 */ + +#ifndef QUOTABLOCK_SIZE +#define QUOTABLOCK_SIZE 1024 +#endif + +#endif /* _SAMBA_LINUX_QUOTA_H_ */ diff --git a/source3/include/secrets.h b/source3/include/secrets.h new file mode 100644 index 0000000000..d9f457558b --- /dev/null +++ b/source3/include/secrets.h @@ -0,0 +1,102 @@ +/* + * Unix SMB/CIFS implementation. + * secrets.tdb file format info + * Copyright (C) Andrew Tridgell 2000 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _SECRETS_H +#define _SECRETS_H + +/* the first one is for the hashed password (NT4 style) the latter + for plaintext (ADS) +*/ +#define SECRETS_MACHINE_ACCT_PASS "SECRETS/$MACHINE.ACC" +#define SECRETS_MACHINE_PASSWORD "SECRETS/MACHINE_PASSWORD" +#define SECRETS_MACHINE_LAST_CHANGE_TIME "SECRETS/MACHINE_LAST_CHANGE_TIME" +#define SECRETS_MACHINE_SEC_CHANNEL_TYPE "SECRETS/MACHINE_SEC_CHANNEL_TYPE" +#define SECRETS_MACHINE_TRUST_ACCOUNT_NAME "SECRETS/SECRETS_MACHINE_TRUST_ACCOUNT_NAME" +/* this one is for storing trusted domain account password */ +#define SECRETS_DOMTRUST_ACCT_PASS "SECRETS/$DOMTRUST.ACC" + +/* Store the principal name used for Kerberos DES key salt under this key name. */ +#define SECRETS_SALTING_PRINCIPAL "SECRETS/SALTING_PRINCIPAL" + +/* The domain sid and our sid are stored here even though they aren't + really secret. */ +#define SECRETS_DOMAIN_SID "SECRETS/SID" +#define SECRETS_SAM_SID "SAM/SID" + +/* The domain GUID and server GUID (NOT the same) are also not secret */ +#define SECRETS_DOMAIN_GUID "SECRETS/DOMGUID" +#define SECRETS_SERVER_GUID "SECRETS/GUID" + +#define SECRETS_LDAP_BIND_PW "SECRETS/LDAP_BIND_PW" + +/* Authenticated user info is stored in secrets.tdb under these keys */ + +#define SECRETS_AUTH_USER "SECRETS/AUTH_USER" +#define SECRETS_AUTH_DOMAIN "SECRETS/AUTH_DOMAIN" +#define SECRETS_AUTH_PASSWORD "SECRETS/AUTH_PASSWORD" + +/* structure for storing machine account password + (ie. when samba server is member of a domain */ +struct machine_acct_pass { + uint8 hash[16]; + time_t mod_time; +}; + +/* + * storage structure for trusted domain + */ +typedef struct trusted_dom_pass { + size_t uni_name_len; + smb_ucs2_t uni_name[32]; /* unicode domain name */ + size_t pass_len; + fstring pass; /* trust relationship's password */ + time_t mod_time; + DOM_SID domain_sid; /* remote domain's sid */ +} TRUSTED_DOM_PASS; + +/* + * trusted domain entry/entries returned by secrets_get_trusted_domains + * (used in _lsa_enum_trust_dom call) + */ +struct trustdom_info { + char *name; + DOM_SID sid; +}; + +/* + * Format of an OpenAFS keyfile + */ + +#define SECRETS_AFS_MAXKEYS 8 + +struct afs_key { + uint32 kvno; + char key[8]; +}; + +struct afs_keyfile { + uint32 nkeys; + struct afs_key entry[SECRETS_AFS_MAXKEYS]; +}; + +#define SECRETS_AFS_KEYFILE "SECRETS/AFS_KEYFILE" + +#define SECRETS_SCHANNEL_STATE "SECRETS/SCHANNEL" + +#endif /* _SECRETS_H */ diff --git a/source3/include/session.h b/source3/include/session.h new file mode 100644 index 0000000000..2aca1df94d --- /dev/null +++ b/source3/include/session.h @@ -0,0 +1,42 @@ +/* + Unix SMB/CIFS implementation. + session handling for recording currently vailid vuids + + Copyright (C) tridge@samba.org 2001 + Copyright (C) Andew Bartlett <abartlet@samba.org> 2001 + Copyright (C) Gerald (Jerry) Carter 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* a "session" is claimed when we do a SessionSetupX operation + and is yielded when the corresponding vuid is destroyed. + + sessions are used to populate utmp and PAM session structures +*/ + +struct sessionid { + uid_t uid; + gid_t gid; + fstring username; + fstring hostname; + fstring netbios_name; + fstring remote_machine; + fstring id_str; + uint32 id_num; + struct server_id pid; + fstring ip_addr_str; + time_t connect_start; +}; + diff --git a/source3/include/smb.h b/source3/include/smb.h new file mode 100644 index 0000000000..c8c4f8c3cc --- /dev/null +++ b/source3/include/smb.h @@ -0,0 +1,1904 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup, plus a whole lot more. + + Copyright (C) Andrew Tridgell 1992-2000 + Copyright (C) John H Terpstra 1996-2002 + Copyright (C) Luke Kenneth Casson Leighton 1996-2000 + Copyright (C) Paul Ashton 1998-2000 + Copyright (C) Simo Sorce 2001-2002 + Copyright (C) Martin Pool 2002 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _SMB_H +#define _SMB_H + +/* logged when starting the various Samba daemons */ +#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2008" + + +#if defined(LARGE_SMB_OFF_T) +#define BUFFER_SIZE (128*1024) +#else /* no large readwrite possible */ +#define BUFFER_SIZE (0xFFFF) +#endif + +#define SAFETY_MARGIN 1024 +#define LARGE_WRITEX_HDR_SIZE 65 + +#define NMB_PORT 137 +#define DGRAM_PORT 138 +#define SMB_PORT1 445 +#define SMB_PORT2 139 +#define SMB_PORTS "445 139" + +#define Undefined (-1) +#define False false +#define True true +#define Auto (2) +#define Required (3) + +#define SIZEOFWORD 2 + +#ifndef DEF_CREATE_MASK +#define DEF_CREATE_MASK (0755) +#endif + +/* string manipulation flags - see clistr.c and srvstr.c */ +#define STR_TERMINATE 1 +#define STR_UPPER 2 +#define STR_ASCII 4 +#define STR_UNICODE 8 +#define STR_NOALIGN 16 +#define STR_TERMINATE_ASCII 128 + +/* how long to wait for secondary SMB packets (milli-seconds) */ +#define SMB_SECONDARY_WAIT (60*1000) + +/* Debugging stuff */ +#include "debug.h" + +/* this defines the error codes that receive_smb can put in smb_read_error */ +enum smb_read_errors { + SMB_READ_OK = 0, + SMB_READ_TIMEOUT, + SMB_READ_EOF, + SMB_READ_ERROR, + SMB_WRITE_ERROR, /* This error code can go into the client smb_rw_error. */ + SMB_READ_BAD_SIG, + SMB_NO_MEMORY, + SMB_DO_NOT_DO_TDIS, /* cli_close_connection() check for this when smbfs wants to keep tree connected */ + SMB_READ_BAD_DECRYPT +}; + +#define DIR_STRUCT_SIZE 43 + +/* these define the attribute byte as seen by DOS */ +#define aRONLY (1L<<0) /* 0x01 */ +#define aHIDDEN (1L<<1) /* 0x02 */ +#define aSYSTEM (1L<<2) /* 0x04 */ +#define aVOLID (1L<<3) /* 0x08 */ +#define aDIR (1L<<4) /* 0x10 */ +#define aARCH (1L<<5) /* 0x20 */ + +/* deny modes */ +#define DENY_DOS 0 +#define DENY_ALL 1 +#define DENY_WRITE 2 +#define DENY_READ 3 +#define DENY_NONE 4 +#define DENY_FCB 7 + +/* open modes */ +#define DOS_OPEN_RDONLY 0 +#define DOS_OPEN_WRONLY 1 +#define DOS_OPEN_RDWR 2 +#define DOS_OPEN_EXEC 3 +#define DOS_OPEN_FCB 0xF + +/* define shifts and masks for share and open modes. */ +#define OPENX_MODE_MASK 0xF +#define DENY_MODE_SHIFT 4 +#define DENY_MODE_MASK 0x7 +#define GET_OPENX_MODE(x) ((x) & OPENX_MODE_MASK) +#define SET_OPENX_MODE(x) ((x) & OPENX_MODE_MASK) +#define GET_DENY_MODE(x) (((x)>>DENY_MODE_SHIFT) & DENY_MODE_MASK) +#define SET_DENY_MODE(x) (((x) & DENY_MODE_MASK) <<DENY_MODE_SHIFT) + +/* Sync on open file (not sure if used anymore... ?) */ +#define FILE_SYNC_OPENMODE (1<<14) +#define GET_FILE_SYNC_OPENMODE(x) (((x) & FILE_SYNC_OPENMODE) ? True : False) + +/* open disposition values */ +#define OPENX_FILE_EXISTS_FAIL 0 +#define OPENX_FILE_EXISTS_OPEN 1 +#define OPENX_FILE_EXISTS_TRUNCATE 2 + +/* mask for open disposition. */ +#define OPENX_FILE_OPEN_MASK 0x3 + +#define GET_FILE_OPENX_DISPOSITION(x) ((x) & FILE_OPEN_MASK) +#define SET_FILE_OPENX_DISPOSITION(x) ((x) & FILE_OPEN_MASK) + +/* The above can be OR'ed with... */ +#define OPENX_FILE_CREATE_IF_NOT_EXIST 0x10 +#define OPENX_FILE_FAIL_IF_NOT_EXIST 0 + +#include "doserr.h" + +typedef union unid_t { + uid_t uid; + gid_t gid; +} unid_t; + +/* + * SMB UCS2 (16-bit unicode) internal type. + * smb_ucs2_t is *always* in little endian format. + */ + +typedef uint16 smb_ucs2_t; + +#ifdef WORDS_BIGENDIAN +#define UCS2_SHIFT 8 +#else +#define UCS2_SHIFT 0 +#endif + +/* turn a 7 bit character into a ucs2 character */ +#define UCS2_CHAR(c) ((c) << UCS2_SHIFT) + +/* return an ascii version of a ucs2 character */ +#define UCS2_TO_CHAR(c) (((c) >> UCS2_SHIFT) & 0xff) + +/* Copy into a smb_ucs2_t from a possibly unaligned buffer. Return the copied smb_ucs2_t */ +#define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\ + ((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest)) + +/* Large data type for manipulating uint32 unicode codepoints */ +typedef uint32 codepoint_t; +#define INVALID_CODEPOINT ((codepoint_t)-1) + +/* pipe string names */ +#define PIPE_LANMAN "\\PIPE\\LANMAN" + +/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ +typedef uint64_t NTTIME; + +#define MAX_HOURS_LEN 32 + +#ifndef MAXSUBAUTHS +#define MAXSUBAUTHS 15 /* max sub authorities in a SID */ +#endif + +#define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4))) + +#define LOOKUP_NAME_NONE 0x00000000 +#define LOOKUP_NAME_ISOLATED 0x00000001 /* Look up unqualified names */ +#define LOOKUP_NAME_REMOTE 0x00000002 /* Ask others */ +#define LOOKUP_NAME_GROUP 0x00000004 /* (unused) This is a NASTY hack for + valid users = @foo where foo also + exists in as user. */ +#define LOOKUP_NAME_EXPLICIT 0x00000008 /* Only include + explicitly mapped names and not + the Unix {User,Group} domain */ +#define LOOKUP_NAME_BUILTIN 0x00000010 /* builtin names */ +#define LOOKUP_NAME_WKN 0x00000020 /* well known names */ +#define LOOKUP_NAME_DOMAIN 0x00000040 /* only lookup own domain */ +#define LOOKUP_NAME_LOCAL (LOOKUP_NAME_ISOLATED\ + |LOOKUP_NAME_BUILTIN\ + |LOOKUP_NAME_WKN\ + |LOOKUP_NAME_DOMAIN) +#define LOOKUP_NAME_ALL (LOOKUP_NAME_ISOLATED\ + |LOOKUP_NAME_REMOTE\ + |LOOKUP_NAME_BUILTIN\ + |LOOKUP_NAME_WKN\ + |LOOKUP_NAME_DOMAIN) + +/** + * @brief Security Identifier + * + * @sa http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/accctrl_38yn.asp + **/ +typedef struct dom_sid { + uint8 sid_rev_num; /**< SID revision number */ + uint8 num_auths; /**< Number of sub-authorities */ + uint8 id_auth[6]; /**< Identifier Authority */ + /* + * Pointer to sub-authorities. + * + * @note The values in these uint32's are in *native* byteorder, not + * neccessarily little-endian...... JRA. + */ + uint32 sub_auths[MAXSUBAUTHS]; +} DOM_SID; + +enum id_mapping { + ID_UNKNOWN = 0, + ID_MAPPED, + ID_UNMAPPED, + ID_EXPIRED +}; + +enum id_type { + ID_TYPE_NOT_SPECIFIED = 0, + ID_TYPE_UID, + ID_TYPE_GID +}; + +struct unixid { + uint32_t id; + enum id_type type; +}; + +struct id_map { + DOM_SID *sid; + struct unixid xid; + enum id_mapping status; +}; + +/* used to hold an arbitrary blob of data */ +typedef struct data_blob { + uint8 *data; + size_t length; + void (*free)(struct data_blob *data_blob); +} DATA_BLOB; + +extern const DATA_BLOB data_blob_null; + +#include "librpc/gen_ndr/misc.h" +#include "librpc/gen_ndr/security.h" +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/lsa.h" +#include "librpc/gen_ndr/dfs.h" +#include "librpc/gen_ndr/winreg.h" +#include "librpc/gen_ndr/initshutdown.h" +#include "librpc/gen_ndr/eventlog.h" +#include "librpc/gen_ndr/srvsvc.h" +#include "librpc/gen_ndr/wkssvc.h" +#include "librpc/gen_ndr/echo.h" +#include "librpc/gen_ndr/svcctl.h" +#include "librpc/gen_ndr/netlogon.h" +#include "librpc/gen_ndr/samr.h" +#include "librpc/gen_ndr/dssetup.h" +#include "librpc/gen_ndr/epmapper.h" +#include "librpc/gen_ndr/libnet_join.h" +#include "librpc/gen_ndr/krb5pac.h" +#include "librpc/gen_ndr/ntsvcs.h" +#include "librpc/gen_ndr/nbt.h" +#include "librpc/gen_ndr/drsuapi.h" +#include "librpc/gen_ndr/drsblobs.h" + +struct lsa_dom_info { + bool valid; + DOM_SID sid; + const char *name; + int num_idxs; + int *idxs; +}; + +struct lsa_name_info { + uint32 rid; + enum lsa_SidType type; + const char *name; + int dom_idx; +}; + +/* Some well-known SIDs */ +extern const DOM_SID global_sid_World_Domain; +extern const DOM_SID global_sid_World; +extern const DOM_SID global_sid_Creator_Owner_Domain; +extern const DOM_SID global_sid_NT_Authority; +extern const DOM_SID global_sid_System; +extern const DOM_SID global_sid_NULL; +extern const DOM_SID global_sid_Authenticated_Users; +extern const DOM_SID global_sid_Network; +extern const DOM_SID global_sid_Creator_Owner; +extern const DOM_SID global_sid_Creator_Group; +extern const DOM_SID global_sid_Anonymous; +extern const DOM_SID global_sid_Builtin; +extern const DOM_SID global_sid_Builtin_Administrators; +extern const DOM_SID global_sid_Builtin_Users; +extern const DOM_SID global_sid_Builtin_Guests; +extern const DOM_SID global_sid_Builtin_Power_Users; +extern const DOM_SID global_sid_Builtin_Account_Operators; +extern const DOM_SID global_sid_Builtin_Server_Operators; +extern const DOM_SID global_sid_Builtin_Print_Operators; +extern const DOM_SID global_sid_Builtin_Backup_Operators; +extern const DOM_SID global_sid_Builtin_Replicator; +extern const DOM_SID global_sid_Builtin_PreWin2kAccess; +extern const DOM_SID global_sid_Unix_Users; +extern const DOM_SID global_sid_Unix_Groups; + +/* + * The complete list of SIDS belonging to this user. + * Created when a vuid is registered. + * The definition of the user_sids array is as follows : + * + * token->user_sids[0] = primary user SID. + * token->user_sids[1] = primary group SID. + * token->user_sids[2..num_sids] = supplementary group SIDS. + */ + +#define PRIMARY_USER_SID_INDEX 0 +#define PRIMARY_GROUP_SID_INDEX 1 + +typedef struct nt_user_token { + size_t num_sids; + DOM_SID *user_sids; + SE_PRIV privileges; +} NT_USER_TOKEN; + +typedef struct unix_user_token { + uid_t uid; + gid_t gid; + size_t ngroups; + gid_t *groups; +} UNIX_USER_TOKEN; + +/* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ +typedef struct time_info { + uint32 time; +} UTIME; + +typedef struct write_cache { + SMB_OFF_T file_size; + SMB_OFF_T offset; + size_t alloc_size; + size_t data_size; + char *data; +} write_cache; + +typedef struct { + smb_ucs2_t *origname; + smb_ucs2_t *filename; + SMB_STRUCT_STAT *statinfo; +} smb_filename; + +#include "fake_file.h" + +struct fd_handle { + size_t ref_count; + int fd; + SMB_BIG_UINT position_information; + SMB_OFF_T pos; + uint32 private_options; /* NT Create options, but we only look at + * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and + * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB (Except + * for print files *only*, where + * DELETE_ON_CLOSE is not stored in the share + * mode database. + */ + unsigned long gen_id; +}; + +struct event_context; +struct fd_event; +struct timed_event; +struct idle_event; +struct share_mode_entry; +struct uuid; +struct named_mutex; + +struct vfs_fsp_data { + struct vfs_fsp_data *next; + struct vfs_handle_struct *owner; + /* NOTE: This structure contains two pointers so that we can guarantee + * that the end of the structure is always both 4-byte and 8-byte aligned. + */ +}; + +/* the basic packet size, assuming no words or bytes */ +#define smb_size 39 + +struct notify_change { + uint32_t action; + const char *name; +}; + +struct notify_mid_map; +struct notify_entry; +struct notify_event; +struct notify_change_request; +struct sys_notify_backend; +struct sys_notify_context { + struct event_context *ev; + struct connection_struct *conn; + void *private_data; /* For use by the system backend */ +}; + +struct notify_change_buf { + /* + * If no requests are pending, changes are queued here. Simple array, + * we only append. + */ + + /* + * num_changes == -1 means that we have got a catch-all change, when + * asked we just return NT_STATUS_OK without specific changes. + */ + int num_changes; + struct notify_change *changes; + + /* + * If no changes are around requests are queued here. Using a linked + * list, because we have to append at the end and delete from the top. + */ + struct notify_change_request *requests; +}; + +typedef struct files_struct { + struct files_struct *next, *prev; + int fnum; + struct connection_struct *conn; + struct fd_handle *fh; + unsigned int num_smb_operations; + uint16 rap_print_jobid; + struct file_id file_id; + SMB_BIG_UINT initial_allocation_size; /* Faked up initial allocation on disk. */ + mode_t mode; + uint16 file_pid; + uint16 vuid; + write_cache *wcp; + struct timeval open_time; + uint32 access_mask; /* NTCreateX access bits (FILE_READ_DATA etc.) */ + uint32 share_access; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */ + + bool update_write_time_triggered; + struct timed_event *update_write_time_event; + bool update_write_time_on_close; + struct timespec close_write_time; + bool write_time_forced; + + int oplock_type; + int sent_oplock_break; + struct timed_event *oplock_timeout; + struct lock_struct last_lock_failure; + int current_lock_count; /* Count the number of outstanding locks and pending locks. */ + + struct share_mode_entry *pending_break_messages; + int num_pending_break_messages; + + bool can_lock; + bool can_read; + bool can_write; + bool print_file; + bool modified; + bool is_directory; + bool aio_write_behind; + bool lockdb_clean; + bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */ + bool posix_open; + char *fsp_name; + + struct vfs_fsp_data *vfs_extension; + struct fake_file_handle *fake_file_handle; + + struct notify_change_buf *notify; + + struct files_struct *base_fsp; /* placeholder for delete on close */ +} files_struct; + +#include "ntquotas.h" +#include "sysquotas.h" + +struct vuid_cache_entry { + struct auth_serversupplied_info *server_info; + uint16_t vuid; + bool read_only; + bool admin_user; +}; + +struct vuid_cache { + unsigned int next_entry; + struct vuid_cache_entry array[VUID_CACHE_SIZE]; +}; + +typedef struct { + char *name; + bool is_wild; +} name_compare_entry; + +struct trans_state { + struct trans_state *next, *prev; + uint16 vuid; + uint16 mid; + + uint32 max_param_return; + uint32 max_data_return; + uint32 max_setup_return; + + uint8 cmd; /* SMBtrans or SMBtrans2 */ + + char *name; /* for trans requests */ + uint16 call; /* for trans2 and nttrans requests */ + + bool close_on_completion; + bool one_way; + + unsigned int setup_count; + uint16 *setup; + + size_t received_data; + size_t received_param; + + size_t total_param; + char *param; + + size_t total_data; + char *data; +}; + +/* + * Info about an alternate data stream + */ + +struct stream_struct { + SMB_OFF_T size; + SMB_OFF_T alloc_size; + char *name; +}; + +/* Include VFS stuff */ + +#include "smb_acls.h" +#include "vfs.h" + +struct dfree_cached_info { + time_t last_dfree_time; + SMB_BIG_UINT dfree_ret; + SMB_BIG_UINT bsize; + SMB_BIG_UINT dfree; + SMB_BIG_UINT dsize; +}; + +struct dptr_struct; + +struct share_params { + int service; +}; + +struct share_iterator { + int next_id; +}; + +typedef struct connection_struct { + struct connection_struct *next, *prev; + unsigned cnum; /* an index passed over the wire */ + struct share_params *params; + bool force_user; + struct vuid_cache vuid_cache; + struct dptr_struct *dirptr; + bool printer; + bool ipc; + bool read_only; /* Attributes for the current user of the share. */ + bool admin_user; /* Attributes for the current user of the share. */ + char *dirpath; + char *connectpath; + char *origpath; + + struct vfs_ops vfs; /* Filesystem operations */ + struct vfs_ops vfs_opaque; /* OPAQUE Filesystem operations */ + struct vfs_handle_struct *vfs_handles; /* for the new plugins */ + + /* + * This represents the user information on this connection. Depending + * on the vuid using this tid, this might change per SMB request. + */ + struct auth_serversupplied_info *server_info; + + char client_address[INET6_ADDRSTRLEN]; /* String version of client IP address. */ + + uint16 vuid; /* vuid of user who *opened* this connection, or UID_FIELD_INVALID */ + + time_t lastused; + time_t lastused_count; + bool used; + int num_files_open; + unsigned int num_smb_operations; /* Count of smb operations on this tree. */ + int encrypt_level; + bool encrypted_tid; + + /* Semantics requested by the client or forced by the server config. */ + bool case_sensitive; + bool case_preserve; + bool short_case_preserve; + + /* Semantics provided by the underlying filesystem. */ + int fs_capabilities; + + name_compare_entry *hide_list; /* Per-share list of files to return as hidden. */ + name_compare_entry *veto_list; /* Per-share list of files to veto (never show). */ + name_compare_entry *veto_oplock_list; /* Per-share list of files to refuse oplocks on. */ + name_compare_entry *aio_write_behind_list; /* Per-share list of files to use aio write behind on. */ + struct dfree_cached_info *dfree_info; + struct trans_state *pending_trans; + struct notify_context *notify_ctx; +} connection_struct; + +struct current_user { + connection_struct *conn; + uint16 vuid; + UNIX_USER_TOKEN ut; + NT_USER_TOKEN *nt_user_token; +}; + +struct smb_request { + uint16 flags2; + uint16 smbpid; + uint16 mid; + uint16 vuid; + uint16 tid; + uint8 wct; + const uint8 *inbuf; + uint8 *outbuf; + size_t unread_bytes; + bool encrypted; + connection_struct *conn; +}; + +/* Defines for the sent_oplock_break field above. */ +#define NO_BREAK_SENT 0 +#define BREAK_TO_NONE_SENT 1 +#define LEVEL_II_BREAK_SENT 2 + +typedef struct { + fstring smb_name; /* user name from the client */ + fstring unix_name; /* unix user name of a validated user */ + fstring full_name; /* to store full name (such as "Joe Bloggs") from gecos field of password file */ + fstring domain; /* domain that the client specified */ +} userdom_struct; + +/* Extra fields above "LPQ_PRINTING" are used to map extra NT status codes. */ + +enum {LPQ_QUEUED=0,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING,LPQ_ERROR,LPQ_DELETING, + LPQ_OFFLINE,LPQ_PAPEROUT,LPQ_PRINTED,LPQ_DELETED,LPQ_BLOCKED,LPQ_USER_INTERVENTION}; + +typedef struct _print_queue_struct { + int job; /* normally the UNIX jobid -- see note in + printing.c:traverse_fn_delete() */ + int size; + int page_count; + int status; + int priority; + time_t time; + fstring fs_user; + fstring fs_file; +} print_queue_struct; + +enum {LPSTAT_OK, LPSTAT_STOPPED, LPSTAT_ERROR}; + +typedef struct { + fstring message; + int qcount; + int status; +} print_status_struct; + +/* used for server information: client, nameserv and ipc */ +struct server_info_struct { + fstring name; + uint32 type; + fstring comment; + fstring domain; /* used ONLY in ipc.c NOT namework.c */ + bool server_added; /* used ONLY in ipc.c NOT namework.c */ +}; + +/* used for network interfaces */ +struct interface { + struct interface *next, *prev; + char *name; + int flags; + struct sockaddr_storage ip; + struct sockaddr_storage netmask; + struct sockaddr_storage bcast; +}; + +/* Internal message queue for deferred opens. */ +struct pending_message_list { + struct pending_message_list *next, *prev; + struct timeval request_time; /* When was this first issued? */ + struct timeval end_time; /* When does this time out? */ + bool encrypted; + DATA_BLOB buf; + DATA_BLOB private_data; +}; + +#define SHARE_MODE_FLAG_POSIX_OPEN 0x1 +#define SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE 0x2 + +/* struct returned by get_share_modes */ +struct share_mode_entry { + struct server_id pid; + uint16 op_mid; + uint16 op_type; + uint32 access_mask; /* NTCreateX access bits (FILE_READ_DATA etc.) */ + uint32 share_access; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */ + uint32 private_options; /* NT Create options, but we only look at + * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and + * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB for + * smbstatus and swat */ + struct timeval time; + struct file_id id; + unsigned long share_file_id; + uint32 uid; /* uid of file opener. */ + uint16 flags; /* See SHARE_MODE_XX above. */ +}; + +/* oplock break message definition - linearization of share_mode_entry. + +Offset Data length. +0 struct server_id pid 4 +4 uint16 op_mid 2 +6 uint16 op_type 2 +8 uint32 access_mask 4 +12 uint32 share_access 4 +16 uint32 private_options 4 +20 uint32 time sec 4 +24 uint32 time usec 4 +28 SMB_DEV_T dev 8 bytes. +36 SMB_INO_T inode 8 bytes +44 unsigned long file_id 4 bytes +48 uint32 uid 4 bytes +52 uint16 flags 2 bytes +54 + +*/ +#ifdef CLUSTER_SUPPORT +#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 58 +#else +#define MSG_SMB_SHARE_MODE_ENTRY_SIZE 54 +#endif + +struct share_mode_lock { + const char *servicepath; /* canonicalized. */ + const char *filename; + struct file_id id; + int num_share_modes; + struct share_mode_entry *share_modes; + UNIX_USER_TOKEN *delete_token; + bool delete_on_close; + struct timespec old_write_time; + struct timespec changed_write_time; + bool fresh; + bool modified; + struct db_record *record; +}; + +/* + * Internal structure of locking.tdb share mode db. + * Used by locking.c and libsmbsharemodes.c + */ + +struct locking_data { + union { + struct { + int num_share_mode_entries; + bool delete_on_close; + struct timespec old_write_time; + struct timespec changed_write_time; + uint32 delete_token_size; /* Only valid if either of + the two previous fields + are True. */ + } s; + struct share_mode_entry dummy; /* Needed for alignment. */ + } u; + /* The following four entries are implicit + struct share_mode_entry modes[num_share_mode_entries]; + char unix_token[delete_token_size] (divisible by 4). + char share_name[]; + char file_name[]; + */ +}; + +/* Used to store pipe open records for NetFileEnum() */ + +struct pipe_open_rec { + struct server_id pid; + uid_t uid; + int pnum; + fstring name; +}; + + +#define NT_HASH_LEN 16 +#define LM_HASH_LEN 16 + +/* Password history contants. */ +#define PW_HISTORY_SALT_LEN 16 +#define SALTED_MD5_HASH_LEN 16 +#define PW_HISTORY_ENTRY_LEN (PW_HISTORY_SALT_LEN+SALTED_MD5_HASH_LEN) +#define MAX_PW_HISTORY_LEN 24 + +/* + * Flags for account policy. + */ +#define AP_MIN_PASSWORD_LEN 1 +#define AP_PASSWORD_HISTORY 2 +#define AP_USER_MUST_LOGON_TO_CHG_PASS 3 +#define AP_MAX_PASSWORD_AGE 4 +#define AP_MIN_PASSWORD_AGE 5 +#define AP_LOCK_ACCOUNT_DURATION 6 +#define AP_RESET_COUNT_TIME 7 +#define AP_BAD_ATTEMPT_LOCKOUT 8 +#define AP_TIME_TO_LOGOUT 9 +#define AP_REFUSE_MACHINE_PW_CHANGE 10 + +/* + * Flags for local user manipulation. + */ + +#define LOCAL_ADD_USER 0x1 +#define LOCAL_DELETE_USER 0x2 +#define LOCAL_DISABLE_USER 0x4 +#define LOCAL_ENABLE_USER 0x8 +#define LOCAL_TRUST_ACCOUNT 0x10 +#define LOCAL_SET_NO_PASSWORD 0x20 +#define LOCAL_SET_PASSWORD 0x40 +#define LOCAL_SET_LDAP_ADMIN_PW 0x80 +#define LOCAL_INTERDOM_ACCOUNT 0x100 +#define LOCAL_AM_ROOT 0x200 /* Act as root */ + +/* key and data in the connections database - used in smbstatus and smbd */ +struct connections_key { + struct server_id pid; + int cnum; + fstring name; +}; + +struct connections_data { + int magic; + struct server_id pid; + int cnum; + uid_t uid; + gid_t gid; + char servicename[FSTRING_LEN]; + char addr[24]; + char machine[FSTRING_LEN]; + time_t start; + uint32 bcast_msg_flags; +}; + + +/* the following are used by loadparm for option lists */ +typedef enum { + P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST, + P_STRING,P_USTRING,P_ENUM,P_SEP +} parm_type; + +typedef enum { + P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE +} parm_class; + +struct enum_list { + int value; + const char *name; +}; + +struct parm_struct { + const char *label; + parm_type type; + parm_class p_class; + void *ptr; + bool (*special)(int snum, const char *, char **); + const struct enum_list *enum_list; + unsigned flags; + union { + bool bvalue; + int ivalue; + char *svalue; + char cvalue; + char **lvalue; + } def; +}; + +/* The following flags are used in SWAT */ +#define FLAG_BASIC 0x0001 /* Display only in BASIC view */ +#define FLAG_SHARE 0x0002 /* file sharing options */ +#define FLAG_PRINT 0x0004 /* printing options */ +#define FLAG_GLOBAL 0x0008 /* local options that should be globally settable in SWAT */ +#define FLAG_WIZARD 0x0010 /* Parameters that the wizard will operate on */ +#define FLAG_ADVANCED 0x0020 /* Parameters that will be visible in advanced view */ +#define FLAG_DEVELOPER 0x0040 /* No longer used */ +#define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */ +#define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */ +#define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */ + +struct bitmap { + uint32 *b; + unsigned int n; +}; + +/* offsets into message for common items */ +#define smb_com 8 +#define smb_rcls 9 +#define smb_reh 10 +#define smb_err 11 +#define smb_flg 13 +#define smb_flg2 14 +#define smb_pidhigh 16 +#define smb_ss_field 18 +#define smb_tid 28 +#define smb_pid 30 +#define smb_uid 32 +#define smb_mid 34 +#define smb_wct 36 +#define smb_vwv 37 +#define smb_vwv0 37 +#define smb_vwv1 39 +#define smb_vwv2 41 +#define smb_vwv3 43 +#define smb_vwv4 45 +#define smb_vwv5 47 +#define smb_vwv6 49 +#define smb_vwv7 51 +#define smb_vwv8 53 +#define smb_vwv9 55 +#define smb_vwv10 57 +#define smb_vwv11 59 +#define smb_vwv12 61 +#define smb_vwv13 63 +#define smb_vwv14 65 +#define smb_vwv15 67 +#define smb_vwv16 69 +#define smb_vwv17 71 + +/* flag defines. CIFS spec 3.1.1 */ +#define FLAG_SUPPORT_LOCKREAD 0x01 +#define FLAG_CLIENT_BUF_AVAIL 0x02 +#define FLAG_RESERVED 0x04 +#define FLAG_CASELESS_PATHNAMES 0x08 +#define FLAG_CANONICAL_PATHNAMES 0x10 +#define FLAG_REQUEST_OPLOCK 0x20 +#define FLAG_REQUEST_BATCH_OPLOCK 0x40 +#define FLAG_REPLY 0x80 + +/* the complete */ +#define SMBmkdir 0x00 /* create directory */ +#define SMBrmdir 0x01 /* delete directory */ +#define SMBopen 0x02 /* open file */ +#define SMBcreate 0x03 /* create file */ +#define SMBclose 0x04 /* close file */ +#define SMBflush 0x05 /* flush file */ +#define SMBunlink 0x06 /* delete file */ +#define SMBmv 0x07 /* rename file */ +#define SMBgetatr 0x08 /* get file attributes */ +#define SMBsetatr 0x09 /* set file attributes */ +#define SMBread 0x0A /* read from file */ +#define SMBwrite 0x0B /* write to file */ +#define SMBlock 0x0C /* lock byte range */ +#define SMBunlock 0x0D /* unlock byte range */ +#define SMBctemp 0x0E /* create temporary file */ +#define SMBmknew 0x0F /* make new file */ +#define SMBcheckpath 0x10 /* check directory path */ +#define SMBexit 0x11 /* process exit */ +#define SMBlseek 0x12 /* seek */ +#define SMBtcon 0x70 /* tree connect */ +#define SMBtconX 0x75 /* tree connect and X*/ +#define SMBtdis 0x71 /* tree disconnect */ +#define SMBnegprot 0x72 /* negotiate protocol */ +#define SMBdskattr 0x80 /* get disk attributes */ +#define SMBsearch 0x81 /* search directory */ +#define SMBsplopen 0xC0 /* open print spool file */ +#define SMBsplwr 0xC1 /* write to print spool file */ +#define SMBsplclose 0xC2 /* close print spool file */ +#define SMBsplretq 0xC3 /* return print queue */ +#define SMBsends 0xD0 /* send single block message */ +#define SMBsendb 0xD1 /* send broadcast message */ +#define SMBfwdname 0xD2 /* forward user name */ +#define SMBcancelf 0xD3 /* cancel forward */ +#define SMBgetmac 0xD4 /* get machine name */ +#define SMBsendstrt 0xD5 /* send start of multi-block message */ +#define SMBsendend 0xD6 /* send end of multi-block message */ +#define SMBsendtxt 0xD7 /* send text of multi-block message */ + +/* Core+ protocol */ +#define SMBlockread 0x13 /* Lock a range and read */ +#define SMBwriteunlock 0x14 /* Unlock a range then write */ +#define SMBreadbraw 0x1a /* read a block of data with no smb header */ +#define SMBwritebraw 0x1d /* write a block of data with no smb header */ +#define SMBwritec 0x20 /* secondary write request */ +#define SMBwriteclose 0x2c /* write a file then close it */ + +/* dos extended protocol */ +#define SMBreadBraw 0x1A /* read block raw */ +#define SMBreadBmpx 0x1B /* read block multiplexed */ +#define SMBreadBs 0x1C /* read block (secondary response) */ +#define SMBwriteBraw 0x1D /* write block raw */ +#define SMBwriteBmpx 0x1E /* write block multiplexed */ +#define SMBwriteBs 0x1F /* write block (secondary request) */ +#define SMBwriteC 0x20 /* write complete response */ +#define SMBsetattrE 0x22 /* set file attributes expanded */ +#define SMBgetattrE 0x23 /* get file attributes expanded */ +#define SMBlockingX 0x24 /* lock/unlock byte ranges and X */ +#define SMBtrans 0x25 /* transaction - name, bytes in/out */ +#define SMBtranss 0x26 /* transaction (secondary request/response) */ +#define SMBioctl 0x27 /* IOCTL */ +#define SMBioctls 0x28 /* IOCTL (secondary request/response) */ +#define SMBcopy 0x29 /* copy */ +#define SMBmove 0x2A /* move */ +#define SMBecho 0x2B /* echo */ +#define SMBopenX 0x2D /* open and X */ +#define SMBreadX 0x2E /* read and X */ +#define SMBwriteX 0x2F /* write and X */ +#define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */ +#define SMBffirst 0x82 /* find first */ +#define SMBfunique 0x83 /* find unique */ +#define SMBfclose 0x84 /* find close */ +#define SMBkeepalive 0x85 /* keepalive */ +#define SMBinvalid 0xFE /* invalid command */ + +/* Extended 2.0 protocol */ +#define SMBtrans2 0x32 /* TRANS2 protocol set */ +#define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */ +#define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */ +#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */ +#define SMBulogoffX 0x74 /* user logoff */ + +/* NT SMB extensions. */ +#define SMBnttrans 0xA0 /* NT transact */ +#define SMBnttranss 0xA1 /* NT transact secondary */ +#define SMBntcreateX 0xA2 /* NT create and X */ +#define SMBntcancel 0xA4 /* NT cancel */ +#define SMBntrename 0xA5 /* NT rename */ + +/* These are the trans subcommands */ +#define TRANSACT_SETNAMEDPIPEHANDLESTATE 0x01 +#define TRANSACT_DCERPCCMD 0x26 +#define TRANSACT_WAITNAMEDPIPEHANDLESTATE 0x53 + +/* These are the TRANS2 sub commands */ +#define TRANSACT2_OPEN 0x00 +#define TRANSACT2_FINDFIRST 0x01 +#define TRANSACT2_FINDNEXT 0x02 +#define TRANSACT2_QFSINFO 0x03 +#define TRANSACT2_SETFSINFO 0x04 +#define TRANSACT2_QPATHINFO 0x05 +#define TRANSACT2_SETPATHINFO 0x06 +#define TRANSACT2_QFILEINFO 0x07 +#define TRANSACT2_SETFILEINFO 0x08 +#define TRANSACT2_FSCTL 0x09 +#define TRANSACT2_IOCTL 0x0A +#define TRANSACT2_FINDNOTIFYFIRST 0x0B +#define TRANSACT2_FINDNOTIFYNEXT 0x0C +#define TRANSACT2_MKDIR 0x0D +#define TRANSACT2_SESSION_SETUP 0x0E +#define TRANSACT2_GET_DFS_REFERRAL 0x10 +#define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11 + +/* These are the NT transact sub commands. */ +#define NT_TRANSACT_CREATE 1 +#define NT_TRANSACT_IOCTL 2 +#define NT_TRANSACT_SET_SECURITY_DESC 3 +#define NT_TRANSACT_NOTIFY_CHANGE 4 +#define NT_TRANSACT_RENAME 5 +#define NT_TRANSACT_QUERY_SECURITY_DESC 6 +#define NT_TRANSACT_GET_USER_QUOTA 7 +#define NT_TRANSACT_SET_USER_QUOTA 8 + +/* These are the NT transact_get_user_quota sub commands */ +#define TRANSACT_GET_USER_QUOTA_LIST_CONTINUE 0x0000 +#define TRANSACT_GET_USER_QUOTA_LIST_START 0x0100 +#define TRANSACT_GET_USER_QUOTA_FOR_SID 0x0101 + +/* Relevant IOCTL codes */ +#define IOCTL_QUERY_JOB_INFO 0x530060 + +/* these are the trans2 sub fields for primary requests */ +#define smb_tpscnt smb_vwv0 +#define smb_tdscnt smb_vwv1 +#define smb_mprcnt smb_vwv2 +#define smb_mdrcnt smb_vwv3 +#define smb_msrcnt smb_vwv4 +#define smb_flags smb_vwv5 +#define smb_timeout smb_vwv6 +#define smb_pscnt smb_vwv9 +#define smb_psoff smb_vwv10 +#define smb_dscnt smb_vwv11 +#define smb_dsoff smb_vwv12 +#define smb_suwcnt smb_vwv13 +#define smb_setup smb_vwv14 +#define smb_setup0 smb_setup +#define smb_setup1 (smb_setup+2) +#define smb_setup2 (smb_setup+4) + +/* these are for the secondary requests */ +#define smb_spscnt smb_vwv2 +#define smb_spsoff smb_vwv3 +#define smb_spsdisp smb_vwv4 +#define smb_sdscnt smb_vwv5 +#define smb_sdsoff smb_vwv6 +#define smb_sdsdisp smb_vwv7 +#define smb_sfid smb_vwv8 + +/* and these for responses */ +#define smb_tprcnt smb_vwv0 +#define smb_tdrcnt smb_vwv1 +#define smb_prcnt smb_vwv3 +#define smb_proff smb_vwv4 +#define smb_prdisp smb_vwv5 +#define smb_drcnt smb_vwv6 +#define smb_droff smb_vwv7 +#define smb_drdisp smb_vwv8 + +/* these are for the NT trans primary request. */ +#define smb_nt_MaxSetupCount smb_vwv0 +#define smb_nt_Flags (smb_vwv0 + 1) +#define smb_nt_TotalParameterCount (smb_vwv0 + 3) +#define smb_nt_TotalDataCount (smb_vwv0 + 7) +#define smb_nt_MaxParameterCount (smb_vwv0 + 11) +#define smb_nt_MaxDataCount (smb_vwv0 + 15) +#define smb_nt_ParameterCount (smb_vwv0 + 19) +#define smb_nt_ParameterOffset (smb_vwv0 + 23) +#define smb_nt_DataCount (smb_vwv0 + 27) +#define smb_nt_DataOffset (smb_vwv0 + 31) +#define smb_nt_SetupCount (smb_vwv0 + 35) +#define smb_nt_Function (smb_vwv0 + 36) +#define smb_nt_SetupStart (smb_vwv0 + 38) + +/* these are for the NT trans secondary request. */ +#define smb_nts_TotalParameterCount (smb_vwv0 + 3) +#define smb_nts_TotalDataCount (smb_vwv0 + 7) +#define smb_nts_ParameterCount (smb_vwv0 + 11) +#define smb_nts_ParameterOffset (smb_vwv0 + 15) +#define smb_nts_ParameterDisplacement (smb_vwv0 + 19) +#define smb_nts_DataCount (smb_vwv0 + 23) +#define smb_nts_DataOffset (smb_vwv0 + 27) +#define smb_nts_DataDisplacement (smb_vwv0 + 31) + +/* these are for the NT trans reply. */ +#define smb_ntr_TotalParameterCount (smb_vwv0 + 3) +#define smb_ntr_TotalDataCount (smb_vwv0 + 7) +#define smb_ntr_ParameterCount (smb_vwv0 + 11) +#define smb_ntr_ParameterOffset (smb_vwv0 + 15) +#define smb_ntr_ParameterDisplacement (smb_vwv0 + 19) +#define smb_ntr_DataCount (smb_vwv0 + 23) +#define smb_ntr_DataOffset (smb_vwv0 + 27) +#define smb_ntr_DataDisplacement (smb_vwv0 + 31) + +/* these are for the NT create_and_X */ +#define smb_ntcreate_NameLength (smb_vwv0 + 5) +#define smb_ntcreate_Flags (smb_vwv0 + 7) +#define smb_ntcreate_RootDirectoryFid (smb_vwv0 + 11) +#define smb_ntcreate_DesiredAccess (smb_vwv0 + 15) +#define smb_ntcreate_AllocationSize (smb_vwv0 + 19) +#define smb_ntcreate_FileAttributes (smb_vwv0 + 27) +#define smb_ntcreate_ShareAccess (smb_vwv0 + 31) +#define smb_ntcreate_CreateDisposition (smb_vwv0 + 35) +#define smb_ntcreate_CreateOptions (smb_vwv0 + 39) +#define smb_ntcreate_ImpersonationLevel (smb_vwv0 + 43) +#define smb_ntcreate_SecurityFlags (smb_vwv0 + 47) + +/* this is used on a TConX. I'm not sure the name is very helpful though */ +#define SMB_SUPPORT_SEARCH_BITS 0x0001 +#define SMB_SHARE_IN_DFS 0x0002 + +/* Named pipe write mode flags. Used in writeX calls. */ +#define PIPE_RAW_MODE 0x4 +#define PIPE_START_MESSAGE 0x8 + +/* File Specific access rights */ +#define FILE_READ_DATA 0x00000001 +#define FILE_WRITE_DATA 0x00000002 +#define FILE_APPEND_DATA 0x00000004 +#define FILE_READ_EA 0x00000008 /* File and directory */ +#define FILE_WRITE_EA 0x00000010 /* File and directory */ +#define FILE_EXECUTE 0x00000020 +#define FILE_DELETE_CHILD 0x00000040 +#define FILE_READ_ATTRIBUTES 0x00000080 +#define FILE_WRITE_ATTRIBUTES 0x00000100 + +#define FILE_ALL_ACCESS 0x000001FF + +/* Directory specific access rights */ +#define FILE_LIST_DIRECTORY 0x00000001 +#define FILE_ADD_FILE 0x00000002 +#define FILE_ADD_SUBDIRECTORY 0x00000004 +#define FILE_TRAVERSE 0x00000020 +#define FILE_DELETE_CHILD 0x00000040 + +/* the desired access to use when opening a pipe */ +#define DESIRED_ACCESS_PIPE 0x2019f + +/* Generic access masks & rights. */ +#define DELETE_ACCESS 0x00010000 /* (1L<<16) */ +#define READ_CONTROL_ACCESS 0x00020000 /* (1L<<17) */ +#define WRITE_DAC_ACCESS 0x00040000 /* (1L<<18) */ +#define WRITE_OWNER_ACCESS 0x00080000 /* (1L<<19) */ +#define SYNCHRONIZE_ACCESS 0x00100000 /* (1L<<20) */ + +#define SYSTEM_SECURITY_ACCESS 0x01000000 /* (1L<<24) */ +#define MAXIMUM_ALLOWED_ACCESS 0x02000000 /* (1L<<25) */ +#define GENERIC_ALL_ACCESS 0x10000000 /* (1<<28) */ +#define GENERIC_EXECUTE_ACCESS 0x20000000 /* (1<<29) */ +#define GENERIC_WRITE_ACCESS 0x40000000 /* (1<<30) */ +#define GENERIC_READ_ACCESS ((unsigned)0x80000000) /* (((unsigned)1)<<31) */ + +/* Mapping of generic access rights for files to specific rights. */ + +/* This maps to 0x1F01FF */ +#define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS| SYNCHRONIZE_ACCESS|FILE_ALL_ACCESS) + +/* This maps to 0x120089 */ +#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ_ACCESS|FILE_READ_DATA|FILE_READ_ATTRIBUTES|\ + FILE_READ_EA|SYNCHRONIZE_ACCESS) + +/* This maps to 0x120116 */ +#define FILE_GENERIC_WRITE (STD_RIGHT_READ_CONTROL_ACCESS|FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|\ + FILE_WRITE_EA|FILE_APPEND_DATA|SYNCHRONIZE_ACCESS) + +#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|\ + FILE_EXECUTE|SYNCHRONIZE_ACCESS) + +/* Share specific rights. */ +#define SHARE_ALL_ACCESS FILE_GENERIC_ALL +#define SHARE_READ_ONLY (FILE_GENERIC_READ|FILE_EXECUTE) + +/* Mapping of access rights to UNIX perms. */ +#define UNIX_ACCESS_RWX FILE_GENERIC_ALL +#define UNIX_ACCESS_R FILE_GENERIC_READ +#define UNIX_ACCESS_W FILE_GENERIC_WRITE +#define UNIX_ACCESS_X FILE_GENERIC_EXECUTE + +/* Mapping of access rights to UNIX perms. for a UNIX directory. */ +#define UNIX_DIRECTORY_ACCESS_RWX FILE_GENERIC_ALL +#define UNIX_DIRECTORY_ACCESS_R FILE_GENERIC_READ +#define UNIX_DIRECTORY_ACCESS_W FILE_GENERIC_WRITE +#define UNIX_DIRECTORY_ACCESS_X FILE_GENERIC_EXECUTE + +#if 0 +/* + * This is the old mapping we used to use. To get W2KSP2 profiles + * working we need to map to the canonical file perms. + */ +#define UNIX_ACCESS_RWX (UNIX_ACCESS_R|UNIX_ACCESS_W|UNIX_ACCESS_X) +#define UNIX_ACCESS_R (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\ + FILE_READ_ATTRIBUTES|FILE_READ_EA|FILE_READ_DATA) +#define UNIX_ACCESS_W (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\ + FILE_WRITE_ATTRIBUTES|FILE_WRITE_EA|\ + FILE_APPEND_DATA|FILE_WRITE_DATA) +#define UNIX_ACCESS_X (READ_CONTROL_ACCESS|SYNCHRONIZE_ACCESS|\ + FILE_EXECUTE|FILE_READ_ATTRIBUTES) +#endif + +#define UNIX_ACCESS_NONE (WRITE_OWNER_ACCESS) + +/* Flags field. */ +#define REQUEST_OPLOCK 2 +#define REQUEST_BATCH_OPLOCK 4 +#define OPEN_DIRECTORY 8 +#define EXTENDED_RESPONSE_REQUIRED 0x10 + +/* ShareAccess field. */ +#define FILE_SHARE_NONE 0 /* Cannot be used in bitmask. */ +#define FILE_SHARE_READ 1 +#define FILE_SHARE_WRITE 2 +#define FILE_SHARE_DELETE 4 + +/* FileAttributesField */ +#define FILE_ATTRIBUTE_READONLY 0x001L +#define FILE_ATTRIBUTE_HIDDEN 0x002L +#define FILE_ATTRIBUTE_SYSTEM 0x004L +#define FILE_ATTRIBUTE_DIRECTORY 0x010L +#define FILE_ATTRIBUTE_ARCHIVE 0x020L +#define FILE_ATTRIBUTE_NORMAL 0x080L +#define FILE_ATTRIBUTE_TEMPORARY 0x100L +#define FILE_ATTRIBUTE_SPARSE 0x200L +#define FILE_ATTRIBUTE_REPARSE_POINT 0x400L +#define FILE_ATTRIBUTE_COMPRESSED 0x800L +#define FILE_ATTRIBUTE_OFFLINE 0x1000L +#define FILE_ATTRIBUTE_NONINDEXED 0x2000L +#define FILE_ATTRIBUTE_ENCRYPTED 0x4000L +#define SAMBA_ATTRIBUTES_MASK 0x7F + +/* Flags - combined with attributes. */ +#define FILE_FLAG_WRITE_THROUGH 0x80000000L +#define FILE_FLAG_NO_BUFFERING 0x20000000L +#define FILE_FLAG_RANDOM_ACCESS 0x10000000L +#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000L +#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000L +#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L +#define FILE_FLAG_POSIX_SEMANTICS 0x01000000L + +/* CreateDisposition field. */ +#define FILE_SUPERSEDE 0 /* File exists overwrite/supersede. File not exist create. */ +#define FILE_OPEN 1 /* File exists open. File not exist fail. */ +#define FILE_CREATE 2 /* File exists fail. File not exist create. */ +#define FILE_OPEN_IF 3 /* File exists open. File not exist create. */ +#define FILE_OVERWRITE 4 /* File exists overwrite. File not exist fail. */ +#define FILE_OVERWRITE_IF 5 /* File exists overwrite. File not exist create. */ + +/* CreateOptions field. */ +#define FILE_DIRECTORY_FILE 0x0001 +#define FILE_WRITE_THROUGH 0x0002 +#define FILE_SEQUENTIAL_ONLY 0x0004 +#define FILE_NON_DIRECTORY_FILE 0x0040 +#define FILE_NO_EA_KNOWLEDGE 0x0200 +#define FILE_EIGHT_DOT_THREE_ONLY 0x0400 +#define FILE_RANDOM_ACCESS 0x0800 +#define FILE_DELETE_ON_CLOSE 0x1000 +#define FILE_OPEN_BY_FILE_ID 0x2000 + +#define NTCREATEX_OPTIONS_MUST_IGNORE_MASK (0x008F0480) + +#define NTCREATEX_OPTIONS_INVALID_PARAM_MASK (0xFF100030) + +/* + * Private create options used by the ntcreatex processing code. From Samba4. + * We reuse some ignored flags for private use. + */ +#define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS 0x00010000 +#define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB 0x00020000 + +/* Private options for streams support */ +#define NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE 0x00040000 + +/* Responses when opening a file. */ +#define FILE_WAS_SUPERSEDED 0 +#define FILE_WAS_OPENED 1 +#define FILE_WAS_CREATED 2 +#define FILE_WAS_OVERWRITTEN 3 + +/* File type flags */ +#define FILE_TYPE_DISK 0 +#define FILE_TYPE_BYTE_MODE_PIPE 1 +#define FILE_TYPE_MESSAGE_MODE_PIPE 2 +#define FILE_TYPE_PRINTER 3 +#define FILE_TYPE_COMM_DEVICE 4 +#define FILE_TYPE_UNKNOWN 0xFFFF + +/* Flag for NT transact rename call. */ +#define RENAME_REPLACE_IF_EXISTS 1 + +/* flags for SMBntrename call (from Samba4) */ +#define RENAME_FLAG_MOVE_CLUSTER_INFORMATION 0x102 /* ???? */ +#define RENAME_FLAG_HARD_LINK 0x103 +#define RENAME_FLAG_RENAME 0x104 +#define RENAME_FLAG_COPY 0x105 + +/* Filesystem Attributes. */ +#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 +#define FILE_CASE_PRESERVED_NAMES 0x00000002 +#define FILE_UNICODE_ON_DISK 0x00000004 +/* According to cifs9f, this is 4, not 8 */ +/* Acconding to testing, this actually sets the security attribute! */ +#define FILE_PERSISTENT_ACLS 0x00000008 +#define FILE_FILE_COMPRESSION 0x00000010 +#define FILE_VOLUME_QUOTAS 0x00000020 +#define FILE_SUPPORTS_SPARSE_FILES 0x00000040 +#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 +#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 +#define FS_LFN_APIS 0x00004000 +#define FILE_VOLUME_IS_COMPRESSED 0x00008000 +#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 +#define FILE_SUPPORTS_ENCRYPTION 0x00020000 +#define FILE_NAMED_STREAMS 0x00040000 +#define FILE_READ_ONLY_VOLUME 0x00080000 + +/* ChangeNotify flags. */ +#define FILE_NOTIFY_CHANGE_FILE_NAME 0x001 +#define FILE_NOTIFY_CHANGE_DIR_NAME 0x002 +#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x004 +#define FILE_NOTIFY_CHANGE_SIZE 0x008 +#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x010 +#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x020 +#define FILE_NOTIFY_CHANGE_CREATION 0x040 +#define FILE_NOTIFY_CHANGE_EA 0x080 +#define FILE_NOTIFY_CHANGE_SECURITY 0x100 +#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 +#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 +#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 + +#define FILE_NOTIFY_CHANGE_NAME \ + (FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME) + +/* change notify action results */ +#define NOTIFY_ACTION_ADDED 1 +#define NOTIFY_ACTION_REMOVED 2 +#define NOTIFY_ACTION_MODIFIED 3 +#define NOTIFY_ACTION_OLD_NAME 4 +#define NOTIFY_ACTION_NEW_NAME 5 +#define NOTIFY_ACTION_ADDED_STREAM 6 +#define NOTIFY_ACTION_REMOVED_STREAM 7 +#define NOTIFY_ACTION_MODIFIED_STREAM 8 + + +/* where to find the base of the SMB packet proper */ +#define smb_base(buf) (((char *)(buf))+4) + +/* we don't allow server strings to be longer than 48 characters as + otherwise NT will not honour the announce packets */ +#define MAX_SERVER_STRING_LENGTH 48 + + +#define SMB_SUCCESS 0 /* The request was successful. */ + +#ifdef WITH_DFS +void dfs_unlogin(void); +extern int dcelogin_atmost_once; +#endif + +#ifdef NOSTRDUP +char *strdup(char *s); +#endif + +#ifndef SIGNAL_CAST +#define SIGNAL_CAST (RETSIGTYPE (*)(int)) +#endif + +#ifndef SELECT_CAST +#define SELECT_CAST +#endif + +/* This was set by JHT in liaison with Jeremy Allison early 1997 + * History: + * Version 4.0 - never made public + * Version 4.10 - New to 1.9.16p2, lost in space 1.9.16p3 to 1.9.16p9 + * - Reappeared in 1.9.16p11 with fixed smbd services + * Version 4.20 - To indicate that nmbd and browsing now works better + * Version 4.50 - Set at release of samba-2.2.0 by JHT + * + * Note: In the presence of NT4.X do not set above 4.9 + * Setting this above 4.9 can have undesired side-effects. + * This may change again in Samba-3.0 after further testing. JHT + */ + +#define DEFAULT_MAJOR_VERSION 0x04 +#define DEFAULT_MINOR_VERSION 0x09 + +/* Browser Election Values */ +#define BROWSER_ELECTION_VERSION 0x010f +#define BROWSER_CONSTANT 0xaa55 + +/* Sercurity mode bits. */ +#define NEGOTIATE_SECURITY_USER_LEVEL 0x01 +#define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE 0x02 +#define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04 +#define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08 + +/* NT Flags2 bits - cifs6.txt section 3.1.2 */ + +#define FLAGS2_LONG_PATH_COMPONENTS 0x0001 +#define FLAGS2_EXTENDED_ATTRIBUTES 0x0002 +#define FLAGS2_SMB_SECURITY_SIGNATURES 0x0004 +#define FLAGS2_UNKNOWN_BIT4 0x0010 +#define FLAGS2_IS_LONG_NAME 0x0040 +#define FLAGS2_EXTENDED_SECURITY 0x0800 +#define FLAGS2_DFS_PATHNAMES 0x1000 +#define FLAGS2_READ_PERMIT_EXECUTE 0x2000 +#define FLAGS2_32_BIT_ERROR_CODES 0x4000 +#define FLAGS2_UNICODE_STRINGS 0x8000 + +#define FLAGS2_WIN2K_SIGNATURE 0xC852 /* Hack alert ! For now... JRA. */ + +/* TCONX Flag (smb_vwv2). */ +#define TCONX_FLAG_EXTENDED_RESPONSE 0x8 + +/* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */ + +#define CAP_RAW_MODE 0x0001 +#define CAP_MPX_MODE 0x0002 +#define CAP_UNICODE 0x0004 +#define CAP_LARGE_FILES 0x0008 +#define CAP_NT_SMBS 0x0010 +#define CAP_RPC_REMOTE_APIS 0x0020 +#define CAP_STATUS32 0x0040 +#define CAP_LEVEL_II_OPLOCKS 0x0080 +#define CAP_LOCK_AND_READ 0x0100 +#define CAP_NT_FIND 0x0200 +#define CAP_DFS 0x1000 +#define CAP_W2K_SMBS 0x2000 +#define CAP_LARGE_READX 0x4000 +#define CAP_LARGE_WRITEX 0x8000 +#define CAP_UNIX 0x800000 /* Capabilities for UNIX extensions. Created by HP. */ +#define CAP_EXTENDED_SECURITY 0x80000000 + +/* protocol types. It assumes that higher protocols include lower protocols + as subsets */ +enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; + +/* security levels */ +enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN,SEC_ADS}; + +/* server roles */ +enum server_types { + ROLE_STANDALONE, + ROLE_DOMAIN_MEMBER, + ROLE_DOMAIN_BDC, + ROLE_DOMAIN_PDC +}; + +/* printing types */ +enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, + PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ, + PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2,PRINT_IPRINT +#if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS) +,PRINT_TEST,PRINT_VLP +#endif /* DEVELOPER */ +}; + +/* LDAP schema types */ +enum schema_types {SCHEMA_COMPAT, SCHEMA_AD, SCHEMA_SAMBA}; + +/* LDAP SSL options */ +enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS}; + +/* LDAP PASSWD SYNC methods */ +enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY}; + +/* Remote architectures we know about. */ +enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, + RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_VISTA, + RA_SAMBA, RA_CIFSFS, RA_WINXP64}; + +/* case handling */ +enum case_handling {CASE_LOWER,CASE_UPPER}; + +/* ACL compatibility */ +enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K}; +/* + * Global value meaing that the smb_uid field should be + * ingored (in share level security and protocol level == CORE) + */ + +#define UID_FIELD_INVALID 0 +#define VUID_OFFSET 100 /* Amount to bias returned vuid numbers */ + +/* + * Size of buffer to use when moving files across filesystems. + */ +#define COPYBUF_SIZE (8*1024) + +/* + * Used in chaining code. + */ +extern int chain_size; + +/* + * Map the Core and Extended Oplock requesst bits down + * to common bits (EXCLUSIVE_OPLOCK & BATCH_OPLOCK). + */ + +/* + * Core protocol. + */ +#define CORE_OPLOCK_REQUEST(inbuf) \ + ((CVAL(inbuf,smb_flg)&(FLAG_REQUEST_OPLOCK|FLAG_REQUEST_BATCH_OPLOCK))>>5) + +/* + * Extended protocol. + */ +#define EXTENDED_OPLOCK_REQUEST(inbuf) ((SVAL(inbuf,smb_vwv2)&((1<<1)|(1<<2)))>>1) + +/* Lock types. */ +#define LOCKING_ANDX_SHARED_LOCK 0x1 +#define LOCKING_ANDX_OPLOCK_RELEASE 0x2 +#define LOCKING_ANDX_CHANGE_LOCKTYPE 0x4 +#define LOCKING_ANDX_CANCEL_LOCK 0x8 +#define LOCKING_ANDX_LARGE_FILES 0x10 + +/* + * Bits we test with. + * Note these must fit into 16-bits. + */ + +#define NO_OPLOCK 0x0 +#define EXCLUSIVE_OPLOCK 0x1 +#define BATCH_OPLOCK 0x2 +#define LEVEL_II_OPLOCK 0x4 + +/* The following are Samba-private. */ +#define INTERNAL_OPEN_ONLY 0x8 +#define FAKE_LEVEL_II_OPLOCK 0x10 /* Client requested no_oplock, but we have to + * inform potential level2 holders on + * write. */ +#define DEFERRED_OPEN_ENTRY 0x20 +#define UNUSED_SHARE_MODE_ENTRY 0x40 +#define FORCE_OPLOCK_BREAK_TO_NONE 0x80 + +/* None of the following should ever appear in fsp->oplock_request. */ +#define SAMBA_PRIVATE_OPLOCK_MASK (INTERNAL_OPEN_ONLY|DEFERRED_OPEN_ENTRY|UNUSED_SHARE_MODE_ENTRY|FORCE_OPLOCK_BREAK_TO_NONE) + +#define EXCLUSIVE_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)EXCLUSIVE_OPLOCK|(unsigned int)BATCH_OPLOCK)) +#define BATCH_OPLOCK_TYPE(lck) ((lck) & (unsigned int)BATCH_OPLOCK) +#define LEVEL_II_OPLOCK_TYPE(lck) ((lck) & ((unsigned int)LEVEL_II_OPLOCK|(unsigned int)FAKE_LEVEL_II_OPLOCK)) + +struct inform_level2_message { + SMB_DEV_T dev; + SMB_INO_T inode; + uint16 mid; + unsigned long target_file_id; + unsigned long source_file_id; +}; + +/* kernel_oplock_message definition. + +struct kernel_oplock_message { + SMB_DEV_T dev; + SMB_INO_T inode; + unsigned long file_id; +}; + +Offset Data length. +0 SMB_DEV_T dev 8 bytes. +8 SMB_INO_T inode 8 bytes +16 unsigned long file_id 4 bytes +20 + +*/ +#define MSG_SMB_KERNEL_BREAK_SIZE 20 + +/* file_renamed_message definition. + +struct file_renamed_message { + SMB_DEV_T dev; + SMB_INO_T inode; + char names[1]; A variable area containing sharepath and filename. +}; + +Offset Data length. +0 SMB_DEV_T dev 8 bytes. +8 SMB_INO_T inode 8 bytes +16 char [] name zero terminated namelen bytes +minimum length == 18. + +*/ + +#define MSG_FILE_RENAMED_MIN_SIZE 16 + +/* + * On the wire return values for oplock types. + */ + +#define CORE_OPLOCK_GRANTED (1<<5) +#define EXTENDED_OPLOCK_GRANTED (1<<15) + +#define NO_OPLOCK_RETURN 0 +#define EXCLUSIVE_OPLOCK_RETURN 1 +#define BATCH_OPLOCK_RETURN 2 +#define LEVEL_II_OPLOCK_RETURN 3 + +/* Oplock levels */ +#define OPLOCKLEVEL_NONE 0 +#define OPLOCKLEVEL_II 1 + +/* + * Capabilities abstracted for different systems. + */ + +enum smbd_capability { + KERNEL_OPLOCK_CAPABILITY, + DMAPI_ACCESS_CAPABILITY, + LEASE_CAPABILITY +}; + +/* if a kernel does support oplocks then a structure of the following + typee is used to describe how to interact with the kernel */ +struct kernel_oplocks { + files_struct * (*receive_message)(fd_set *fds); + bool (*set_oplock)(files_struct *fsp, int oplock_type); + void (*release_oplock)(files_struct *fsp); + bool (*msg_waiting)(fd_set *fds); + int notification_fd; +}; + +#include "smb_macros.h" + +#define MAX_NETBIOSNAME_LEN 16 +/* DOS character, NetBIOS namestring. Type used on the wire. */ +typedef char nstring[MAX_NETBIOSNAME_LEN]; +/* Unix character, NetBIOS namestring. Type used to manipulate name in nmbd. */ +typedef char unstring[MAX_NETBIOSNAME_LEN*4]; + +/* A netbios name structure. */ +struct nmb_name { + nstring name; + char scope[64]; + unsigned int name_type; +}; + +/* A netbios node status array element. */ +typedef struct node_status_ { + nstring name; + unsigned char type; + unsigned char flags; +} NODE_STATUS_STRUCT; + +/* The extra info from a NetBIOS node status query */ +struct node_status_extra { + unsigned char mac_addr[6]; + /* There really is more here ... */ +}; + +struct pwd_info { + bool null_pwd; + bool cleartext; + + fstring password; +}; + +/* For split krb5 SPNEGO blobs. */ +struct pending_auth_data { + struct pending_auth_data *prev, *next; + uint16 vuid; /* Tag for this entry. */ + uint16 smbpid; /* Alternate tag for this entry. */ + size_t needed_len; + DATA_BLOB partial_data; +}; + +typedef struct user_struct { + struct user_struct *next, *prev; + uint16 vuid; /* Tag for this entry. */ + + char *session_keystr; /* used by utmp and pam session code. + TDB key string */ + int homes_snum; + + struct auth_serversupplied_info *server_info; + + struct auth_ntlmssp_state *auth_ntlmssp_state; +} user_struct; + +struct unix_error_map { + int unix_error; + int dos_class; + int dos_code; + NTSTATUS nt_error; +}; + +/* + * Size of new password account encoding string. This is enough space to + * hold 11 ACB characters, plus the surrounding [] and a terminating null. + * Do not change unless you are adding new ACB bits! + */ + +#define NEW_PW_FORMAT_SPACE_PADDED_LEN 14 + +/* + Do you want session setups at user level security with a invalid + password to be rejected or allowed in as guest? WinNT rejects them + but it can be a pain as it means "net view" needs to use a password + + You have 3 choices in the setting of map_to_guest: + + "NEVER_MAP_TO_GUEST" means session setups with an invalid password + are rejected. This is the default. + + "MAP_TO_GUEST_ON_BAD_USER" means session setups with an invalid password + are rejected, unless the username does not exist, in which case it + is treated as a guest login + + "MAP_TO_GUEST_ON_BAD_PASSWORD" means session setups with an invalid password + are treated as a guest login + + Note that map_to_guest only has an effect in user or server + level security. +*/ + +#define NEVER_MAP_TO_GUEST 0 +#define MAP_TO_GUEST_ON_BAD_USER 1 +#define MAP_TO_GUEST_ON_BAD_PASSWORD 2 +#define MAP_TO_GUEST_ON_BAD_UID 3 + +#define SAFE_NETBIOS_CHARS ". -_" + +/* generic iconv conversion structure */ +typedef struct _smb_iconv_t { + size_t (*direct)(void *cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*pull)(void *cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*push)(void *cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + void *cd_direct, *cd_pull, *cd_push; + char *from_name, *to_name; +} *smb_iconv_t; + +/* The maximum length of a trust account password. + Used when we randomly create it, 15 char passwords + exceed NT4's max password length */ + +#define DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH 14 + +#include "popt_common.h" + +#define PORT_NONE 0 +#ifndef LDAP_PORT +#define LDAP_PORT 389 +#endif +#define LDAP_GC_PORT 3268 + +/* used by the IP comparison function */ +struct ip_service { + struct sockaddr_storage ss; + unsigned port; +}; + +/* Special name type used to cause a _kerberos DNS lookup. */ +#define KDC_NAME_TYPE 0xDCDC + +/* Used by the SMB signing functions. */ + +typedef struct smb_sign_info { + void (*sign_outgoing_message)(char *outbuf, struct smb_sign_info *si); + bool (*check_incoming_message)(const char *inbuf, struct smb_sign_info *si, bool must_be_ok); + void (*free_signing_context)(struct smb_sign_info *si); + void *signing_context; + + bool negotiated_smb_signing; + bool allow_smb_signing; + bool doing_signing; + bool mandatory_signing; + bool seen_valid; /* Have I ever seen a validly signed packet? */ +} smb_sign_info; + +struct ea_struct { + uint8 flags; + char *name; + DATA_BLOB value; +}; + +struct ea_list { + struct ea_list *next, *prev; + struct ea_struct ea; +}; + +/* EA names used internally in Samba. KEEP UP TO DATE with prohibited_ea_names in trans2.c !. */ +#define SAMBA_POSIX_INHERITANCE_EA_NAME "user.SAMBA_PAI" +/* EA to use for DOS attributes */ +#define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" +/* Prefix for DosStreams in the vfs_streams_xattr module */ +#define SAMBA_XATTR_DOSSTREAM_PREFIX "user.DosStream." + +#define UUID_SIZE 16 + +#define UUID_FLAT_SIZE 16 +typedef struct uuid_flat { + uint8 info[UUID_FLAT_SIZE]; +} UUID_FLAT; + +/* map readonly options */ +enum mapreadonly_options {MAP_READONLY_NO, MAP_READONLY_YES, MAP_READONLY_PERMISSIONS}; + +/* usershare error codes. */ +enum usershare_err { + USERSHARE_OK=0, + USERSHARE_MALFORMED_FILE, + USERSHARE_BAD_VERSION, + USERSHARE_MALFORMED_PATH, + USERSHARE_MALFORMED_COMMENT_DEF, + USERSHARE_MALFORMED_ACL_DEF, + USERSHARE_ACL_ERR, + USERSHARE_PATH_NOT_ABSOLUTE, + USERSHARE_PATH_IS_DENIED, + USERSHARE_PATH_NOT_ALLOWED, + USERSHARE_PATH_NOT_DIRECTORY, + USERSHARE_POSIX_ERR +}; + +/* Different reasons for closing a file. */ +enum file_close_type {NORMAL_CLOSE=0,SHUTDOWN_CLOSE,ERROR_CLOSE}; + +/* Used in SMB_FS_OBJECTID_INFORMATION requests. Must be exactly 48 bytes. */ +#define SAMBA_EXTENDED_INFO_MAGIC 0x536d4261 /* "SmBa" */ +#define SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH 28 +struct smb_extended_info { + uint32 samba_magic; /* Always SAMBA_EXTRA_INFO_MAGIC */ + uint32 samba_version; /* Major/Minor/Release/Revision */ + uint32 samba_subversion; /* Prerelease/RC/Vendor patch */ + NTTIME samba_gitcommitdate; + char samba_version_string[SAMBA_EXTENDED_INFO_VERSION_STRING_LENGTH]; +}; + +#endif /* _SMB_H */ diff --git a/source3/include/smb_acls.h b/source3/include/smb_acls.h new file mode 100644 index 0000000000..3d9cfbf5d2 --- /dev/null +++ b/source3/include/smb_acls.h @@ -0,0 +1,65 @@ +/* + Unix SMB/CIFS implementation. + Portable SMB ACL interface + Copyright (C) Jeremy Allison 2000 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _SMB_ACLS_H +#define _SMB_ACLS_H + +typedef int SMB_ACL_TYPE_T; +typedef mode_t *SMB_ACL_PERMSET_T; +typedef mode_t SMB_ACL_PERM_T; +#define SMB_ACL_READ 4 +#define SMB_ACL_WRITE 2 +#define SMB_ACL_EXECUTE 1 + +/* Types of ACLs. */ +enum smb_acl_tag_t { + SMB_ACL_TAG_INVALID=0, + SMB_ACL_USER=1, + SMB_ACL_USER_OBJ, + SMB_ACL_GROUP, + SMB_ACL_GROUP_OBJ, + SMB_ACL_OTHER, + SMB_ACL_MASK +}; + +typedef enum smb_acl_tag_t SMB_ACL_TAG_T; + +struct smb_acl_entry { + enum smb_acl_tag_t a_type; + SMB_ACL_PERM_T a_perm; + uid_t uid; + gid_t gid; +}; + +typedef struct smb_acl_t { + int size; + int count; + int next; + struct smb_acl_entry acl[1]; +} *SMB_ACL_T; + +typedef struct smb_acl_entry *SMB_ACL_ENTRY_T; + +#define SMB_ACL_FIRST_ENTRY 0 +#define SMB_ACL_NEXT_ENTRY 1 + +#define SMB_ACL_TYPE_ACCESS 0 +#define SMB_ACL_TYPE_DEFAULT 1 + +#endif /* _SMB_ACLS_H */ diff --git a/source3/include/smb_ldap.h b/source3/include/smb_ldap.h new file mode 100644 index 0000000000..a3c270d95c --- /dev/null +++ b/source3/include/smb_ldap.h @@ -0,0 +1,255 @@ +/* + Unix SMB/CIFS Implementation. + LDAP protocol helper functions for SAMBA + Copyright (C) Volker Lendecke 2004 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#ifndef _SMB_LDAP_H +#define _SMB_LDAP_H + +enum ldap_request_tag { + LDAP_TAG_BindRequest = 0, + LDAP_TAG_BindResponse = 1, + LDAP_TAG_UnbindRequest = 2, + LDAP_TAG_SearchRequest = 3, + LDAP_TAG_SearchResultEntry = 4, + LDAP_TAG_SearchResultDone = 5, + LDAP_TAG_ModifyRequest = 6, + LDAP_TAG_ModifyResponse = 7, + LDAP_TAG_AddRequest = 8, + LDAP_TAG_AddResponse = 9, + LDAP_TAG_DelRequest = 10, + LDAP_TAG_DelResponse = 11, + LDAP_TAG_ModifyDNRequest = 12, + LDAP_TAG_ModifyDNResponse = 13, + LDAP_TAG_CompareRequest = 14, + LDAP_TAG_CompareResponse = 15, + LDAP_TAG_AbandonRequest = 16, + LDAP_TAG_SearchResultReference = 19, + LDAP_TAG_ExtendedRequest = 23, + LDAP_TAG_ExtendedResponse = 24 +}; + +enum ldap_auth_mechanism { + LDAP_AUTH_MECH_SIMPLE = 0, + LDAP_AUTH_MECH_SASL = 3 +}; + +#ifndef LDAP_SUCCESS +enum ldap_result_code { + LDAP_SUCCESS = 0, + LDAP_SASL_BIND_IN_PROGRESS = 0x0e, + LDAP_INVALID_CREDENTIALS = 0x31, + LDAP_OTHER = 0x50 +}; +#endif /* LDAP_SUCCESS */ + +struct ldap_Result { + int resultcode; + const char *dn; + const char *errormessage; + const char *referral; +}; + +struct ldap_attribute { + const char *name; + int num_values; + DATA_BLOB *values; +}; + +struct ldap_BindRequest { + int version; + const char *dn; + enum ldap_auth_mechanism mechanism; + union { + const char *password; + struct { + const char *mechanism; + DATA_BLOB secblob; + } SASL; + } creds; +}; + +struct ldap_BindResponse { + struct ldap_Result response; + union { + DATA_BLOB secblob; + } SASL; +}; + +struct ldap_UnbindRequest { + uint8 __dummy; +}; + +enum ldap_scope { + LDAP_SEARCH_SCOPE_BASE = 0, + LDAP_SEARCH_SCOPE_SINGLE = 1, + LDAP_SEARCH_SCOPE_SUB = 2 +}; + +enum ldap_deref { + LDAP_DEREFERENCE_NEVER = 0, + LDAP_DEREFERENCE_IN_SEARCHING = 1, + LDAP_DEREFERENCE_FINDING_BASE = 2, + LDAP_DEREFERENCE_ALWAYS +}; + +struct ldap_SearchRequest { + const char *basedn; + enum ldap_scope scope; + enum ldap_deref deref; + uint32 timelimit; + uint32 sizelimit; + bool attributesonly; + char *filter; + int num_attributes; + const char **attributes; +}; + +struct ldap_SearchResEntry { + const char *dn; + int num_attributes; + struct ldap_attribute *attributes; +}; + +struct ldap_SearchResRef { + int num_referrals; + const char **referrals; +}; + +enum ldap_modify_type { + LDAP_MODIFY_NONE = -1, + LDAP_MODIFY_ADD = 0, + LDAP_MODIFY_DELETE = 1, + LDAP_MODIFY_REPLACE = 2 +}; + +struct ldap_mod { + enum ldap_modify_type type; + struct ldap_attribute attrib; +}; + +struct ldap_ModifyRequest { + const char *dn; + int num_mods; + struct ldap_mod *mods; +}; + +struct ldap_AddRequest { + const char *dn; + int num_attributes; + struct ldap_attribute *attributes; +}; + +struct ldap_DelRequest { + const char *dn; +}; + +struct ldap_ModifyDNRequest { + const char *dn; + const char *newrdn; + bool deleteolddn; + const char *newsuperior; +}; + +struct ldap_CompareRequest { + const char *dn; + const char *attribute; + const char *value; +}; + +struct ldap_AbandonRequest { + uint32 messageid; +}; + +struct ldap_ExtendedRequest { + const char *oid; + DATA_BLOB value; +}; + +struct ldap_ExtendedResponse { + struct ldap_Result response; + const char *name; + DATA_BLOB value; +}; + +union ldap_Request { + struct ldap_BindRequest BindRequest; + struct ldap_BindResponse BindResponse; + struct ldap_UnbindRequest UnbindRequest; + struct ldap_SearchRequest SearchRequest; + struct ldap_SearchResEntry SearchResultEntry; + struct ldap_Result SearchResultDone; + struct ldap_SearchResRef SearchResultReference; + struct ldap_ModifyRequest ModifyRequest; + struct ldap_Result ModifyResponse; + struct ldap_AddRequest AddRequest; + struct ldap_Result AddResponse; + struct ldap_DelRequest DelRequest; + struct ldap_Result DelResponse; + struct ldap_ModifyDNRequest ModifyDNRequest; + struct ldap_Result ModifyDNResponse; + struct ldap_CompareRequest CompareRequest; + struct ldap_Result CompareResponse; + struct ldap_AbandonRequest AbandonRequest; + struct ldap_ExtendedRequest ExtendedRequest; + struct ldap_ExtendedResponse ExtendedResponse; +}; + +struct ldap_Control { + const char *oid; + bool critical; + DATA_BLOB value; +}; + +struct ldap_message { + TALLOC_CTX *mem_ctx; + uint32 messageid; + uint8 type; + union ldap_Request r; + int num_controls; + struct ldap_Control *controls; +}; + +struct ldap_queue_entry { + struct ldap_queue_entry *next, *prev; + int msgid; + struct ldap_message *msg; +}; + +struct ldap_connection { + TALLOC_CTX *mem_ctx; + int sock; + int next_msgid; + char *host; + uint16 port; + bool ldaps; + + const char *auth_dn; + const char *simple_pw; + + /* Current outstanding search entry */ + int searchid; + + /* List for incoming search entries */ + struct ldap_queue_entry *search_entries; + + /* Outstanding LDAP requests that have not yet been replied to */ + struct ldap_queue_entry *outstanding; +}; + +#endif diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h new file mode 100644 index 0000000000..20e2a9a443 --- /dev/null +++ b/source3/include/smb_macros.h @@ -0,0 +1,396 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Andrew Tridgell 1992-1999 + Copyright (C) John H Terpstra 1996-1999 + Copyright (C) Luke Kenneth Casson Leighton 1996-1999 + Copyright (C) Paul Ashton 1998 - 1999 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _SMB_MACROS_H +#define _SMB_MACROS_H + +/* Misc bit macros */ +#define BOOLSTR(b) ((b) ? "Yes" : "No") +#define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0) + +/* for readability... */ +#define IS_DOS_READONLY(test_mode) (((test_mode) & aRONLY) != 0) +#define IS_DOS_DIR(test_mode) (((test_mode) & aDIR) != 0) +#define IS_DOS_ARCHIVE(test_mode) (((test_mode) & aARCH) != 0) +#define IS_DOS_SYSTEM(test_mode) (((test_mode) & aSYSTEM) != 0) +#define IS_DOS_HIDDEN(test_mode) (((test_mode) & aHIDDEN) != 0) + +#ifndef SAFE_FREE /* Oh no this is also defined in tdb.h */ + +/** + * Free memory if the pointer and zero the pointer. + * + * @note You are explicitly allowed to pass NULL pointers -- they will + * always be ignored. + **/ +#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) +#endif + +/* assert macros */ +#ifdef DEVELOPER +#define SMB_ASSERT(b) ( (b) ? (void)0 : \ + (DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \ + __FILE__, __LINE__, #b)), smb_panic("assert failed: " #b))) +#else +/* redefine the assert macro for non-developer builds */ +#define SMB_ASSERT(b) ( (b) ? (void)0 : \ + (DEBUG(0,("PANIC: assert failed at %s(%d): %s\n", \ + __FILE__, __LINE__, #b)))) +#endif + +#define SMB_WARN(condition, message) \ + ((condition) ? (void)0 : \ + DEBUG(0, ("WARNING: %s: %s\n", #condition, message))) + +#define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) + +/* these are useful macros for checking validity of handles */ +#define IS_IPC(conn) ((conn) && (conn)->ipc) +#define IS_PRINT(conn) ((conn) && (conn)->printer) +/* you must add the following extern declaration to files using this macro + * (do not add it to the macro as that causes nested extern declaration warnings) + * extern struct current_user current_user; + */ +#define FSP_BELONGS_CONN(fsp,conn) do {\ + if (!((fsp) && (conn) && ((conn)==(fsp)->conn) && (current_user.vuid==(fsp)->vuid))) \ + return ERROR_NT(NT_STATUS_INVALID_HANDLE); \ + } while(0) + +/* you must add the following extern declaration to files using this macro + * (do not add it to the macro as that causes nested extern declaration warnings) + * extern struct current_user current_user; + */ +#define CHECK_FSP(fsp,conn) do {\ + if (!(fsp) || !(conn)) \ + return ERROR_NT(NT_STATUS_INVALID_HANDLE); \ + else if (((conn) != (fsp)->conn) || current_user.vuid != (fsp)->vuid) \ + return ERROR_NT(NT_STATUS_INVALID_HANDLE); \ + else if ((fsp)->is_directory) \ + return ERROR_NT(NT_STATUS_INVALID_DEVICE_REQUEST); \ + else if ((fsp)->fh->fd == -1) \ + return ERROR_NT(NT_STATUS_ACCESS_DENIED); \ + (fsp)->num_smb_operations++;\ + } while(0) + +#define CHECK_READ(fsp,inbuf) (((fsp)->fh->fd != -1) && ((fsp)->can_read || \ + ((SVAL((inbuf),smb_flg2) & FLAGS2_READ_PERMIT_EXECUTE) && \ + (fsp->access_mask & FILE_EXECUTE)))) + +#define CHECK_WRITE(fsp) ((fsp)->can_write && ((fsp)->fh->fd != -1)) + +#define ERROR_WAS_LOCK_DENIED(status) (NT_STATUS_EQUAL((status), NT_STATUS_LOCK_NOT_GRANTED) || \ + NT_STATUS_EQUAL((status), NT_STATUS_FILE_LOCK_CONFLICT) ) + +/* the service number for the [globals] defaults */ +#define GLOBAL_SECTION_SNUM (-1) +/* translates a connection number into a service number */ +#define SNUM(conn) ((conn)?(conn)->params->service:GLOBAL_SECTION_SNUM) + + +/* access various service details */ +#define SERVICE(snum) (lp_servicename(snum)) +#define PRINTERNAME(snum) (lp_printername(snum)) +#define CAN_WRITE(conn) (!conn->read_only) +#define VALID_SNUM(snum) (lp_snum_ok(snum)) +#define GUEST_OK(snum) (VALID_SNUM(snum) && lp_guest_ok(snum)) +#define GUEST_ONLY(snum) (VALID_SNUM(snum) && lp_guest_only(snum)) +#define CAN_SETDIR(snum) (!lp_no_set_dir(snum)) +#define CAN_PRINT(conn) ((conn) && lp_print_ok(SNUM(conn))) +#define MAP_HIDDEN(conn) ((conn) && lp_map_hidden(SNUM(conn))) +#define MAP_SYSTEM(conn) ((conn) && lp_map_system(SNUM(conn))) +#define MAP_ARCHIVE(conn) ((conn) && lp_map_archive(SNUM(conn))) +#define IS_HIDDEN_PATH(conn,path) ((conn) && is_in_path((path),(conn)->hide_list,(conn)->case_sensitive)) +#define IS_VETO_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_list,(conn)->case_sensitive)) +#define IS_VETO_OPLOCK_PATH(conn,path) ((conn) && is_in_path((path),(conn)->veto_oplock_list,(conn)->case_sensitive)) + +/* + * Used by the stat cache code to check if a returned + * stat structure is valid. + */ + +#define VALID_STAT(st) ((st).st_nlink != 0) +#define VALID_STAT_OF_DIR(st) (VALID_STAT(st) && S_ISDIR((st).st_mode)) +#define SET_STAT_INVALID(st) ((st).st_nlink = 0) + +#ifndef MIN +#define MIN(a,b) ((a)<(b)?(a):(b)) +#endif +#ifndef MAX +#define MAX(a,b) ((a)>(b)?(a):(b)) +#endif + +#ifndef ABS +#define ABS(a) ((a)>0?(a):(-(a))) +#endif + +/* Macros to get at offsets within smb_lkrng and smb_unlkrng + structures. We cannot define these as actual structures + due to possible differences in structure packing + on different machines/compilers. */ + +#define SMB_LPID_OFFSET(indx) (10 * (indx)) +#define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx))) +#define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx))) +#define SMB_LARGE_LPID_OFFSET(indx) (20 * (indx)) +#define SMB_LARGE_LKOFF_OFFSET_HIGH(indx) (4 + (20 * (indx))) +#define SMB_LARGE_LKOFF_OFFSET_LOW(indx) (8 + (20 * (indx))) +#define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx))) +#define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx))) + +#define ERROR_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__) +#define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__) +#define ERROR_FORCE_NT(status) error_packet(outbuf,-1,-1,status,__LINE__,__FILE__) +#define ERROR_BOTH(status,class,code) error_packet(outbuf,class,code,status,__LINE__,__FILE__) + +#define reply_nterror(req,status) reply_nt_error(req,status,__LINE__,__FILE__) +#define reply_force_nterror(req,status) reply_force_nt_error(req,status,__LINE__,__FILE__) +#define reply_doserror(req,eclass,ecode) reply_dos_error(req,eclass,ecode,__LINE__,__FILE__) +#define reply_botherror(req,status,eclass,ecode) reply_both_error(req,eclass,ecode,status,__LINE__,__FILE__) +#define reply_unixerror(req,defclass,deferror) reply_unix_error(req,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__) + +#if 0 +/* defined in IDL */ +/* these are the datagram types */ +#define DGRAM_DIRECT_UNIQUE 0x10 +#endif + +#define SMB_ROUNDUP(x,r) ( ((x)%(r)) ? ( (((x)+(r))/(r))*(r) ) : (x)) + +/* Extra macros added by Ying Chen at IBM - speed increase by inlining. */ +#define smb_buf(buf) (((char *)(buf)) + smb_size + CVAL(buf,smb_wct)*2) +#define smb_buflen(buf) (SVAL(buf,smb_vwv0 + (int)CVAL(buf, smb_wct)*2)) + +/* the remaining number of bytes in smb buffer 'buf' from pointer 'p'. */ +#define smb_bufrem(buf, p) (smb_buflen(buf)-PTR_DIFF(p, smb_buf(buf))) + +/* Note that chain_size must be available as an extern int to this macro. */ +#define smb_offset(p,buf) (PTR_DIFF(p,buf+4) + chain_size) + +#define smb_len(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|((PVAL(buf,1)&1)<<16)) +#define _smb_setlen(buf,len) do { buf[0] = 0; buf[1] = ((len)&0x10000)>>16; \ + buf[2] = ((len)&0xFF00)>>8; buf[3] = (len)&0xFF; } while (0) + +#define smb_len_large(buf) (PVAL(buf,3)|(PVAL(buf,2)<<8)|(PVAL(buf,1)<<16)) +#define _smb_setlen_large(buf,len) do { buf[0] = 0; buf[1] = ((len)&0xFF0000)>>16; \ + buf[2] = ((len)&0xFF00)>>8; buf[3] = (len)&0xFF; } while (0) + +#define ENCRYPTION_REQUIRED(conn) ((conn) ? ((conn)->encrypt_level == Required) : false) +#define IS_CONN_ENCRYPTED(conn) ((conn) ? (conn)->encrypted_tid : false) + +/******************************************************************* +find the difference in milliseconds between two struct timeval +values +********************************************************************/ + +#define TvalDiff(tvalold,tvalnew) \ + (((tvalnew)->tv_sec - (tvalold)->tv_sec)*1000 + \ + ((int)(tvalnew)->tv_usec - (int)(tvalold)->tv_usec)/1000) + +/**************************************************************************** +true if two IPv4 addresses are equal +****************************************************************************/ + +#define ip_equal_v4(ip1,ip2) ((ip1).s_addr == (ip2).s_addr) + +/***************************************************************** + splits out the last subkey of a key + *****************************************************************/ + +#define reg_get_subkey(full_keyname, key_name, subkey_name) \ + split_at_last_component(full_keyname, key_name, '\\', subkey_name) + +/**************************************************************************** + Return True if the offset is at zero. +****************************************************************************/ + +#define dptr_zero(buf) (IVAL(buf,1) == 0) + +/******************************************************************* +copy an IP address from one buffer to another +********************************************************************/ + +#define putip(dest,src) memcpy(dest,src,4) + +/******************************************************************* + Return True if a server has CIFS UNIX capabilities. +********************************************************************/ + +#define SERVER_HAS_UNIX_CIFS(c) ((c)->capabilities & CAP_UNIX) + +/**************************************************************************** + Make a filename into unix format. +****************************************************************************/ + +#define IS_DIRECTORY_SEP(c) ((c) == '\\' || (c) == '/') +#define unix_format(fname) string_replace(fname,'\\','/') +#define unix_format_w(fname) string_replace_w(fname, UCS2_CHAR('\\'), UCS2_CHAR('/')) + +/**************************************************************************** + Make a file into DOS format. +****************************************************************************/ + +#define dos_format(fname) string_replace(fname,'/','\\') + +/***************************************************************************** + Check to see if we are a DC for this domain +*****************************************************************************/ + +#define IS_DC (lp_server_role()==ROLE_DOMAIN_PDC || lp_server_role()==ROLE_DOMAIN_BDC) + +/***************************************************************************** + Safe allocation macros. +*****************************************************************************/ + +#define SMB_MALLOC_ARRAY(type,count) (type *)malloc_array(sizeof(type),(count)) +#define SMB_MEMALIGN_ARRAY(type,align,count) (type *)memalign_array(sizeof(type),align,(count)) +#define SMB_REALLOC(p,s) Realloc((p),(s),True) /* Always frees p on error or s == 0 */ +#define SMB_REALLOC_KEEP_OLD_ON_ERROR(p,s) Realloc((p),(s),False) /* Never frees p on error or s == 0 */ +#define SMB_REALLOC_ARRAY(p,type,count) (type *)realloc_array((p),sizeof(type),(count),True) /* Always frees p on error or s == 0 */ +#define SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(p,type,count) (type *)realloc_array((p),sizeof(type),(count),False) /* Never frees p on error or s == 0 */ +#define SMB_CALLOC_ARRAY(type,count) (type *)calloc_array(sizeof(type),(count)) +#define SMB_XMALLOC_P(type) (type *)smb_xmalloc_array(sizeof(type),1) +#define SMB_XMALLOC_ARRAY(type,count) (type *)smb_xmalloc_array(sizeof(type),(count)) + +/* The new talloc is paranoid malloc checker safe. */ + +#if 0 + +Disable these now we have checked all code paths and ensured +NULL returns on zero request. JRA. + +#define TALLOC(ctx, size) talloc_zeronull(ctx, size, __location__) +#define TALLOC_P(ctx, type) (type *)talloc_zeronull(ctx, sizeof(type), #type) +#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array_zeronull(ctx, sizeof(type), count, #type) +#define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup_zeronull(ctx, ptr, size, __location__) +#define TALLOC_ZERO(ctx, size) _talloc_zero_zeronull(ctx, size, __location__) +#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero_zeronull(ctx, sizeof(type), #type) +#define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array_zeronull(ctx, sizeof(type), count, #type) +#define TALLOC_SIZE(ctx, size) talloc_zeronull(ctx, size, __location__) +#define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero_zeronull(ctx, size, __location__) + +#else + +#define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__) +#define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) +#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type) +#define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__) +#define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__) +#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type) +#define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type) +#define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__) +#define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__) + +#endif + +#define TALLOC_REALLOC(ctx, ptr, count) _talloc_realloc(ctx, ptr, count, __location__) +#define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type *)_talloc_realloc_array(ctx, ptr, sizeof(type), count, #type) +#define talloc_destroy(ctx) talloc_free(ctx) +#define TALLOC_FREE(ctx) do { if ((ctx) != NULL) {talloc_free(ctx); ctx=NULL;} } while(0) + +/* only define PARANOID_MALLOC_CHECKER with --enable-developer */ + +#if defined(DEVELOPER) +# define PARANOID_MALLOC_CHECKER 1 +#endif + +#if defined(PARANOID_MALLOC_CHECKER) + +#define PRS_ALLOC_MEM(ps, type, count) (type *)prs_alloc_mem_((ps),sizeof(type),(count)) + +/* Get medieval on our ass about malloc.... */ + +/* Restrictions on malloc/realloc/calloc. */ +#ifdef malloc +#undef malloc +#endif +#define malloc(s) __ERROR_DONT_USE_MALLOC_DIRECTLY + +#ifdef realloc +#undef realloc +#endif +#define realloc(p,s) __ERROR_DONT_USE_REALLOC_DIRECTLY + +#ifdef calloc +#undef calloc +#endif +#define calloc(n,s) __ERROR_DONT_USE_CALLOC_DIRECTLY + +#ifdef strndup +#undef strndup +#endif +#define strndup(s,n) __ERROR_DONT_USE_STRNDUP_DIRECTLY + +#ifdef strdup +#undef strdup +#endif +#define strdup(s) __ERROR_DONT_USE_STRDUP_DIRECTLY + +#define SMB_MALLOC(s) malloc_(s) +#define SMB_MALLOC_P(type) (type *)malloc_(sizeof(type)) + +#define SMB_STRDUP(s) smb_xstrdup(s) +#define SMB_STRNDUP(s,n) smb_xstrndup(s,n) + +#else + +#define PRS_ALLOC_MEM(ps, type, count) (type *)prs_alloc_mem((ps),sizeof(type),(count)) + +/* Regular malloc code. */ + +#define SMB_MALLOC(s) malloc(s) +#define SMB_MALLOC_P(type) (type *)malloc(sizeof(type)) + +#define SMB_STRDUP(s) strdup(s) +#define SMB_STRNDUP(s,n) strndup(s,n) + +#endif + +#define ADD_TO_ARRAY(mem_ctx, type, elem, array, num) \ +do { \ + *(array) = ((mem_ctx) != NULL) ? \ + TALLOC_REALLOC_ARRAY(mem_ctx, (*(array)), type, (*(num))+1) : \ + SMB_REALLOC_ARRAY((*(array)), type, (*(num))+1); \ + SMB_ASSERT((*(array)) != NULL); \ + (*(array))[*(num)] = (elem); \ + (*(num)) += 1; \ +} while (0) + +#define ADD_TO_LARGE_ARRAY(mem_ctx, type, elem, array, num, size) \ + add_to_large_array((mem_ctx), sizeof(type), &(elem), (void *)(array), (num), (size)); + +#ifndef ISDOT +#define ISDOT(p) (*(p) == '.' && *((p) + 1) == '\0') +#endif /* ISDOT */ + +#ifndef ISDOTDOT +#define ISDOTDOT(p) (*(p) == '.' && *((p) + 1) == '.' && *((p) + 2) == '\0') +#endif /* ISDOTDOT */ + +#ifndef toupper_ascii_fast +/* Warning - this must only be called with 0 <= c < 128. IT WILL + * GIVE GARBAGE if c > 128 or c < 0. JRA. + */ +extern char toupper_ascii_fast_table[]; +#define toupper_ascii_fast(c) toupper_ascii_fast_table[(unsigned int)(c)]; +#endif + +#endif /* _SMB_MACROS_H */ diff --git a/source3/include/smb_share_modes.h b/source3/include/smb_share_modes.h new file mode 100644 index 0000000000..101bec8245 --- /dev/null +++ b/source3/include/smb_share_modes.h @@ -0,0 +1,105 @@ +/* + Samba share mode database library. + + Copyright (C) Jeremy Allison 2005. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _SMB_SHARE_MODES_H_ +#define _SMB_STATE_MODES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif + +/* Opaque database context handle. */ +struct smbdb_ctx; + +/* Share mode entry. */ +/* + We use 64 bit types for device and inode as + we don't know what size mode Samba has been + compiled in - dev/ino may be 32, may be 64 + bits. This interface copes with either. +*/ + +struct smb_share_mode_entry { + uint64_t dev; + uint64_t ino; + uint32_t share_access; + uint32_t access_mask; + struct timeval open_time; + uint32_t file_id; + struct server_id pid; +}; + +/* + * open/close sharemode database. + */ + +struct smbdb_ctx *smb_share_mode_db_open(const char *db_path); +int smb_share_mode_db_close(struct smbdb_ctx *db_ctx); + +/* + * lock/unlock entry in sharemode database. + */ + +int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino); + +int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino); + +/* + * Share mode database accessor functions. + */ + +int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + struct smb_share_mode_entry **pp_list, + unsigned char *p_delete_on_close); + +int smb_create_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *set_entry, + const char *path); + +int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *set_entry); + +int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *set_entry, + const struct smb_share_mode_entry *new_entry); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/source3/include/smbldap.h b/source3/include/smbldap.h new file mode 100644 index 0000000000..a2cb8c5eea --- /dev/null +++ b/source3/include/smbldap.h @@ -0,0 +1,234 @@ +/* + Unix SMB/CIFS mplementation. + LDAP protocol helper functions for SAMBA + Copyright (C) Gerald Carter 2001-2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +*/ + +#ifndef _SMBLDAP_H +#define _SMBLDAP_H + +struct smbldap_state; + +#ifdef HAVE_LDAP + +/* specify schema versions between 2.2. and 3.0 */ + +#define SCHEMAVER_SAMBAACCOUNT 1 +#define SCHEMAVER_SAMBASAMACCOUNT 2 + +/* objectclass names */ + +#define LDAP_OBJ_SAMBASAMACCOUNT "sambaSamAccount" +#define LDAP_OBJ_SAMBAACCOUNT "sambaAccount" +#define LDAP_OBJ_GROUPMAP "sambaGroupMapping" +#define LDAP_OBJ_DOMINFO "sambaDomain" +#define LDAP_OBJ_IDPOOL "sambaUnixIdPool" +#define LDAP_OBJ_IDMAP_ENTRY "sambaIdmapEntry" +#define LDAP_OBJ_SID_ENTRY "sambaSidEntry" +#define LDAP_OBJ_TRUST_PASSWORD "sambaTrustPassword" +#define LDAP_OBJ_TRUSTDOM_PASSWORD "sambaTrustedDomainPassword" + +#define LDAP_OBJ_ACCOUNT "account" +#define LDAP_OBJ_POSIXACCOUNT "posixAccount" +#define LDAP_OBJ_POSIXGROUP "posixGroup" +#define LDAP_OBJ_OU "organizationalUnit" + +/* some generic attributes that get reused a lot */ + +#define LDAP_ATTRIBUTE_SID "sambaSID" +#define LDAP_ATTRIBUTE_UIDNUMBER "uidNumber" +#define LDAP_ATTRIBUTE_GIDNUMBER "gidNumber" +#define LDAP_ATTRIBUTE_SID_LIST "sambaSIDList" + +/* attribute map table indexes */ + +#define LDAP_ATTR_LIST_END 0 +#define LDAP_ATTR_UID 1 +#define LDAP_ATTR_UIDNUMBER 2 +#define LDAP_ATTR_GIDNUMBER 3 +#define LDAP_ATTR_UNIX_HOME 4 +#define LDAP_ATTR_PWD_LAST_SET 5 +#define LDAP_ATTR_PWD_CAN_CHANGE 6 +#define LDAP_ATTR_PWD_MUST_CHANGE 7 +#define LDAP_ATTR_LOGON_TIME 8 +#define LDAP_ATTR_LOGOFF_TIME 9 +#define LDAP_ATTR_KICKOFF_TIME 10 +#define LDAP_ATTR_CN 11 +#define LDAP_ATTR_DISPLAY_NAME 12 +#define LDAP_ATTR_HOME_PATH 13 +#define LDAP_ATTR_LOGON_SCRIPT 14 +#define LDAP_ATTR_PROFILE_PATH 15 +#define LDAP_ATTR_DESC 16 +#define LDAP_ATTR_USER_WKS 17 +#define LDAP_ATTR_USER_SID 18 +#define LDAP_ATTR_USER_RID 18 +#define LDAP_ATTR_PRIMARY_GROUP_SID 19 +#define LDAP_ATTR_PRIMARY_GROUP_RID 20 +#define LDAP_ATTR_LMPW 21 +#define LDAP_ATTR_NTPW 22 +#define LDAP_ATTR_DOMAIN 23 +#define LDAP_ATTR_OBJCLASS 24 +#define LDAP_ATTR_ACB_INFO 25 +#define LDAP_ATTR_NEXT_USERRID 26 +#define LDAP_ATTR_NEXT_GROUPRID 27 +#define LDAP_ATTR_DOM_SID 28 +#define LDAP_ATTR_HOME_DRIVE 29 +#define LDAP_ATTR_GROUP_SID 30 +#define LDAP_ATTR_GROUP_TYPE 31 +#define LDAP_ATTR_SID 32 +#define LDAP_ATTR_ALGORITHMIC_RID_BASE 33 +#define LDAP_ATTR_NEXT_RID 34 +#define LDAP_ATTR_BAD_PASSWORD_COUNT 35 +#define LDAP_ATTR_LOGON_COUNT 36 +#define LDAP_ATTR_MUNGED_DIAL 37 +#define LDAP_ATTR_BAD_PASSWORD_TIME 38 +#define LDAP_ATTR_PWD_HISTORY 39 +#define LDAP_ATTR_SID_LIST 40 +#define LDAP_ATTR_MOD_TIMESTAMP 41 +#define LDAP_ATTR_LOGON_HOURS 42 +#define LDAP_ATTR_TRUST_PASSWD_FLAGS 43 +#define LDAP_ATTR_SN 44 + + +typedef struct _attrib_map_entry { + int attrib; + const char *name; +} ATTRIB_MAP_ENTRY; + + +/* structures */ + +extern ATTRIB_MAP_ENTRY attrib_map_v22[]; +extern ATTRIB_MAP_ENTRY attrib_map_to_delete_v22[]; +extern ATTRIB_MAP_ENTRY attrib_map_v30[]; +extern ATTRIB_MAP_ENTRY attrib_map_to_delete_v30[]; +extern ATTRIB_MAP_ENTRY dominfo_attr_list[]; +extern ATTRIB_MAP_ENTRY groupmap_attr_list[]; +extern ATTRIB_MAP_ENTRY groupmap_attr_list_to_delete[]; +extern ATTRIB_MAP_ENTRY idpool_attr_list[]; +extern ATTRIB_MAP_ENTRY sidmap_attr_list[]; +extern ATTRIB_MAP_ENTRY trustpw_attr_list[]; + + +/* Function declarations -- not included in proto.h so we don't + have to worry about LDAP structure types */ + +NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, + struct event_context *event_ctx, + const char *location, + struct smbldap_state **smbldap_state); + +const char* get_attr_key2string( ATTRIB_MAP_ENTRY table[], int key ); +const char** get_attr_list( TALLOC_CTX *mem_ctx, ATTRIB_MAP_ENTRY table[] ); +void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value); +void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing, + LDAPMod ***mods, + const char *attribute, const char *newval); +bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry, + const char *attribute, char *value, + int max_len); +char *smbldap_get_dn(LDAP *ld, LDAPMessage *entry); +int smbldap_modify(struct smbldap_state *ldap_state, + const char *dn, + LDAPMod *attrs[]); + +/** + * Struct to keep the state for all the ldap stuff + * + */ + +struct smbldap_state { + LDAP *ldap_struct; + pid_t pid; + time_t last_ping; + /* retrive-once info */ + const char *uri; + + /* credentials */ + bool anonymous; + char *bind_dn; + char *bind_secret; + + bool paged_results; + + unsigned int num_failures; + + time_t last_use; + struct event_context *event_context; + struct timed_event *idle_event; + + struct timeval last_rebind; +}; + +/* struct used by both pdb_ldap.c and pdb_nds.c */ + +struct ldapsam_privates { + struct smbldap_state *smbldap_state; + + /* Former statics */ + LDAPMessage *result; + LDAPMessage *entry; + int index; + + const char *domain_name; + DOM_SID domain_sid; + + /* configuration items */ + int schema_ver; + + char *domain_dn; + + /* Is this NDS ldap? */ + int is_nds_ldap; + + /* ldap server location parameter */ + char *location; +}; + +/* Functions shared between pdb_ldap.c and pdb_nds.c. */ +NTSTATUS pdb_init_ldapsam_compat( struct pdb_methods **pdb_method, const char *location); +void private_data_free_fn(void **result); +int ldapsam_search_suffix_by_name(struct ldapsam_privates *ldap_state, + const char *user, + LDAPMessage ** result, + const char **attr); +NTSTATUS pdb_init_ldapsam( struct pdb_methods **pdb_method, const char *location); +const char** get_userattr_list( TALLOC_CTX *mem_ctx, int schema_ver ); + +char * smbldap_talloc_single_attribute(LDAP *ldap_struct, LDAPMessage *entry, + const char *attribute, + TALLOC_CTX *mem_ctx); +void talloc_autofree_ldapmsg(TALLOC_CTX *mem_ctx, LDAPMessage *result); +void talloc_autofree_ldapmod(TALLOC_CTX *mem_ctx, LDAPMod **mod); +const char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld, + LDAPMessage *entry); + + +#else +#define LDAP void +#define LDAPMod void +#define LDAP_CONST const +#define LDAPControl void +struct berval; +struct ldapsam_privates; +#endif /* HAVE_LDAP */ + +#define LDAP_DEFAULT_TIMEOUT 15 +#define LDAP_CONNECTION_DEFAULT_TIMEOUT 2 +#define LDAP_PAGE_SIZE 1024 + +#endif /* _SMBLDAP_H */ diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h new file mode 100644 index 0000000000..f58a6452bf --- /dev/null +++ b/source3/include/smbprofile.h @@ -0,0 +1,866 @@ +#ifndef _PROFILE_H_ +#define _PROFILE_H_ +/* + Unix SMB/CIFS implementation. + store smbd profiling information in shared memory + Copyright (C) Andrew Tridgell 1999 + Copyright (C) James Peach 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +*/ + +/* this file defines the profile structure in the profile shared + memory area */ + +#define PROF_SHMEM_KEY ((key_t)0x07021999) +#define PROF_SHM_MAGIC 0x6349985 +#define PROF_SHM_VERSION 11 + +/* time values in the following structure are in microseconds */ + +#define __profile_stats_value(which, domain) domain[which] + +enum profile_stats_values +{ + PR_VALUE_SMBD_IDLE = 0, +#define smbd_idle_count __profile_stats_value(PR_VALUE_SMBD_IDLE, count) +#define smbd_idle_time __profile_stats_value(PR_VALUE_SMBD_IDLE, time) + +/* system call counters */ + PR_VALUE_SYSCALL_OPENDIR, +#define syscall_opendir_count __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, count) +#define syscall_opendir_time __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, time) + + PR_VALUE_SYSCALL_READDIR, +#define syscall_readdir_count __profile_stats_value(PR_VALUE_SYSCALL_READDIR, count) +#define syscall_readdir_time __profile_stats_value(PR_VALUE_SYSCALL_READDIR, time) + + PR_VALUE_SYSCALL_SEEKDIR, +#define syscall_seekdir_count __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, count) +#define syscall_seekdir_time __profile_stats_value(PR_VALUE_SYSCALL_SEEKDIR, time) + + PR_VALUE_SYSCALL_TELLDIR, +#define syscall_telldir_count __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, count) +#define syscall_telldir_time __profile_stats_value(PR_VALUE_SYSCALL_TELLDIR, time) + + PR_VALUE_SYSCALL_REWINDDIR, +#define syscall_rewinddir_count __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, count) +#define syscall_rewinddir_time __profile_stats_value(PR_VALUE_SYSCALL_REWINDDIR, time) + + PR_VALUE_SYSCALL_MKDIR, +#define syscall_mkdir_count __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, count) +#define syscall_mkdir_time __profile_stats_value(PR_VALUE_SYSCALL_MKDIR, time) + + PR_VALUE_SYSCALL_RMDIR, +#define syscall_rmdir_count __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, count) +#define syscall_rmdir_time __profile_stats_value(PR_VALUE_SYSCALL_RMDIR, time) + + PR_VALUE_SYSCALL_CLOSEDIR, +#define syscall_closedir_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, count) +#define syscall_closedir_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSEDIR, time) + + PR_VALUE_SYSCALL_OPEN, +#define syscall_open_count __profile_stats_value(PR_VALUE_SYSCALL_OPEN, count) +#define syscall_open_time __profile_stats_value(PR_VALUE_SYSCALL_OPEN, time) + + PR_VALUE_SYSCALL_CLOSE, +#define syscall_close_count __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, count) +#define syscall_close_time __profile_stats_value(PR_VALUE_SYSCALL_CLOSE, time) + + PR_VALUE_SYSCALL_READ, +#define syscall_read_count __profile_stats_value(PR_VALUE_SYSCALL_READ, count) +#define syscall_read_time __profile_stats_value(PR_VALUE_SYSCALL_READ, time) + + PR_VALUE_SYSCALL_PREAD, +#define syscall_pread_count __profile_stats_value(PR_VALUE_SYSCALL_PREAD, count) +#define syscall_pread_time __profile_stats_value(PR_VALUE_SYSCALL_PREAD, time) + + PR_VALUE_SYSCALL_WRITE, +#define syscall_write_count __profile_stats_value(PR_VALUE_SYSCALL_WRITE, count) +#define syscall_write_time __profile_stats_value(PR_VALUE_SYSCALL_WRITE, time) + + PR_VALUE_SYSCALL_PWRITE, +#define syscall_pwrite_count __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, count) +#define syscall_pwrite_time __profile_stats_value(PR_VALUE_SYSCALL_PWRITE, time) + + PR_VALUE_SYSCALL_LSEEK, +#define syscall_lseek_count __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, count) +#define syscall_lseek_time __profile_stats_value(PR_VALUE_SYSCALL_LSEEK, time) + + PR_VALUE_SYSCALL_SENDFILE, +#define syscall_sendfile_count __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, count) +#define syscall_sendfile_time __profile_stats_value(PR_VALUE_SYSCALL_SENDFILE, time) + + PR_VALUE_SYSCALL_RECVFILE, +#define syscall_recvfile_count __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, count) +#define syscall_recvfile_time __profile_stats_value(PR_VALUE_SYSCALL_RECVFILE, time) + + PR_VALUE_SYSCALL_RENAME, +#define syscall_rename_count __profile_stats_value(PR_VALUE_SYSCALL_RENAME, count) +#define syscall_rename_time __profile_stats_value(PR_VALUE_SYSCALL_RENAME, time) + + PR_VALUE_SYSCALL_FSYNC, +#define syscall_fsync_count __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, count) +#define syscall_fsync_time __profile_stats_value(PR_VALUE_SYSCALL_FSYNC, time) + + PR_VALUE_SYSCALL_STAT, +#define syscall_stat_count __profile_stats_value(PR_VALUE_SYSCALL_STAT, count) +#define syscall_stat_time __profile_stats_value(PR_VALUE_SYSCALL_STAT, time) + + PR_VALUE_SYSCALL_FSTAT, +#define syscall_fstat_count __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, count) +#define syscall_fstat_time __profile_stats_value(PR_VALUE_SYSCALL_FSTAT, time) + + PR_VALUE_SYSCALL_LSTAT, +#define syscall_lstat_count __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, count) +#define syscall_lstat_time __profile_stats_value(PR_VALUE_SYSCALL_LSTAT, time) + + PR_VALUE_SYSCALL_UNLINK, +#define syscall_unlink_count __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, count) +#define syscall_unlink_time __profile_stats_value(PR_VALUE_SYSCALL_UNLINK, time) + + PR_VALUE_SYSCALL_CHMOD, +#define syscall_chmod_count __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, count) +#define syscall_chmod_time __profile_stats_value(PR_VALUE_SYSCALL_CHMOD, time) + + PR_VALUE_SYSCALL_FCHMOD, +#define syscall_fchmod_count __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, count) +#define syscall_fchmod_time __profile_stats_value(PR_VALUE_SYSCALL_FCHMOD, time) + + PR_VALUE_SYSCALL_CHOWN, +#define syscall_chown_count __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, count) +#define syscall_chown_time __profile_stats_value(PR_VALUE_SYSCALL_CHOWN, time) + + PR_VALUE_SYSCALL_FCHOWN, +#define syscall_fchown_count __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, count) +#define syscall_fchown_time __profile_stats_value(PR_VALUE_SYSCALL_FCHOWN, time) + + PR_VALUE_SYSCALL_LCHOWN, +#define syscall_lchown_count __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, count) +#define syscall_lchown_time __profile_stats_value(PR_VALUE_SYSCALL_LCHOWN, time) + + PR_VALUE_SYSCALL_CHDIR, +#define syscall_chdir_count __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, count) +#define syscall_chdir_time __profile_stats_value(PR_VALUE_SYSCALL_CHDIR, time) + + PR_VALUE_SYSCALL_GETWD, +#define syscall_getwd_count __profile_stats_value(PR_VALUE_SYSCALL_GETWD, count) +#define syscall_getwd_time __profile_stats_value(PR_VALUE_SYSCALL_GETWD, time) + + PR_VALUE_SYSCALL_NTIMES, +#define syscall_ntimes_count __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, count) +#define syscall_ntimes_time __profile_stats_value(PR_VALUE_SYSCALL_NTIMES, time) + + PR_VALUE_SYSCALL_FTRUNCATE, +#define syscall_ftruncate_count __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, count) +#define syscall_ftruncate_time __profile_stats_value(PR_VALUE_SYSCALL_FTRUNCATE, time) + + PR_VALUE_SYSCALL_FCNTL_LOCK, +#define syscall_fcntl_lock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, count) +#define syscall_fcntl_lock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_LOCK, time) + + PR_VALUE_SYSCALL_KERNEL_FLOCK, +#define syscall_kernel_flock_count __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, count) +#define syscall_kernel_flock_time __profile_stats_value(PR_VALUE_SYSCALL_KERNEL_FLOCK, time) + + PR_VALUE_SYSCALL_LINUX_SETLEASE, +#define syscall_linux_setlease_count __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, count) +#define syscall_linux_setlease_time __profile_stats_value(PR_VALUE_SYSCALL_LINUX_SETLEASE, time) + + PR_VALUE_SYSCALL_FCNTL_GETLOCK, +#define syscall_fcntl_getlock_count __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, count) +#define syscall_fcntl_getlock_time __profile_stats_value(PR_VALUE_SYSCALL_FCNTL_GETLOCK, time) + + PR_VALUE_SYSCALL_READLINK, +#define syscall_readlink_count __profile_stats_value(PR_VALUE_SYSCALL_READLINK, count) +#define syscall_readlink_time __profile_stats_value(PR_VALUE_SYSCALL_READLINK, time) + + PR_VALUE_SYSCALL_SYMLINK, +#define syscall_symlink_count __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, count) +#define syscall_symlink_time __profile_stats_value(PR_VALUE_SYSCALL_SYMLINK, time) + + PR_VALUE_SYSCALL_LINK, +#define syscall_link_count __profile_stats_value(PR_VALUE_SYSCALL_LINK, count) +#define syscall_link_time __profile_stats_value(PR_VALUE_SYSCALL_LINK, time) + + PR_VALUE_SYSCALL_MKNOD, +#define syscall_mknod_count __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, count) +#define syscall_mknod_time __profile_stats_value(PR_VALUE_SYSCALL_MKNOD, time) + + PR_VALUE_SYSCALL_REALPATH, +#define syscall_realpath_count __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, count) +#define syscall_realpath_time __profile_stats_value(PR_VALUE_SYSCALL_REALPATH, time) + + PR_VALUE_SYSCALL_GET_QUOTA, +#define syscall_get_quota_count __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, count) +#define syscall_get_quota_time __profile_stats_value(PR_VALUE_SYSCALL_GET_QUOTA, time) + + PR_VALUE_SYSCALL_SET_QUOTA, +#define syscall_set_quota_count __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, count) +#define syscall_set_quota_time __profile_stats_value(PR_VALUE_SYSCALL_SET_QUOTA, time) + +/* counters for individual SMB types */ + PR_VALUE_SMBMKDIR, +#define SMBmkdir_count __profile_stats_value(PR_VALUE_SMBMKDIR, count) +#define SMBmkdir_time __profile_stats_value(PR_VALUE_SMBMKDIR, time) + + PR_VALUE_SMBRMDIR, +#define SMBrmdir_count __profile_stats_value(PR_VALUE_SMBRMDIR, count) +#define SMBrmdir_time __profile_stats_value(PR_VALUE_SMBRMDIR, time) + + PR_VALUE_SMBOPEN, +#define SMBopen_count __profile_stats_value(PR_VALUE_SMBOPEN, count) +#define SMBopen_time __profile_stats_value(PR_VALUE_SMBOPEN, time) + + PR_VALUE_SMBCREATE, +#define SMBcreate_count __profile_stats_value(PR_VALUE_SMBCREATE, count) +#define SMBcreate_time __profile_stats_value(PR_VALUE_SMBCREATE, time) + + PR_VALUE_SMBCLOSE, +#define SMBclose_count __profile_stats_value(PR_VALUE_SMBCLOSE, count) +#define SMBclose_time __profile_stats_value(PR_VALUE_SMBCLOSE, time) + + PR_VALUE_SMBFLUSH, +#define SMBflush_count __profile_stats_value(PR_VALUE_SMBFLUSH, count) +#define SMBflush_time __profile_stats_value(PR_VALUE_SMBFLUSH, time) + + PR_VALUE_SMBUNLINK, +#define SMBunlink_count __profile_stats_value(PR_VALUE_SMBUNLINK, count) +#define SMBunlink_time __profile_stats_value(PR_VALUE_SMBUNLINK, time) + + PR_VALUE_SMBMV, +#define SMBmv_count __profile_stats_value(PR_VALUE_SMBMV, count) +#define SMBmv_time __profile_stats_value(PR_VALUE_SMBMV, time) + + PR_VALUE_SMBGETATR, +#define SMBgetatr_count __profile_stats_value(PR_VALUE_SMBGETATR, count) +#define SMBgetatr_time __profile_stats_value(PR_VALUE_SMBGETATR, time) + + PR_VALUE_SMBSETATR, +#define SMBsetatr_count __profile_stats_value(PR_VALUE_SMBSETATR, count) +#define SMBsetatr_time __profile_stats_value(PR_VALUE_SMBSETATR, time) + + PR_VALUE_SMBREAD, +#define SMBread_count __profile_stats_value(PR_VALUE_SMBREAD, count) +#define SMBread_time __profile_stats_value(PR_VALUE_SMBREAD, time) + + PR_VALUE_SMBWRITE, +#define SMBwrite_count __profile_stats_value(PR_VALUE_SMBWRITE, count) +#define SMBwrite_time __profile_stats_value(PR_VALUE_SMBWRITE, time) + + PR_VALUE_SMBLOCK, +#define SMBlock_count __profile_stats_value(PR_VALUE_SMBLOCK, count) +#define SMBlock_time __profile_stats_value(PR_VALUE_SMBLOCK, time) + + PR_VALUE_SMBUNLOCK, +#define SMBunlock_count __profile_stats_value(PR_VALUE_SMBUNLOCK, count) +#define SMBunlock_time __profile_stats_value(PR_VALUE_SMBUNLOCK, time) + + PR_VALUE_SMBCTEMP, +#define SMBctemp_count __profile_stats_value(PR_VALUE_SMBCTEMP, count) +#define SMBctemp_time __profile_stats_value(PR_VALUE_SMBCTEMP, time) + + /* SMBmknew stats are currently combined with SMBcreate */ + PR_VALUE_SMBMKNEW, +#define SMBmknew_count __profile_stats_value(PR_VALUE_SMBMKNEW, count) +#define SMBmknew_time __profile_stats_value(PR_VALUE_SMBMKNEW, time) + + PR_VALUE_SMBCHECKPATH, +#define SMBcheckpath_count __profile_stats_value(PR_VALUE_SMBCHECKPATH, count) +#define SMBcheckpath_time __profile_stats_value(PR_VALUE_SMBCHECKPATH, time) + + PR_VALUE_SMBEXIT, +#define SMBexit_count __profile_stats_value(PR_VALUE_SMBEXIT, count) +#define SMBexit_time __profile_stats_value(PR_VALUE_SMBEXIT, time) + + PR_VALUE_SMBLSEEK, +#define SMBlseek_count __profile_stats_value(PR_VALUE_SMBLSEEK, count) +#define SMBlseek_time __profile_stats_value(PR_VALUE_SMBLSEEK, time) + + PR_VALUE_SMBLOCKREAD, +#define SMBlockread_count __profile_stats_value(PR_VALUE_SMBLOCKREAD, count) +#define SMBlockread_time __profile_stats_value(PR_VALUE_SMBLOCKREAD, time) + + PR_VALUE_SMBWRITEUNLOCK, +#define SMBwriteunlock_count __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, count) +#define SMBwriteunlock_time __profile_stats_value(PR_VALUE_SMBWRITEUNLOCK, time) + + PR_VALUE_SMBREADBRAW, +#define SMBreadbraw_count __profile_stats_value(PR_VALUE_SMBREADBRAW, count) +#define SMBreadbraw_time __profile_stats_value(PR_VALUE_SMBREADBRAW, time) + + PR_VALUE_SMBREADBMPX, +#define SMBreadBmpx_count __profile_stats_value(PR_VALUE_SMBREADBMPX, count) +#define SMBreadBmpx_time __profile_stats_value(PR_VALUE_SMBREADBMPX, time) + + PR_VALUE_SMBREADBS, +#define SMBreadBs_count __profile_stats_value(PR_VALUE_SMBREADBS, count) +#define SMBreadBs_time __profile_stats_value(PR_VALUE_SMBREADBS, time) + + PR_VALUE_SMBWRITEBRAW, +#define SMBwritebraw_count __profile_stats_value(PR_VALUE_SMBWRITEBRAW, count) +#define SMBwritebraw_time __profile_stats_value(PR_VALUE_SMBWRITEBRAW, time) + + PR_VALUE_SMBWRITEBMPX, +#define SMBwriteBmpx_count __profile_stats_value(PR_VALUE_SMBWRITEBMPX, count) +#define SMBwriteBmpx_time __profile_stats_value(PR_VALUE_SMBWRITEBMPX, time) + + PR_VALUE_SMBWRITEBS, +#define SMBwriteBs_count __profile_stats_value(PR_VALUE_SMBWRITEBS, count) +#define SMBwriteBs_time __profile_stats_value(PR_VALUE_SMBWRITEBS, time) + + PR_VALUE_SMBWRITEC, +#define SMBwritec_count __profile_stats_value(PR_VALUE_SMBWRITEC, count) +#define SMBwritec_time __profile_stats_value(PR_VALUE_SMBWRITEC, time) + + PR_VALUE_SMBSETATTRE, +#define SMBsetattrE_count __profile_stats_value(PR_VALUE_SMBSETATTRE, count) +#define SMBsetattrE_time __profile_stats_value(PR_VALUE_SMBSETATTRE, time) + + PR_VALUE_SMBGETATTRE, +#define SMBgetattrE_count __profile_stats_value(PR_VALUE_SMBGETATTRE, count) +#define SMBgetattrE_time __profile_stats_value(PR_VALUE_SMBGETATTRE, time) + + PR_VALUE_SMBLOCKINGX, +#define SMBlockingX_count __profile_stats_value(PR_VALUE_SMBLOCKINGX, count) +#define SMBlockingX_time __profile_stats_value(PR_VALUE_SMBLOCKINGX, time) + + PR_VALUE_SMBTRANS, +#define SMBtrans_count __profile_stats_value(PR_VALUE_SMBTRANS, count) +#define SMBtrans_time __profile_stats_value(PR_VALUE_SMBTRANS, time) + + PR_VALUE_SMBTRANSS, +#define SMBtranss_count __profile_stats_value(PR_VALUE_SMBTRANSS, count) +#define SMBtranss_time __profile_stats_value(PR_VALUE_SMBTRANSS, time) + + PR_VALUE_SMBIOCTL, +#define SMBioctl_count __profile_stats_value(PR_VALUE_SMBIOCTL, count) +#define SMBioctl_time __profile_stats_value(PR_VALUE_SMBIOCTL, time) + + PR_VALUE_SMBIOCTLS, +#define SMBioctls_count __profile_stats_value(PR_VALUE_SMBIOCTLS, count) +#define SMBioctls_time __profile_stats_value(PR_VALUE_SMBIOCTLS, time) + + PR_VALUE_SMBCOPY, +#define SMBcopy_count __profile_stats_value(PR_VALUE_SMBCOPY, count) +#define SMBcopy_time __profile_stats_value(PR_VALUE_SMBCOPY, time) + + PR_VALUE_SMBMOVE, +#define SMBmove_count __profile_stats_value(PR_VALUE_SMBMOVE, count) +#define SMBmove_time __profile_stats_value(PR_VALUE_SMBMOVE, time) + + PR_VALUE_SMBECHO, +#define SMBecho_count __profile_stats_value(PR_VALUE_SMBECHO, count) +#define SMBecho_time __profile_stats_value(PR_VALUE_SMBECHO, time) + + PR_VALUE_SMBWRITECLOSE, +#define SMBwriteclose_count __profile_stats_value(PR_VALUE_SMBWRITECLOSE, count) +#define SMBwriteclose_time __profile_stats_value(PR_VALUE_SMBWRITECLOSE, time) + + PR_VALUE_SMBOPENX, +#define SMBopenX_count __profile_stats_value(PR_VALUE_SMBOPENX, count) +#define SMBopenX_time __profile_stats_value(PR_VALUE_SMBOPENX, time) + + PR_VALUE_SMBREADX, +#define SMBreadX_count __profile_stats_value(PR_VALUE_SMBREADX, count) +#define SMBreadX_time __profile_stats_value(PR_VALUE_SMBREADX, time) + + PR_VALUE_SMBWRITEX, +#define SMBwriteX_count __profile_stats_value(PR_VALUE_SMBWRITEX, count) +#define SMBwriteX_time __profile_stats_value(PR_VALUE_SMBWRITEX, time) + + PR_VALUE_SMBTRANS2, +#define SMBtrans2_count __profile_stats_value(PR_VALUE_SMBTRANS2, count) +#define SMBtrans2_time __profile_stats_value(PR_VALUE_SMBTRANS2, time) + + PR_VALUE_SMBTRANSS2, +#define SMBtranss2_count __profile_stats_value(PR_VALUE_SMBTRANSS2, count) +#define SMBtranss2_time __profile_stats_value(PR_VALUE_SMBTRANSS2, time) + + PR_VALUE_SMBFINDCLOSE, +#define SMBfindclose_count __profile_stats_value(PR_VALUE_SMBFINDCLOSE, count) +#define SMBfindclose_time __profile_stats_value(PR_VALUE_SMBFINDCLOSE, time) + + PR_VALUE_SMBFINDNCLOSE, +#define SMBfindnclose_count __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, count) +#define SMBfindnclose_time __profile_stats_value(PR_VALUE_SMBFINDNCLOSE, time) + + PR_VALUE_SMBTCON, +#define SMBtcon_count __profile_stats_value(PR_VALUE_SMBTCON, count) +#define SMBtcon_time __profile_stats_value(PR_VALUE_SMBTCON, time) + + PR_VALUE_SMBTDIS, +#define SMBtdis_count __profile_stats_value(PR_VALUE_SMBTDIS, count) +#define SMBtdis_time __profile_stats_value(PR_VALUE_SMBTDIS, time) + + PR_VALUE_SMBNEGPROT, +#define SMBnegprot_count __profile_stats_value(PR_VALUE_SMBNEGPROT, count) +#define SMBnegprot_time __profile_stats_value(PR_VALUE_SMBNEGPROT, time) + + PR_VALUE_SMBSESSSETUPX, +#define SMBsesssetupX_count __profile_stats_value(PR_VALUE_SMBSESSSETUPX, count) +#define SMBsesssetupX_time __profile_stats_value(PR_VALUE_SMBSESSSETUPX, time) + + PR_VALUE_SMBULOGOFFX, +#define SMBulogoffX_count __profile_stats_value(PR_VALUE_SMBULOGOFFX, count) +#define SMBulogoffX_time __profile_stats_value(PR_VALUE_SMBULOGOFFX, time) + + PR_VALUE_SMBTCONX, +#define SMBtconX_count __profile_stats_value(PR_VALUE_SMBTCONX, count) +#define SMBtconX_time __profile_stats_value(PR_VALUE_SMBTCONX, time) + + PR_VALUE_SMBDSKATTR, +#define SMBdskattr_count __profile_stats_value(PR_VALUE_SMBDSKATTR, count) +#define SMBdskattr_time __profile_stats_value(PR_VALUE_SMBDSKATTR, time) + + PR_VALUE_SMBSEARCH, +#define SMBsearch_count __profile_stats_value(PR_VALUE_SMBSEARCH, count) +#define SMBsearch_time __profile_stats_value(PR_VALUE_SMBSEARCH, time) + + /* SBMffirst stats combined with SMBsearch */ + PR_VALUE_SMBFFIRST, +#define SMBffirst_count __profile_stats_value(PR_VALUE_SMBFFIRST, count) +#define SMBffirst_time __profile_stats_value(PR_VALUE_SMBFFIRST, time) + + /* SBMfunique stats combined with SMBsearch */ + PR_VALUE_SMBFUNIQUE, +#define SMBfunique_count __profile_stats_value(PR_VALUE_SMBFUNIQUE, count) +#define SMBfunique_time __profile_stats_value(PR_VALUE_SMBFUNIQUE, time) + + PR_VALUE_SMBFCLOSE, +#define SMBfclose_count __profile_stats_value(PR_VALUE_SMBFCLOSE, count) +#define SMBfclose_time __profile_stats_value(PR_VALUE_SMBFCLOSE, time) + + PR_VALUE_SMBNTTRANS, +#define SMBnttrans_count __profile_stats_value(PR_VALUE_SMBNTTRANS, count) +#define SMBnttrans_time __profile_stats_value(PR_VALUE_SMBNTTRANS, time) + + PR_VALUE_SMBNTTRANSS, +#define SMBnttranss_count __profile_stats_value(PR_VALUE_SMBNTTRANSS, count) +#define SMBnttranss_time __profile_stats_value(PR_VALUE_SMBNTTRANSS, time) + + PR_VALUE_SMBNTCREATEX, +#define SMBntcreateX_count __profile_stats_value(PR_VALUE_SMBNTCREATEX, count) +#define SMBntcreateX_time __profile_stats_value(PR_VALUE_SMBNTCREATEX, time) + + PR_VALUE_SMBNTCANCEL, +#define SMBntcancel_count __profile_stats_value(PR_VALUE_SMBNTCANCEL, count) +#define SMBntcancel_time __profile_stats_value(PR_VALUE_SMBNTCANCEL, time) + + PR_VALUE_SMBNTRENAME, +#define SMBntrename_count __profile_stats_value(PR_VALUE_SMBNTRENAME, count) +#define SMBntrename_time __profile_stats_value(PR_VALUE_SMBNTRENAME, time) + + PR_VALUE_SMBSPLOPEN, +#define SMBsplopen_count __profile_stats_value(PR_VALUE_SMBSPLOPEN, count) +#define SMBsplopen_time __profile_stats_value(PR_VALUE_SMBSPLOPEN, time) + + PR_VALUE_SMBSPLWR, +#define SMBsplwr_count __profile_stats_value(PR_VALUE_SMBSPLWR, count) +#define SMBsplwr_time __profile_stats_value(PR_VALUE_SMBSPLWR, time) + + PR_VALUE_SMBSPLCLOSE, +#define SMBsplclose_count __profile_stats_value(PR_VALUE_SMBSPLCLOSE, count) +#define SMBsplclose_time __profile_stats_value(PR_VALUE_SMBSPLCLOSE, time) + + PR_VALUE_SMBSPLRETQ, +#define SMBsplretq_count __profile_stats_value(PR_VALUE_SMBSPLRETQ, count) +#define SMBsplretq_time __profile_stats_value(PR_VALUE_SMBSPLRETQ, time) + + PR_VALUE_SMBSENDS, +#define SMBsends_count __profile_stats_value(PR_VALUE_SMBSENDS, count) +#define SMBsends_time __profile_stats_value(PR_VALUE_SMBSENDS, time) + + PR_VALUE_SMBSENDB, +#define SMBsendb_count __profile_stats_value(PR_VALUE_SMBSENDB, count) +#define SMBsendb_time __profile_stats_value(PR_VALUE_SMBSENDB, time) + + PR_VALUE_SMBFWDNAME, +#define SMBfwdname_count __profile_stats_value(PR_VALUE_SMBFWDNAME, count) +#define SMBfwdname_time __profile_stats_value(PR_VALUE_SMBFWDNAME, time) + + PR_VALUE_SMBCANCELF, +#define SMBcancelf_count __profile_stats_value(PR_VALUE_SMBCANCELF, count) +#define SMBcancelf_time __profile_stats_value(PR_VALUE_SMBCANCELF, time) + + PR_VALUE_SMBGETMAC, +#define SMBgetmac_count __profile_stats_value(PR_VALUE_SMBGETMAC, count) +#define SMBgetmac_time __profile_stats_value(PR_VALUE_SMBGETMAC, time) + + PR_VALUE_SMBSENDSTRT, +#define SMBsendstrt_count __profile_stats_value(PR_VALUE_SMBSENDSTRT, count) +#define SMBsendstrt_time __profile_stats_value(PR_VALUE_SMBSENDSTRT, time) + + PR_VALUE_SMBSENDEND, +#define SMBsendend_count __profile_stats_value(PR_VALUE_SMBSENDEND, count) +#define SMBsendend_time __profile_stats_value(PR_VALUE_SMBSENDEND, time) + + PR_VALUE_SMBSENDTXT, +#define SMBsendtxt_count __profile_stats_value(PR_VALUE_SMBSENDTXT, count) +#define SMBsendtxt_time __profile_stats_value(PR_VALUE_SMBSENDTXT, time) + + PR_VALUE_SMBINVALID, +#define SMBinvalid_count __profile_stats_value(PR_VALUE_SMBINVALID, count) +#define SMBinvalid_time __profile_stats_value(PR_VALUE_SMBINVALID, time) + +/* Pathworks setdir command */ + PR_VALUE_PATHWORKS_SETDIR, +#define pathworks_setdir_count __profile_stats_value(PR_VALUE_PATHWORKS_SETDIR, count) +#define pathworks_setdir_time __profile_stats_value(PR_VALUE_PATHWORKS_SETDIR, time) + +/* These are the TRANS2 sub commands */ + PR_VALUE_TRANS2_OPEN, +#define Trans2_open_count __profile_stats_value(PR_VALUE_TRANS2_OPEN, count) +#define Trans2_open_time __profile_stats_value(PR_VALUE_TRANS2_OPEN, time) + + PR_VALUE_TRANS2_FINDFIRST, +#define Trans2_findfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, count) +#define Trans2_findfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDFIRST, time) + + PR_VALUE_TRANS2_FINDNEXT, +#define Trans2_findnext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, count) +#define Trans2_findnext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNEXT, time) + + PR_VALUE_TRANS2_QFSINFO, +#define Trans2_qfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, count) +#define Trans2_qfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFSINFO, time) + + PR_VALUE_TRANS2_SETFSINFO, +#define Trans2_setfsinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, count) +#define Trans2_setfsinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFSINFO, time) + + PR_VALUE_TRANS2_QPATHINFO, +#define Trans2_qpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, count) +#define Trans2_qpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_QPATHINFO, time) + + PR_VALUE_TRANS2_SETPATHINFO, +#define Trans2_setpathinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, count) +#define Trans2_setpathinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETPATHINFO, time) + + PR_VALUE_TRANS2_QFILEINFO, +#define Trans2_qfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, count) +#define Trans2_qfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_QFILEINFO, time) + + PR_VALUE_TRANS2_SETFILEINFO, +#define Trans2_setfileinfo_count __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, count) +#define Trans2_setfileinfo_time __profile_stats_value(PR_VALUE_TRANS2_SETFILEINFO, time) + + PR_VALUE_TRANS2_FSCTL, +#define Trans2_fsctl_count __profile_stats_value(PR_VALUE_TRANS2_FSCTL, count) +#define Trans2_fsctl_time __profile_stats_value(PR_VALUE_TRANS2_FSCTL, time) + + PR_VALUE_TRANS2_IOCTL, +#define Trans2_ioctl_count __profile_stats_value(PR_VALUE_TRANS2_IOCTL, count) +#define Trans2_ioctl_time __profile_stats_value(PR_VALUE_TRANS2_IOCTL, time) + + PR_VALUE_TRANS2_FINDNOTIFYFIRST, +#define Trans2_findnotifyfirst_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, count) +#define Trans2_findnotifyfirst_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYFIRST, time) + + PR_VALUE_TRANS2_FINDNOTIFYNEXT, +#define Trans2_findnotifynext_count __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, count) +#define Trans2_findnotifynext_time __profile_stats_value(PR_VALUE_TRANS2_FINDNOTIFYNEXT, time) + + PR_VALUE_TRANS2_MKDIR, +#define Trans2_mkdir_count __profile_stats_value(PR_VALUE_TRANS2_MKDIR, count) +#define Trans2_mkdir_time __profile_stats_value(PR_VALUE_TRANS2_MKDIR, time) + + PR_VALUE_TRANS2_SESSION_SETUP, +#define Trans2_session_setup_count __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, count) +#define Trans2_session_setup_time __profile_stats_value(PR_VALUE_TRANS2_SESSION_SETUP, time) + + PR_VALUE_TRANS2_GET_DFS_REFERRAL, +#define Trans2_get_dfs_referral_count __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, count) +#define Trans2_get_dfs_referral_time __profile_stats_value(PR_VALUE_TRANS2_GET_DFS_REFERRAL, time) + + PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, +#define Trans2_report_dfs_inconsistancy_count __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, count) +#define Trans2_report_dfs_inconsistancy_time __profile_stats_value(PR_VALUE_TRANS2_REPORT_DFS_INCONSISTANCY, time) + +/* These are the NT transact sub commands. */ + PR_VALUE_NT_TRANSACT_CREATE, +#define NT_transact_create_count __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, count) +#define NT_transact_create_time __profile_stats_value(PR_VALUE_NT_TRANSACT_CREATE, time) + + PR_VALUE_NT_TRANSACT_IOCTL, +#define NT_transact_ioctl_count __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, count) +#define NT_transact_ioctl_time __profile_stats_value(PR_VALUE_NT_TRANSACT_IOCTL, time) + + PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, +#define NT_transact_set_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, count) +#define NT_transact_set_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_SECURITY_DESC, time) + + PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, +#define NT_transact_notify_change_count __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, count) +#define NT_transact_notify_change_time __profile_stats_value(PR_VALUE_NT_TRANSACT_NOTIFY_CHANGE, time) + + PR_VALUE_NT_TRANSACT_RENAME, +#define NT_transact_rename_count __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, count) +#define NT_transact_rename_time __profile_stats_value(PR_VALUE_NT_TRANSACT_RENAME, time) + + PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, +#define NT_transact_query_security_desc_count __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, count) +#define NT_transact_query_security_desc_time __profile_stats_value(PR_VALUE_NT_TRANSACT_QUERY_SECURITY_DESC, time) + + PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, +#define NT_transact_get_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, count) +#define NT_transact_get_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_GET_USER_QUOTA, time) + + PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, +#define NT_transact_set_user_quota_count __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, count) +#define NT_transact_set_user_quota_time __profile_stats_value(PR_VALUE_NT_TRANSACT_SET_USER_QUOTA, time) + +/* These are ACL manipulation calls */ + PR_VALUE_GET_NT_ACL, +#define get_nt_acl_count __profile_stats_value(PR_VALUE_GET_NT_ACL, count) +#define get_nt_acl_time __profile_stats_value(PR_VALUE_GET_NT_ACL, time) + + PR_VALUE_FGET_NT_ACL, +#define fget_nt_acl_count __profile_stats_value(PR_VALUE_FGET_NT_ACL, count) +#define fget_nt_acl_time __profile_stats_value(PR_VALUE_FGET_NT_ACL, time) + + PR_VALUE_FSET_NT_ACL, +#define fset_nt_acl_count __profile_stats_value(PR_VALUE_FSET_NT_ACL, count) +#define fset_nt_acl_time __profile_stats_value(PR_VALUE_FSET_NT_ACL, time) + + PR_VALUE_CHMOD_ACL, +#define chmod_acl_count __profile_stats_value(PR_VALUE_CHMOD_ACL, count) +#define chmod_acl_time __profile_stats_value(PR_VALUE_CHMOD_ACL, time) + + PR_VALUE_FCHMOD_ACL, +#define fchmod_acl_count __profile_stats_value(PR_VALUE_FCHMOD_ACL, count) +#define fchmod_acl_time __profile_stats_value(PR_VALUE_FCHMOD_ACL, time) + +/* These are nmbd stats */ + PR_VALUE_NAME_RELEASE, +#define name_release_count __profile_stats_value(PR_VALUE_NAME_RELEASE, count) +#define name_release_time __profile_stats_value(PR_VALUE_NAME_RELEASE, time) + + PR_VALUE_NAME_REFRESH, +#define name_refresh_count __profile_stats_value(PR_VALUE_NAME_REFRESH, count) +#define name_refresh_time __profile_stats_value(PR_VALUE_NAME_REFRESH, time) + + PR_VALUE_NAME_REGISTRATION, +#define name_registration_count __profile_stats_value(PR_VALUE_NAME_REGISTRATION, count) +#define name_registration_time __profile_stats_value(PR_VALUE_NAME_REGISTRATION, time) + + PR_VALUE_NODE_STATUS, +#define node_status_count __profile_stats_value(PR_VALUE_NODE_STATUS, count) +#define node_status_time __profile_stats_value(PR_VALUE_NODE_STATUS, time) + + PR_VALUE_NAME_QUERY, +#define name_query_count __profile_stats_value(PR_VALUE_NAME_QUERY, count) +#define name_query_time __profile_stats_value(PR_VALUE_NAME_QUERY, time) + + PR_VALUE_HOST_ANNOUNCE, +#define host_announce_count __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, count) +#define host_announce_time __profile_stats_value(PR_VALUE_HOST_ANNOUNCE, time) + + PR_VALUE_WORKGROUP_ANNOUNCE, +#define workgroup_announce_count __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, count) +#define workgroup_announce_time __profile_stats_value(PR_VALUE_WORKGROUP_ANNOUNCE, time) + + PR_VALUE_LOCAL_MASTER_ANNOUNCE, +#define local_master_announce_count __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, count) +#define local_master_announce_time __profile_stats_value(PR_VALUE_LOCAL_MASTER_ANNOUNCE, time) + + PR_VALUE_MASTER_BROWSER_ANNOUNCE, +#define master_browser_announce_count __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, count) +#define master_browser_announce_time __profile_stats_value(PR_VALUE_MASTER_BROWSER_ANNOUNCE, time) + + PR_VALUE_LM_HOST_ANNOUNCE, +#define lm_host_announce_count __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, count) +#define lm_host_announce_time __profile_stats_value(PR_VALUE_LM_HOST_ANNOUNCE, time) + + PR_VALUE_GET_BACKUP_LIST, +#define get_backup_list_count __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, count) +#define get_backup_list_time __profile_stats_value(PR_VALUE_GET_BACKUP_LIST, time) + + PR_VALUE_RESET_BROWSER, +#define reset_browser_count __profile_stats_value(PR_VALUE_RESET_BROWSER, count) +#define reset_browser_time __profile_stats_value(PR_VALUE_RESET_BROWSER, time) + + PR_VALUE_ANNOUNCE_REQUEST, +#define announce_request_count __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, count) +#define announce_request_time __profile_stats_value(PR_VALUE_ANNOUNCE_REQUEST, time) + + PR_VALUE_LM_ANNOUNCE_REQUEST, +#define lm_announce_request_count __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, count) +#define lm_announce_request_time __profile_stats_value(PR_VALUE_LM_ANNOUNCE_REQUEST, time) + + PR_VALUE_DOMAIN_LOGON, +#define domain_logon_count __profile_stats_value(PR_VALUE_DOMAIN_LOGON, count) +#define domain_logon_time __profile_stats_value(PR_VALUE_DOMAIN_LOGON, time) + + PR_VALUE_SYNC_BROWSE_LISTS, +#define sync_browse_lists_count __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, count) +#define sync_browse_lists_time __profile_stats_value(PR_VALUE_SYNC_BROWSE_LISTS, time) + + PR_VALUE_RUN_ELECTIONS, +#define run_elections_count __profile_stats_value(PR_VALUE_RUN_ELECTIONS, count) +#define run_elections_time __profile_stats_value(PR_VALUE_RUN_ELECTIONS, time) + + PR_VALUE_ELECTION, +#define election_count __profile_stats_value(PR_VALUE_ELECTION, count) +#define election_time __profile_stats_value(PR_VALUE_ELECTION, time) + + /* This mist remain the last value. */ + PR_VALUE_MAX +}; /* enum profile_stats_values */ + +const char * profile_value_name(enum profile_stats_values val); + +struct profile_stats { +/* general counters */ + unsigned smb_count; /* how many SMB packets we have processed */ + unsigned uid_changes; /* how many times we change our effective uid */ + +/* system call and protocol operation counters and cumulative times */ + unsigned count[PR_VALUE_MAX]; + unsigned time[PR_VALUE_MAX]; + +/* cumulative byte counts */ + unsigned syscall_pread_bytes; + unsigned syscall_pwrite_bytes; + unsigned syscall_read_bytes; + unsigned syscall_write_bytes; + unsigned syscall_sendfile_bytes; + unsigned syscall_recvfile_bytes; + +/* stat cache counters */ + unsigned statcache_lookups; + unsigned statcache_misses; + unsigned statcache_hits; + +/* write cache counters */ + unsigned writecache_read_hits; + unsigned writecache_abutted_writes; + unsigned writecache_total_writes; + unsigned writecache_non_oplock_writes; + unsigned writecache_direct_writes; + unsigned writecache_init_writes; + unsigned writecache_flushed_writes[NUM_FLUSH_REASONS]; + unsigned writecache_num_perfect_writes; + unsigned writecache_num_write_caches; + unsigned writecache_allocated_write_caches; +}; + +struct profile_header { + int prof_shm_magic; + int prof_shm_version; + struct profile_stats stats; +}; + +extern struct profile_header *profile_h; +extern struct profile_stats *profile_p; +extern bool do_profile_flag; +extern bool do_profile_times; + +#ifdef WITH_PROFILE + +/* these are helper macros - do not call them directly in the code + * use the DO_PROFILE_* START_PROFILE and END_PROFILE ones + * below which test for the profile flage first + */ +#define INC_PROFILE_COUNT(x) profile_p->x++ +#define DEC_PROFILE_COUNT(x) profile_p->x-- +#define ADD_PROFILE_COUNT(x,y) profile_p->x += (y) + +#if defined(HAVE_CLOCK_GETTIME) + +extern clockid_t __profile_clock; + +static inline SMB_BIG_UINT profile_timestamp(void) +{ + struct timespec ts; + + /* FIXME: On a single-CPU system, or a system where we have bound + * daemon threads to single CPUs (eg. using cpusets or processor + * affinity), it might be preferable to use CLOCK_PROCESS_CPUTIME_ID. + */ + + clock_gettime(__profile_clock, &ts); + return (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); /* usec */ +} + +#else + +static inline SMB_BIG_UINT profile_timestamp(void) +{ + struct timeval tv; + GetTimeOfDay(&tv); + return (tv.tv_sec * 1000000) + tv.tv_usec; +} + +#endif + +/* end of helper macros */ + +#define DO_PROFILE_INC(x) \ + if (do_profile_flag) { \ + INC_PROFILE_COUNT(x); \ + } + +#define DO_PROFILE_DEC(x) \ + if (do_profile_flag) { \ + DEC_PROFILE_COUNT(x); \ + } + +#define DO_PROFILE_DEC_INC(x,y) \ + if (do_profile_flag) { \ + DEC_PROFILE_COUNT(x); \ + INC_PROFILE_COUNT(y); \ + } + +#define DO_PROFILE_ADD(x,n) \ + if (do_profile_flag) { \ + ADD_PROFILE_COUNT(x,n); \ + } + +#define START_PROFILE(x) \ + SMB_BIG_UINT __profstamp_##x = 0; \ + if (do_profile_flag) { \ + __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\ + INC_PROFILE_COUNT(x##_count); \ + } + +#define START_PROFILE_BYTES(x,n) \ + SMB_BIG_UINT __profstamp_##x = 0; \ + if (do_profile_flag) { \ + __profstamp_##x = do_profile_times ? profile_timestamp() : 0;\ + INC_PROFILE_COUNT(x##_count); \ + ADD_PROFILE_COUNT(x##_bytes, n); \ + } + +#define END_PROFILE(x) \ + if (do_profile_times) { \ + ADD_PROFILE_COUNT(x##_time, \ + profile_timestamp() - __profstamp_##x); \ + } + + +#else /* WITH_PROFILE */ + +#define DO_PROFILE_INC(x) +#define DO_PROFILE_DEC(x) +#define DO_PROFILE_DEC_INC(x,y) +#define DO_PROFILE_ADD(x,n) +#define START_PROFILE(x) +#define START_PROFILE_BYTES(x,n) +#define END_PROFILE(x) + +#endif /* WITH_PROFILE */ + +#endif diff --git a/source3/include/spnego.h b/source3/include/spnego.h new file mode 100644 index 0000000000..02921ed18e --- /dev/null +++ b/source3/include/spnego.h @@ -0,0 +1,64 @@ +/* + Unix SMB/CIFS implementation. + + RFC2478 Compliant SPNEGO implementation + + Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef SAMBA_SPNEGO_H +#define SAMBA_SPNEGO_H + +#define SPNEGO_DELEG_FLAG 0x01 +#define SPNEGO_MUTUAL_FLAG 0x02 +#define SPNEGO_REPLAY_FLAG 0x04 +#define SPNEGO_SEQUENCE_FLAG 0x08 +#define SPNEGO_ANON_FLAG 0x10 +#define SPNEGO_CONF_FLAG 0x20 +#define SPNEGO_INTEG_FLAG 0x40 +#define SPNEGO_REQ_FLAG 0x80 + +#define SPNEGO_NEG_TOKEN_INIT 0 +#define SPNEGO_NEG_TOKEN_TARG 1 + +typedef enum _spnego_negResult { + SPNEGO_ACCEPT_COMPLETED = 0, + SPNEGO_ACCEPT_INCOMPLETE = 1, + SPNEGO_REJECT = 2 +} negResult_t; + +typedef struct spnego_negTokenInit { + const char **mechTypes; + int reqFlags; + DATA_BLOB mechToken; + DATA_BLOB mechListMIC; +} negTokenInit_t; + +typedef struct spnego_negTokenTarg { + uint8 negResult; + char *supportedMech; + DATA_BLOB responseToken; + DATA_BLOB mechListMIC; +} negTokenTarg_t; + +typedef struct spnego_spnego { + int type; + negTokenInit_t negTokenInit; + negTokenTarg_t negTokenTarg; +} SPNEGO_DATA; + +#endif diff --git a/source3/include/srvstr.h b/source3/include/srvstr.h new file mode 100644 index 0000000000..588a807f64 --- /dev/null +++ b/source3/include/srvstr.h @@ -0,0 +1,37 @@ +/* + Unix SMB/CIFS implementation. + server specific string routines + Copyright (C) Andrew Tridgell 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define srvstr_pull(base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) \ + pull_string(base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) + +/* talloc version of above. */ +#define srvstr_pull_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \ + pull_string_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) + +/* pull a string from the smb_buf part of a packet. In this case the + string can either be null terminated or it can be terminated by the + end of the smbbuf area +*/ + +#define srvstr_pull_buf(inbuf, smb_flags2, dest, src, dest_len, flags) \ + pull_string(inbuf, smb_flags2, dest, src, dest_len, smb_bufrem(inbuf, src), flags) + +/* talloc version of above. */ +#define srvstr_pull_buf_talloc(ctx, inbuf, smb_flags2, dest, src, flags) \ + pull_string_talloc(ctx, inbuf, smb_flags2, dest, src, smb_bufrem(inbuf, src), flags) diff --git a/source3/include/stamp-h.in b/source3/include/stamp-h.in new file mode 100644 index 0000000000..c9061b3ad3 --- /dev/null +++ b/source3/include/stamp-h.in @@ -0,0 +1 @@ +Sun Jul 18 20:32:29 UTC 1999 diff --git a/source3/include/sysquotas.h b/source3/include/sysquotas.h new file mode 100644 index 0000000000..a0754a3737 --- /dev/null +++ b/source3/include/sysquotas.h @@ -0,0 +1,75 @@ +/* + Unix SMB/CIFS implementation. + SYS QUOTA code constants + Copyright (C) Stefan (metze) Metzmacher 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _SYSQUOTAS_H +#define _SYSQUOTAS_H + +#ifdef HAVE_SYS_QUOTAS + +#if defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT) +#include <mntent.h> +#define HAVE_MNTENT 1 +/*#endif defined(HAVE_MNTENT_H)&&defined(HAVE_SETMNTENT)&&defined(HAVE_GETMNTENT)&&defined(HAVE_ENDMNTENT) */ +#elif defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM) +#include <devnm.h> +#endif /* defined(HAVE_DEVNM_H)&&defined(HAVE_DEVNM) */ + +#endif /* HAVE_SYS_QUOTAS */ + + +/************************************************** + Some stuff for the sys_quota api. + **************************************************/ + +#define SMB_QUOTAS_NO_LIMIT ((SMB_BIG_UINT)(0)) +#define SMB_QUOTAS_NO_SPACE ((SMB_BIG_UINT)(1)) + +#define SMB_QUOTAS_SET_NO_LIMIT(dp) \ +{\ + (dp)->softlimit = SMB_QUOTAS_NO_LIMIT;\ + (dp)->hardlimit = SMB_QUOTAS_NO_LIMIT;\ + (dp)->isoftlimit = SMB_QUOTAS_NO_LIMIT;\ + (dp)->ihardlimit = SMB_QUOTAS_NO_LIMIT;\ +} + +#define SMB_QUOTAS_SET_NO_SPACE(dp) \ +{\ + (dp)->softlimit = SMB_QUOTAS_NO_SPACE;\ + (dp)->hardlimit = SMB_QUOTAS_NO_SPACE;\ + (dp)->isoftlimit = SMB_QUOTAS_NO_SPACE;\ + (dp)->ihardlimit = SMB_QUOTAS_NO_SPACE;\ +} + +typedef struct _SMB_DISK_QUOTA { + enum SMB_QUOTA_TYPE qtype; + SMB_BIG_UINT bsize; + SMB_BIG_UINT hardlimit; /* In bsize units. */ + SMB_BIG_UINT softlimit; /* In bsize units. */ + SMB_BIG_UINT curblocks; /* In bsize units. */ + SMB_BIG_UINT ihardlimit; /* inode hard limit. */ + SMB_BIG_UINT isoftlimit; /* inode soft limit. */ + SMB_BIG_UINT curinodes; /* Current used inodes. */ + uint32 qflags; +} SMB_DISK_QUOTA; + +#ifndef QUOTABLOCK_SIZE +#define QUOTABLOCK_SIZE 1024 +#endif + +#endif /*_SYSQUOTAS_H */ diff --git a/source3/include/talloc_stack.h b/source3/include/talloc_stack.h new file mode 100644 index 0000000000..a2a12f8a63 --- /dev/null +++ b/source3/include/talloc_stack.h @@ -0,0 +1,56 @@ +/* + Unix SMB/CIFS implementation. + Implement a stack of talloc contexts + Copyright (C) Volker Lendecke 2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* + * Implement a stack of talloc frames. + * + * When a new talloc stackframe is allocated with talloc_stackframe(), then + * the TALLOC_CTX returned with talloc_tos() is reset to that new + * frame. Whenever that stack frame is TALLOC_FREE()'ed, then the reverse + * happens: The previous talloc_tos() is restored. + * + * This API is designed to be robust in the sense that if someone forgets to + * TALLOC_FREE() a stackframe, then the next outer one correctly cleans up and + * resets the talloc_tos(). + * + */ + +#ifndef _TALLOC_STACK_H +#define _TALLOC_STACK_H + +#include "lib/talloc/talloc.h" + +/* + * Create a new talloc stack frame. + * + * When free'd, it frees all stack frames that were created after this one and + * not explicitly freed. + */ + +TALLOC_CTX *talloc_stackframe(void); +TALLOC_CTX *talloc_stackframe_pool(size_t poolsize); + +/* + * Get us the current top of the talloc stack. + */ + +TALLOC_CTX *talloc_tos(void); + +#endif diff --git a/source3/include/trans2.h b/source3/include/trans2.h new file mode 100644 index 0000000000..3759d59681 --- /dev/null +++ b/source3/include/trans2.h @@ -0,0 +1,772 @@ +/* + Unix SMB/CIFS implementation. + SMB transaction2 handling + + Copyright (C) James Peach 2007 + Copyright (C) Jeremy Allison 1994-2002. + + Extensively modified by Andrew Tridgell, 1995 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _TRANS2_H_ +#define _TRANS2_H_ + +/* Define the structures needed for the trans2 calls. */ + +/******************************************************* + For DosFindFirst/DosFindNext - level 1 + +MAXFILENAMELEN = 255; +FDATE == uint16 +FTIME == uint16 +ULONG == uint32 +USHORT == uint16 + +typedef struct _FILEFINDBUF { +Byte offset Type name description +-------------+-------+-------------------+-------------- +0 FDATE fdateCreation; +2 FTIME ftimeCreation; +4 FDATE fdateLastAccess; +6 FTIME ftimeLastAccess; +8 FDATE fdateLastWrite; +10 FTIME ftimeLastWrite; +12 ULONG cbFile file length in bytes +16 ULONG cbFileAlloc size of file allocation unit +20 USHORT attrFile +22 UCHAR cchName length of name to follow (not including zero) +23 UCHAR achName[MAXFILENAMELEN]; Null terminated name +} FILEFINDBUF; +*********************************************************/ + +#define l1_fdateCreation 0 +#define l1_fdateLastAccess 4 +#define l1_fdateLastWrite 8 +#define l1_cbFile 12 +#define l1_cbFileAlloc 16 +#define l1_attrFile 20 +#define l1_cchName 22 +#define l1_achName 23 + +/********************************************************** +For DosFindFirst/DosFindNext - level 2 + +typedef struct _FILEFINDBUF2 { +Byte offset Type name description +-------------+-------+-------------------+-------------- +0 FDATE fdateCreation; +2 FTIME ftimeCreation; +4 FDATE fdateLastAccess; +6 FTIME ftimeLastAccess; +8 FDATE fdateLastWrite; +10 FTIME ftimeLastWrite; +12 ULONG cbFile file length in bytes +16 ULONG cbFileAlloc size of file allocation unit +20 USHORT attrFile +22 ULONG cbList Extended attribute list (always 0) +26 UCHAR cchName length of name to follow (not including zero) +27 UCHAR achName[MAXFILENAMELEN]; Null terminated name +} FILEFINDBUF2; +*************************************************************/ + +#define l2_fdateCreation 0 +#define l2_fdateLastAccess 4 +#define l2_fdateLastWrite 8 +#define l2_cbFile 12 +#define l2_cbFileAlloc 16 +#define l2_attrFile 20 +#define l2_cbList 22 +#define l2_cchName 26 +#define l2_achName 27 + + +/********************************************************** +For DosFindFirst/DosFindNext - level 260 + +typedef struct _FILEFINDBUF260 { +Byte offset Type name description +-------------+-------+-------------------+-------------- +0 ULONG NextEntryOffset; +4 ULONG FileIndex; +8 LARGE_INTEGER CreationTime; +16 LARGE_INTEGER LastAccessTime; +24 LARGE_INTEGER LastWriteTime; +32 LARGE_INTEGER ChangeTime; +40 LARGE_INTEGER EndOfFile; +48 LARGE_INTEGER AllocationSize; +56 ULONG FileAttributes; +60 ULONG FileNameLength; +64 ULONG EaSize; +68 CHAR ShortNameLength; +70 UNICODE ShortName[12]; +94 UNICODE FileName[]; +*************************************************************/ + +#define l260_achName 94 + + +/********************************************************** +For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/ +DosSetFileInfo - level 1 + +typedef struct _FILESTATUS { +Byte offset Type name description +-------------+-------+-------------------+-------------- +0 FDATE fdateCreation; +2 FTIME ftimeCreation; +4 FDATE fdateLastAccess; +6 FTIME ftimeLastAccess; +8 FDATE fdateLastWrite; +10 FTIME ftimeLastWrite; +12 ULONG cbFile file length in bytes +16 ULONG cbFileAlloc size of file allocation unit +20 USHORT attrFile +} FILESTATUS; +*************************************************************/ + +/* Use the l1_ defines from DosFindFirst */ + +/********************************************************** +For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/ +DosSetFileInfo - level 2 + +typedef struct _FILESTATUS2 { +Byte offset Type name description +-------------+-------+-------------------+-------------- +0 FDATE fdateCreation; +2 FTIME ftimeCreation; +4 FDATE fdateLastAccess; +6 FTIME ftimeLastAccess; +8 FDATE fdateLastWrite; +10 FTIME ftimeLastWrite; +12 ULONG cbFile file length in bytes +16 ULONG cbFileAlloc size of file allocation unit +20 USHORT attrFile +22 ULONG cbList Length of EA's (0) +} FILESTATUS2; +*************************************************************/ + +/* Use the l2_ #defines from DosFindFirst */ + +/********************************************************** +For DosQFSInfo/DosSetFSInfo - level 1 + +typedef struct _FSALLOCATE { +Byte offset Type name description +-------------+-------+-------------------+-------------- +0 ULONG idFileSystem id of file system +4 ULONG cSectorUnit number of sectors per allocation unit +8 ULONG cUnit number of allocation units +12 ULONG cUnitAvail Available allocation units +16 USHORT cbSector bytes per sector +} FSALLOCATE; +*************************************************************/ + +#define l1_idFileSystem 0 +#define l1_cSectorUnit 4 +#define l1_cUnit 8 +#define l1_cUnitAvail 12 +#define l1_cbSector 16 + +/********************************************************** +For DosQFSInfo/DosSetFSInfo - level 2 + +typedef struct _FSINFO { +Byte offset Type name description +-------------+-------+-------------------+-------------- +0 FDATE vol_fdateCreation +2 FTIME vol_ftimeCreation +4 UCHAR vol_cch length of volume name (excluding NULL) +5 UCHAR vol_szVolLabel[12] volume name +} FSINFO; +*************************************************************/ + +#define SMB_INFO_STANDARD 1 /* FILESTATUS3 struct */ +#define SMB_INFO_SET_EA 2 /* EAOP2 struct, only valid on set not query */ +#define SMB_INFO_QUERY_EA_SIZE 2 /* FILESTATUS4 struct, only valid on query not set */ +#define SMB_INFO_QUERY_EAS_FROM_LIST 3 /* only valid on query not set */ +#define SMB_INFO_QUERY_ALL_EAS 4 /* only valid on query not set */ +#define SMB_INFO_IS_NAME_VALID 6 +#define SMB_INFO_STANDARD_LONG 11 /* similar to level 1, ie struct FileStatus3 */ +#define SMB_QUERY_EA_SIZE_LONG 12 /* similar to level 2, ie struct FileStatus4 */ +#define SMB_QUERY_FS_LABEL_INFO 0x101 +#define SMB_QUERY_FS_VOLUME_INFO 0x102 +#define SMB_QUERY_FS_SIZE_INFO 0x103 +#define SMB_QUERY_FS_DEVICE_INFO 0x104 +#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 +#if 0 +#define SMB_QUERY_FS_QUOTA_INFO +#endif + +#define l2_vol_fdateCreation 0 +#define l2_vol_cch 4 +#define l2_vol_szVolLabel 5 + + +#define SMB_QUERY_FILE_BASIC_INFO 0x101 +#define SMB_QUERY_FILE_STANDARD_INFO 0x102 +#define SMB_QUERY_FILE_EA_INFO 0x103 +#define SMB_QUERY_FILE_NAME_INFO 0x104 +#define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 +#define SMB_QUERY_FILE_END_OF_FILEINFO 0x106 +#define SMB_QUERY_FILE_ALL_INFO 0x107 +#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108 +#define SMB_QUERY_FILE_STREAM_INFO 0x109 +#define SMB_QUERY_COMPRESSION_INFO 0x10b + +#define SMB_FIND_INFO_STANDARD 1 +#define SMB_FIND_EA_SIZE 2 +#define SMB_FIND_EA_LIST 3 +#define SMB_FIND_FILE_DIRECTORY_INFO 0x101 +#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 +#define SMB_FIND_FILE_NAMES_INFO 0x103 +#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 +#define SMB_FIND_ID_FULL_DIRECTORY_INFO 0x105 +#define SMB_FIND_ID_BOTH_DIRECTORY_INFO 0x106 + +#define SMB_SET_FILE_BASIC_INFO 0x101 +#define SMB_SET_FILE_DISPOSITION_INFO 0x102 +#define SMB_SET_FILE_ALLOCATION_INFO 0x103 +#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 + +/* Query FS info. */ +#define SMB_INFO_ALLOCATION 1 +#define SMB_INFO_VOLUME 2 + +/* + * Thursby MAC extensions.... + */ + +/* + * MAC CIFS Extensions have the range 0x300 - 0x2FF reserved. + * Supposedly Microsoft have agreed to this. + */ + +#define MIN_MAC_INFO_LEVEL 0x300 +#define MAX_MAC_INFO_LEVEL 0x3FF + +#define SMB_MAC_QUERY_FS_INFO 0x301 + +#define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName)) + +/* + * DeviceType and Characteristics returned in a + * SMB_QUERY_FS_DEVICE_INFO call. + */ + +#define DEVICETYPE_CD_ROM 0x2 +#define DEVICETYPE_CD_ROM_FILE_SYSTEM 0x3 +#define DEVICETYPE_DISK 0x7 +#define DEVICETYPE_DISK_FILE_SYSTEM 0x8 +#define DEVICETYPE_FILE_SYSTEM 0x9 + +/* Characteristics. */ +#define TYPE_REMOVABLE_MEDIA 0x1 +#define TYPE_READ_ONLY_DEVICE 0x2 +#define TYPE_FLOPPY 0x4 +#define TYPE_WORM 0x8 +#define TYPE_REMOTE 0x10 +#define TYPE_MOUNTED 0x20 +#define TYPE_VIRTUAL 0x40 + +/* NT passthrough levels... */ + +#define SMB_FILE_DIRECTORY_INFORMATION 1001 +#define SMB_FILE_FULL_DIRECTORY_INFORMATION 1002 +#define SMB_FILE_BOTH_DIRECTORY_INFORMATION 1003 +#define SMB_FILE_BASIC_INFORMATION 1004 +#define SMB_FILE_STANDARD_INFORMATION 1005 +#define SMB_FILE_INTERNAL_INFORMATION 1006 +#define SMB_FILE_EA_INFORMATION 1007 +#define SMB_FILE_ACCESS_INFORMATION 1008 +#define SMB_FILE_NAME_INFORMATION 1009 +#define SMB_FILE_RENAME_INFORMATION 1010 +#define SMB_FILE_LINK_INFORMATION 1011 +#define SMB_FILE_NAMES_INFORMATION 1012 +#define SMB_FILE_DISPOSITION_INFORMATION 1013 +#define SMB_FILE_POSITION_INFORMATION 1014 +#define SMB_FILE_FULL_EA_INFORMATION 1015 +#define SMB_FILE_MODE_INFORMATION 1016 +#define SMB_FILE_ALIGNMENT_INFORMATION 1017 +#define SMB_FILE_ALL_INFORMATION 1018 +#define SMB_FILE_ALLOCATION_INFORMATION 1019 +#define SMB_FILE_END_OF_FILE_INFORMATION 1020 +#define SMB_FILE_ALTERNATE_NAME_INFORMATION 1021 +#define SMB_FILE_STREAM_INFORMATION 1022 +#define SMB_FILE_PIPE_INFORMATION 1023 +#define SMB_FILE_PIPE_LOCAL_INFORMATION 1024 +#define SMB_FILE_PIPE_REMOTE_INFORMATION 1025 +#define SMB_FILE_MAILSLOT_QUERY_INFORMATION 1026 +#define SMB_FILE_MAILSLOT_SET_INFORMATION 1027 +#define SMB_FILE_COMPRESSION_INFORMATION 1028 +#define SMB_FILE_OBJECTID_INFORMATION 1029 +#define SMB_FILE_COMPLETION_INFORMATION 1030 +#define SMB_FILE_MOVE_CLUSTER_INFORMATION 1031 +#define SMB_FILE_QUOTA_INFORMATION 1032 +#define SMB_FILE_REPARSEPOINT_INFORMATION 1033 +#define SMB_FILE_NETWORK_OPEN_INFORMATION 1034 +#define SMB_FILE_ATTRIBUTE_TAG_INFORMATION 1035 +#define SMB_FILE_TRACKING_INFORMATION 1036 +#define SMB_FILE_MAXIMUM_INFORMATION 1037 + +/* NT passthough levels for qfsinfo. */ + +#define SMB_FS_VOLUME_INFORMATION 1001 +#define SMB_FS_LABEL_INFORMATION 1002 +#define SMB_FS_SIZE_INFORMATION 1003 +#define SMB_FS_DEVICE_INFORMATION 1004 +#define SMB_FS_ATTRIBUTE_INFORMATION 1005 +#define SMB_FS_QUOTA_INFORMATION 1006 +#define SMB_FS_FULL_SIZE_INFORMATION 1007 +#define SMB_FS_OBJECTID_INFORMATION 1008 + +/* flags on trans2 findfirst/findnext that control search */ +#define FLAG_TRANS2_FIND_CLOSE 0x1 +#define FLAG_TRANS2_FIND_CLOSE_IF_END 0x2 +#define FLAG_TRANS2_FIND_REQUIRE_RESUME 0x4 +#define FLAG_TRANS2_FIND_CONTINUE 0x8 +#define FLAG_TRANS2_FIND_BACKUP_INTENT 0x10 + +/* UNIX CIFS Extensions - created by HP */ +/* + * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved. + * Supposedly Microsoft have agreed to this. + */ + +#define MIN_UNIX_INFO_LEVEL 0x200 +#define MAX_UNIX_INFO_LEVEL 0x2FF + +#define INFO_LEVEL_IS_UNIX(level) (((level) >= MIN_UNIX_INFO_LEVEL) && ((level) <= MAX_UNIX_INFO_LEVEL)) + +#define SMB_QUERY_FILE_UNIX_BASIC 0x200 /* UNIX File Info*/ +#define SMB_SET_FILE_UNIX_BASIC 0x200 +#define SMB_SET_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */ + +#define SMB_MODE_NO_CHANGE 0xFFFFFFFF /* file mode value which */ + /* means "don't change it" */ +#define SMB_UID_NO_CHANGE 0xFFFFFFFF +#define SMB_GID_NO_CHANGE 0xFFFFFFFF + +#define SMB_SIZE_NO_CHANGE_LO 0xFFFFFFFF +#define SMB_SIZE_NO_CHANGE_HI 0xFFFFFFFF + +#define SMB_TIME_NO_CHANGE_LO 0xFFFFFFFF +#define SMB_TIME_NO_CHANGE_HI 0xFFFFFFFF + +/* +Offset Size Name +0 LARGE_INTEGER EndOfFile File size +8 LARGE_INTEGER Blocks Number of bytes used on disk (st_blocks). +16 LARGE_INTEGER CreationTime Creation time +24 LARGE_INTEGER LastAccessTime Last access time +32 LARGE_INTEGER LastModificationTime Last modification time +40 LARGE_INTEGER Uid Numeric user id for the owner +48 LARGE_INTEGER Gid Numeric group id of owner +56 ULONG Type Enumeration specifying the pathname type: + 0 -- File + 1 -- Directory + 2 -- Symbolic link + 3 -- Character device + 4 -- Block device + 5 -- FIFO (named pipe) + 6 -- Unix domain socket + +60 LARGE_INTEGER devmajor Major device number if type is device +68 LARGE_INTEGER devminor Minor device number if type is device +76 LARGE_INTEGER uniqueid This is a server-assigned unique id for the file. The client + will typically map this onto an inode number. The scope of + uniqueness is the share. +84 LARGE_INTEGER permissions Standard UNIX file permissions - see below. +92 LARGE_INTEGER nlinks The number of directory entries that map to this entry + (number of hard links) + +100 - end. +*/ + +#define SMB_FILE_UNIX_BASIC_SIZE 100 + +/* UNIX filetype mappings. */ + +#define UNIX_TYPE_FILE 0 +#define UNIX_TYPE_DIR 1 +#define UNIX_TYPE_SYMLINK 2 +#define UNIX_TYPE_CHARDEV 3 +#define UNIX_TYPE_BLKDEV 4 +#define UNIX_TYPE_FIFO 5 +#define UNIX_TYPE_SOCKET 6 +#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF + +/* + * Oh this is fun. "Standard UNIX permissions" has no + * meaning in POSIX. We need to define the mapping onto + * and off the wire as this was not done in the original HP + * spec. JRA. + */ + +#define UNIX_X_OTH 0000001 +#define UNIX_W_OTH 0000002 +#define UNIX_R_OTH 0000004 +#define UNIX_X_GRP 0000010 +#define UNIX_W_GRP 0000020 +#define UNIX_R_GRP 0000040 +#define UNIX_X_USR 0000100 +#define UNIX_W_USR 0000200 +#define UNIX_R_USR 0000400 +#define UNIX_STICKY 0001000 +#define UNIX_SET_GID 0002000 +#define UNIX_SET_UID 0004000 + +/* Masks for the above */ +#define UNIX_OTH_MASK 0000007 +#define UNIX_GRP_MASK 0000070 +#define UNIX_USR_MASK 0000700 +#define UNIX_PERM_MASK 0000777 +#define UNIX_EXTRA_MASK 0007000 +#define UNIX_ALL_MASK 0007777 + +/* Flags for chflags (CIFS_UNIX_EXTATTR_CAP capability) and + * SMB_QUERY_FILE_UNIX_INFO2. + */ +#define EXT_SECURE_DELETE 0x00000001 +#define EXT_ENABLE_UNDELETE 0x00000002 +#define EXT_SYNCHRONOUS 0x00000004 +#define EXT_IMMUTABLE 0x00000008 +#define EXT_OPEN_APPEND_ONLY 0x00000010 +#define EXT_DO_NOT_BACKUP 0x00000020 +#define EXT_NO_UPDATE_ATIME 0x00000040 +#define EXT_HIDDEN 0x00000080 + +#define SMB_QUERY_FILE_UNIX_LINK 0x201 +#define SMB_SET_FILE_UNIX_LINK 0x201 +#define SMB_SET_FILE_UNIX_HLINK 0x203 +/* SMB_QUERY_POSIX_ACL 0x204 see below */ +#define SMB_QUERY_XATTR 0x205 /* need for non-user XATTRs */ +#define SMB_QUERY_ATTR_FLAGS 0x206 /* chflags, chattr */ +#define SMB_SET_ATTR_FLAGS 0x206 +#define SMB_QUERY_POSIX_PERMISSION 0x207 +/* Only valid for qfileinfo */ +#define SMB_QUERY_POSIX_LOCK 0x208 +/* Only valid for setfileinfo */ +#define SMB_SET_POSIX_LOCK 0x208 + +/* The set info levels for POSIX path operations. */ +#define SMB_POSIX_PATH_OPEN 0x209 +#define SMB_POSIX_PATH_UNLINK 0x20A + +#define SMB_QUERY_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */ +#define SMB_SET_FILE_UNIX_INFO2 0x20B + +/* +SMB_QUERY_FILE_UNIX_INFO2 is SMB_QUERY_FILE_UNIX_BASIC with create +time and file flags appended. The corresponding info level for +findfirst/findnext is SMB_FIND_FILE_UNIX_INFO2. + Size Offset Value + --------------------- + 0 LARGE_INTEGER EndOfFile File size + 8 LARGE_INTEGER Blocks Number of blocks used on disk + 16 LARGE_INTEGER ChangeTime Attribute change time + 24 LARGE_INTEGER LastAccessTime Last access time + 32 LARGE_INTEGER LastModificationTime Last modification time + 40 LARGE_INTEGER Uid Numeric user id for the owner + 48 LARGE_INTEGER Gid Numeric group id of owner + 56 ULONG Type Enumeration specifying the file type + 60 LARGE_INTEGER devmajor Major device number if type is device + 68 LARGE_INTEGER devminor Minor device number if type is device + 76 LARGE_INTEGER uniqueid This is a server-assigned unique id + 84 LARGE_INTEGER permissions Standard UNIX permissions + 92 LARGE_INTEGER nlinks Number of hard links + 100 LARGE_INTEGER CreationTime Create/birth time + 108 ULONG FileFlags File flags enumeration + 112 ULONG FileFlagsMask Mask of valid flags +*/ + +/* Transact 2 Find First levels */ +#define SMB_FIND_FILE_UNIX 0x202 +#define SMB_FIND_FILE_UNIX_INFO2 0x20B /* UNIX File Info2 */ + +#define SMB_FILE_UNIX_INFO2_SIZE 116 + +/* + Info level for TRANS2_QFSINFO - returns version of CIFS UNIX extensions, plus + 64-bits worth of capability fun :-). + Use the same info level for TRANS2_SETFSINFO +*/ + +#define SMB_QUERY_CIFS_UNIX_INFO 0x200 +#define SMB_SET_CIFS_UNIX_INFO 0x200 + +/* Returns or sets the following. + + UINT16 major version number + UINT16 minor version number + LARGE_INTEGER capability bitfield + +*/ + +#define CIFS_UNIX_MAJOR_VERSION 1 +#define CIFS_UNIX_MINOR_VERSION 0 + +#define CIFS_UNIX_FCNTL_LOCKS_CAP 0x1 +#define CIFS_UNIX_POSIX_ACLS_CAP 0x2 +#define CIFS_UNIX_XATTTR_CAP 0x4 /* for support of other xattr + namespaces such as system, + security and trusted */ +#define CIFS_UNIX_EXTATTR_CAP 0x8 /* for support of chattr + (chflags) and lsattr */ +#define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x10 /* Use POSIX pathnames on the wire. */ +#define CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP 0x20 /* We can cope with POSIX open/mkdir/unlink etc. */ +#define CIFS_UNIX_LARGE_READ_CAP 0x40 /* We can cope with 24 bit reads in readX. */ +#define CIFS_UNIX_LARGE_WRITE_CAP 0x80 /* We can cope with 24 bit writes in writeX. */ +#define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x100 /* We can do SPNEGO negotiations for encryption. */ +#define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP 0x200 /* We *must* SPNEGO negotiations for encryption. */ + +#define SMB_QUERY_POSIX_FS_INFO 0x201 + +/* Returns FILE_SYSTEM_POSIX_INFO struct as follows + (NB For undefined values return -1 in that field) + le32 OptimalTransferSize; bsize on some os, iosize on other os, This + is a hint to the client about best size. Server + can return -1 if no preference, ie if SMB + negotiated size is adequate for optimal + read/write performance + le32 BlockSize; (often 512 bytes) NB: BlockSize * TotalBlocks = disk space + le64 TotalBlocks; redundant with other infolevels but easy to ret here + le64 BlocksAvail; although redundant, easy to return + le64 UserBlocksAvail; bavail + le64 TotalFileNodes; + le64 FreeFileNodes; + le64 FileSysIdentifier; fsid + (NB statfs field Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call) + (NB statfs field flags can come from FILE_SYSTEM_DEVICE_INFO call) +*/ + +#define SMB_QUERY_POSIX_WHO_AM_I 0x202 /* QFS Info */ +/* returns: + __u32 flags; 0 = Authenticated user 1 = GUEST + __u32 mask; which flags bits server understands ie 0x0001 + __u64 unix_user_id; + __u64 unix_user_gid; + __u32 number_of_supplementary_gids; may be zero + __u32 number_of_sids; may be zero + __u32 length_of_sid_array; in bytes - may be zero + __u32 pad; reserved - MBZ + __u64 gid_array[0]; may be empty + __u8 * psid_list may be empty +*/ + +/* ... more as we think of them :-). */ + +/* SMB POSIX ACL definitions. */ +/* Wire format is (all little endian) : + +[2 bytes] - Version number. +[2 bytes] - Number of ACE entries to follow. +[2 bytes] - Number of default ACE entries to follow. +------------------------------------- +^ +| +ACE entries +| +v +------------------------------------- +^ +| +Default ACE entries +| +v +------------------------------------- + +Where an ACE entry looks like : + +[1 byte] - Entry type. + +Entry types are : + +ACL_USER_OBJ 0x01 +ACL_USER 0x02 +ACL_GROUP_OBJ 0x04 +ACL_GROUP 0x08 +ACL_MASK 0x10 +ACL_OTHER 0x20 + +[1 byte] - permissions (perm_t) + +perm_t types are : + +ACL_READ 0x04 +ACL_WRITE 0x02 +ACL_EXECUTE 0x01 + +[8 bytes] - uid/gid to apply this permission to. + +In the same format as the uid/gid fields in the other +UNIX extensions definitions. Use 0xFFFFFFFFFFFFFFFF for +the MASK and OTHER entry types. + +If the Number of ACE entries for either file or default ACE's +is set to 0xFFFF this means ignore this kind of ACE (and the +number of entries sent will be zero. + +*/ + +#define SMB_QUERY_POSIX_WHOAMI 0x202 + +enum smb_whoami_flags { + SMB_WHOAMI_GUEST = 0x1 /* Logged in as (or squashed to) guest */ +}; + +/* Mask of which WHOAMI bits are valid. This should make it easier for clients + * to cope with servers that have different sets of WHOAMI flags (as more get + * added). + */ +#define SMB_WHOAMI_MASK 0x00000001 + +/* + SMBWhoami - Query the user mapping performed by the server for the + connected tree. This is a subcommand of the TRANS2_QFSINFO. + + Returns: + 4 bytes unsigned - mapping flags (smb_whoami_flags) + 4 bytes unsigned - flags mask + + 8 bytes unsigned - primary UID + 8 bytes unsigned - primary GID + 4 bytes unsigned - number of supplementary GIDs + 4 bytes unsigned - number of SIDs + 4 bytes unsigned - SID list byte count + 4 bytes - pad / reserved (must be zero) + + 8 bytes unsigned[] - list of GIDs (may be empty) + DOM_SID[] - list of SIDs (may be empty) +*/ + +/* + * The following trans2 is done between client and server + * as a FSINFO call to set up the encryption state for transport + * encryption. + * This is a subcommand of the TRANS2_QFSINFO. + * + * The request looks like : + * + * [data block] -> SPNEGO framed GSSAPI request. + * + * The reply looks like : + * + * [data block] -> SPNEGO framed GSSAPI reply - if error + * is NT_STATUS_OK then we're done, if it's + * NT_STATUS_MORE_PROCESSING_REQUIRED then the + * client needs to keep going. If it's an + * error it can be any NT_STATUS error. + * + */ + +#define SMB_REQUEST_TRANSPORT_ENCRYPTION 0x203 /* QFSINFO */ + + +/* The query/set info levels for POSIX ACLs. */ +#define SMB_QUERY_POSIX_ACL 0x204 +#define SMB_SET_POSIX_ACL 0x204 + +/* Current on the wire ACL version. */ +#define SMB_POSIX_ACL_VERSION 1 + +/* ACE entry type. */ +#define SMB_POSIX_ACL_USER_OBJ 0x01 +#define SMB_POSIX_ACL_USER 0x02 +#define SMB_POSIX_ACL_GROUP_OBJ 0x04 +#define SMB_POSIX_ACL_GROUP 0x08 +#define SMB_POSIX_ACL_MASK 0x10 +#define SMB_POSIX_ACL_OTHER 0x20 + +/* perm_t types. */ +#define SMB_POSIX_ACL_READ 0x04 +#define SMB_POSIX_ACL_WRITE 0x02 +#define SMB_POSIX_ACL_EXECUTE 0x01 + +#define SMB_POSIX_ACL_HEADER_SIZE 6 +#define SMB_POSIX_ACL_ENTRY_SIZE 10 + +#define SMB_POSIX_IGNORE_ACE_ENTRIES 0xFFFF + +/* Definition of data block of SMB_SET_POSIX_LOCK */ +/* + [2 bytes] lock_type - 0 = Read, 1 = Write, 2 = Unlock + [2 bytes] lock_flags - 1 = Wait (only valid for setlock) + [4 bytes] pid = locking context. + [8 bytes] start = unsigned 64 bits. + [8 bytes] length = unsigned 64 bits. +*/ + +#define POSIX_LOCK_TYPE_OFFSET 0 +#define POSIX_LOCK_FLAGS_OFFSET 2 +#define POSIX_LOCK_PID_OFFSET 4 +#define POSIX_LOCK_START_OFFSET 8 +#define POSIX_LOCK_LEN_OFFSET 16 +#define POSIX_LOCK_DATA_SIZE 24 + +#define POSIX_LOCK_FLAG_NOWAIT 0 +#define POSIX_LOCK_FLAG_WAIT 1 + +#define POSIX_LOCK_TYPE_READ 0 +#define POSIX_LOCK_TYPE_WRITE 1 +#define POSIX_LOCK_TYPE_UNLOCK 2 + +/* SMB_POSIX_PATH_OPEN "open_mode" definitions. */ +#define SMB_O_RDONLY 0x1 +#define SMB_O_WRONLY 0x2 +#define SMB_O_RDWR 0x4 + +#define SMB_ACCMODE 0x7 + +#define SMB_O_CREAT 0x10 +#define SMB_O_EXCL 0x20 +#define SMB_O_TRUNC 0x40 +#define SMB_O_APPEND 0x80 +#define SMB_O_SYNC 0x100 +#define SMB_O_DIRECTORY 0x200 +#define SMB_O_NOFOLLOW 0x400 +#define SMB_O_DIRECT 0x800 + +/* Definition of request data block for SMB_POSIX_PATH_OPEN */ +/* + [4 bytes] flags (as smb_ntcreate_Flags). + [4 bytes] open_mode - SMB_O_xxx flags above. + [8 bytes] mode_t (permissions) - same encoding as "Standard UNIX permissions" above in SMB_SET_FILE_UNIX_BASIC. + [2 bytes] ret_info_level - optimization. Info level to be returned. +*/ + +/* Definition of reply data block for SMB_POSIX_PATH_OPEN */ + +#define SMB_NO_INFO_LEVEL_RETURNED 0xFFFF + +/* + [2 bytes] - flags field. Identical to flags reply for oplock response field in SMBNTCreateX) + [2 bytes] - FID returned. + [4 bytes] - CreateAction (same as in NTCreateX response). + [2 bytes] - reply info level - as requested or 0xFFFF if not available. + [2 bytes] - padding (must be zero) + [n bytes] - info level reply - if available. +*/ + +/* Definition of request data block for SMB_POSIX_UNLINK */ +/* + [2 bytes] flags (defined below). +*/ + +#define SMB_POSIX_UNLINK_FILE_TARGET 0 +#define SMB_POSIX_UNLINK_DIRECTORY_TARGET 1 + +#endif diff --git a/source3/include/transfer_file.h b/source3/include/transfer_file.h new file mode 100644 index 0000000000..79ad9c4c34 --- /dev/null +++ b/source3/include/transfer_file.h @@ -0,0 +1,32 @@ +/* + * Unix SMB/CIFS implementation. + * Utility functions to transfer files. + * + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __TRANSFER_FILE_H__ +#define __TRANSFER_FILE_H__ + +ssize_t transfer_file_internal(void *in_file, + void *out_file, + size_t n, + ssize_t (*read_fn)(void *, void *, size_t), + ssize_t (*write_fn)(void *, const void *, size_t)); + +SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n); + +#endif /* __TRANSFER_FILE_H__ */ diff --git a/source3/include/util_getent.h b/source3/include/util_getent.h new file mode 100644 index 0000000000..c260e70f45 --- /dev/null +++ b/source3/include/util_getent.h @@ -0,0 +1,60 @@ +/* + Unix SMB/CIFS implementation. + Samba utility functions + Copyright (C) Simo Sorce 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _UTIL_GETENT_H +#define _UTIL_GETENT_H + +/* Element for a single linked list of group entries */ +/* Replace the use of struct group in some cases */ +/* Used by getgrent_list() */ + +struct sys_grent { + char *gr_name; + char *gr_passwd; + gid_t gr_gid; + char **gr_mem; + struct sys_grent *next; +}; + +/* Element for a single linked list of passwd entries */ +/* Replace the use of struct passwd in some cases */ +/* Used by getpwent_list() */ + +struct sys_pwent { + char *pw_name; + char *pw_passwd; + uid_t pw_uid; + gid_t pw_gid; + char *pw_gecos; + char *pw_dir; + char *pw_shell; + struct sys_pwent *next; +}; + +/* Element for a single linked list of user names in a group. */ +/* Used to return group lists that may span multiple lines in + /etc/group file. */ +/* Used by get_users_in_group() */ + +struct sys_userlist { + struct sys_userlist *next, *prev; + char *unix_name; +}; + +#endif /* _UTIL_GETENT_H */ diff --git a/source3/include/util_tdb.h b/source3/include/util_tdb.h new file mode 100644 index 0000000000..fcc723c511 --- /dev/null +++ b/source3/include/util_tdb.h @@ -0,0 +1,108 @@ +/* + Unix SMB/CIFS implementation. + tdb utility functions + Copyright (C) Andrew Tridgell 1999 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __TDBUTIL_H__ +#define __TDBUTIL_H__ + +#include "tdb.h" + +#include "talloc.h" /* for tdb_wrap_open() */ +#include "nt_status.h" /* for map_nt_error_from_tdb() */ + +/* single node of a list returned by tdb_search_keys */ +typedef struct keys_node +{ + struct keys_node *prev, *next; + TDB_DATA node_key; +} TDB_LIST_NODE; + +struct tdb_wrap { + struct tdb_context *tdb; + const char *name; + struct tdb_wrap *next, *prev; +}; + +struct tdb_validation_status { + bool tdb_error; + bool bad_freelist; + bool bad_entry; + bool unknown_key; + bool success; +}; + +typedef int (*tdb_validate_data_func)(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state); + +TDB_DATA make_tdb_data(const uint8 *dptr, size_t dsize); +TDB_DATA string_tdb_data(const char *string); +TDB_DATA string_term_tdb_data(const char *string); + +TDB_LIST_NODE *tdb_search_keys(struct tdb_context*, const char*); +void tdb_search_list_free(TDB_LIST_NODE*); + +int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, + unsigned int timeout); +int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval); +int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, + int timeout); +void tdb_unlock_bystring(struct tdb_context *tdb, const char *keyval); +int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, + unsigned int timeout); +void tdb_read_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval); + +int32 tdb_fetch_int32_byblob(TDB_CONTEXT *tdb, TDB_DATA key); +int32 tdb_fetch_int32(struct tdb_context *tdb, const char *keystr); +bool tdb_store_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 value); +bool tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32 value); +int tdb_store_int32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, int32 v); +int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32 v); +bool tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 *value); +bool tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32 *value); +int32 tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int32 *oldval, int32 change_val); +bool tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, + uint32 *oldval, uint32 change_val); + +int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags); +int tdb_trans_store_bystring(TDB_CONTEXT *tdb, const char *keystr, + TDB_DATA data, int flags); +TDB_DATA tdb_fetch_bystring(struct tdb_context *tdb, const char *keystr); +int tdb_delete_bystring(struct tdb_context *tdb, const char *keystr); +int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, + int flag); +int tdb_trans_delete(struct tdb_context *tdb, TDB_DATA key); + +int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...); +size_t tdb_pack(uint8 *buf, int bufsize, const char *fmt, ...); +bool tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len, + const char *fmt, ...); + +struct tdb_context *tdb_open_log(const char *name, int hash_size, + int tdb_flags, int open_flags, mode_t mode); + +struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, + const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode); + +NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err); + +int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn); +int tdb_validate_open(const char *tdb_path, tdb_validate_data_func validate_fn); +int tdb_validate_and_backup(const char *tdb_path, + tdb_validate_data_func validate_fn); + +#endif /* __TDBUTIL_H__ */ diff --git a/source3/include/vfs.h b/source3/include/vfs.h new file mode 100644 index 0000000000..9b72f69328 --- /dev/null +++ b/source3/include/vfs.h @@ -0,0 +1,694 @@ +/* + Unix SMB/CIFS implementation. + VFS structures and parameters + Copyright (C) Jeremy Allison 1999-2005 + Copyright (C) Tim Potter 1999 + Copyright (C) Alexander Bokovoy 2002-2005 + Copyright (C) Stefan (metze) Metzmacher 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + This work was sponsored by Optifacio Software Services, Inc. +*/ + +#ifndef _VFS_H +#define _VFS_H + +/* Avoid conflict with an AIX include file */ + +#ifdef vfs_ops +#undef vfs_ops +#endif + +/* + * As we're now (thanks Andrew ! :-) using file_structs and connection + * structs in the vfs - then anyone writing a vfs must include includes.h... + */ + +/* + * This next constant specifies the version number of the VFS interface + * this smbd will load. Increment this if *ANY* changes are made to the + * vfs_ops below. JRA. + * + * If you change anything here, please also update modules/vfs_full_audit.c. + * VL. + */ + +/* Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA. */ +/* Changed to version 3 for POSIX acl extensions. JRA. */ +/* Changed to version 4 for cascaded VFS interface. Alexander Bokovoy. */ +/* Changed to version 5 for sendfile addition. JRA. */ +/* Changed to version 6 for the new module system, fixed cascading and quota functions. --metze */ +/* Changed to version 7 to include the get_nt_acl info parameter. JRA. */ +/* Changed to version 8 includes EA calls. JRA. */ +/* Changed to version 9 to include the get_shadow_data call. --metze */ +/* Changed to version 10 to include pread/pwrite calls. */ +/* Changed to version 11 to include seekdir/telldir/rewinddir calls. JRA */ +/* Changed to version 12 to add mask and attributes to opendir(). JRA + Also include aio calls. JRA. */ +/* Changed to version 13 as the internal structure of files_struct has changed. JRA */ +/* Changed to version 14 as we had to change DIR to SMB_STRUCT_DIR. JRA */ +/* Changed to version 15 as we added the statvfs call. JRA */ +/* Changed to version 16 as we added the getlock call. JRA */ +/* Changed to version 17 as we removed redundant connection_struct parameters. --jpeach */ +/* Changed to version 18 to add fsp parameter to the open call -- jpeach + Also include kernel_flock call - jmcd */ +/* Changed to version 19, kernel change notify has been merged + Also included linux setlease call - jmcd */ +/* Changed to version 20, use ntimes call instead of utime (greater + * timestamp resolition. JRA. */ +/* Changed to version21 to add chflags operation -- jpeach */ +/* Changed to version22 to add lchown operation -- jra */ +/* Leave at 22 - not yet released. But change set_nt_acl to return an NTSTATUS. jra. */ +/* Leave at 22 - not yet released. Add file_id_create operation. --metze */ +/* Leave at 22 - not yet released. Change all BOOL parameters (int) to bool. jra. */ +/* Leave at 22 - not yet released. Added recvfile. */ +/* Leave at 22 - not yet released. Change get_nt_acl to return NTSTATUS - vl */ +/* Leave at 22 - not yet released. Change get_nt_acl to *not* take a + * files_struct. - obnox.*/ +/* Leave at 22 - not yet released. Remove parameter fd from fget_nt_acl. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from gset_nt_acl. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from pread. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from pwrite. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from lseek. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fsync. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fstat. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fchmod. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fchown. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from ftruncate. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from lock. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from kernel_flock. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from linux_setlease. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from getlock. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from sys_acl_get_fd. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fchmod_acl. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from sys_acl_set_fd. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fgetxattr. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from flistxattr. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fremovexattr. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from fsetxattr. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from aio_cancel. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from read. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */ +/* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */ +/* Leave at 22 - not yet released. Additional change: add operations for offline files -- ab */ +/* Leave at 22 - not yet released. Add the streaminfo call. -- jpeach, vl */ +/* Leave at 22 - not yet released. Remove parameter fd from close_fn. - obnox */ +/* Changed to version 23 - remove set_nt_acl call. This can only be done via an + open handle. JRA. */ + +#define SMB_VFS_INTERFACE_VERSION 23 + + +/* to bug old modules which are trying to compile with the old functions */ +#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 }; +#define lp_parm_string __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string { \ + __ERROR_please_port_lp_parm_string_to_lp_parm_const_string_or_lp_parm_talloc_string }; +#define lp_vfs_options __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead { \ + __ERROR_please_donot_use_lp_vfs_options_anymore_use_lp_parm_xxxx_functions_instead }; + +/* + All intercepted VFS operations must be declared as static functions inside module source + in order to keep smbd namespace unpolluted. See source of audit, extd_audit, fake_perms and recycle + example VFS modules for more details. +*/ + +/* VFS operations structure */ + +struct vfs_handle_struct; +struct connection_struct; +struct files_struct; +struct security_descriptor; +struct vfs_statvfs_struct; + +/* + Available VFS operations. These values must be in sync with vfs_ops struct + (struct vfs_fn_pointers and struct vfs_handle_pointers inside of struct vfs_ops). + In particular, if new operations are added to vfs_ops, appropriate constants + should be added to vfs_op_type so that order of them kept same as in vfs_ops. +*/ + +typedef enum _vfs_op_type { + SMB_VFS_OP_NOOP = -1, + + /* Disk operations */ + + SMB_VFS_OP_CONNECT = 0, + SMB_VFS_OP_DISCONNECT, + SMB_VFS_OP_DISK_FREE, + SMB_VFS_OP_GET_QUOTA, + SMB_VFS_OP_SET_QUOTA, + SMB_VFS_OP_GET_SHADOW_COPY_DATA, + SMB_VFS_OP_STATVFS, + SMB_VFS_OP_FS_CAPABILITIES, + + /* Directory operations */ + + SMB_VFS_OP_OPENDIR, + SMB_VFS_OP_READDIR, + SMB_VFS_OP_SEEKDIR, + SMB_VFS_OP_TELLDIR, + SMB_VFS_OP_REWINDDIR, + SMB_VFS_OP_MKDIR, + SMB_VFS_OP_RMDIR, + SMB_VFS_OP_CLOSEDIR, + + /* File operations */ + + SMB_VFS_OP_OPEN, + SMB_VFS_OP_CLOSE, + SMB_VFS_OP_READ, + SMB_VFS_OP_PREAD, + SMB_VFS_OP_WRITE, + SMB_VFS_OP_PWRITE, + SMB_VFS_OP_LSEEK, + SMB_VFS_OP_SENDFILE, + SMB_VFS_OP_RECVFILE, + SMB_VFS_OP_RENAME, + SMB_VFS_OP_FSYNC, + SMB_VFS_OP_STAT, + SMB_VFS_OP_FSTAT, + SMB_VFS_OP_LSTAT, + SMB_VFS_OP_UNLINK, + SMB_VFS_OP_CHMOD, + SMB_VFS_OP_FCHMOD, + SMB_VFS_OP_CHOWN, + SMB_VFS_OP_FCHOWN, + SMB_VFS_OP_LCHOWN, + SMB_VFS_OP_CHDIR, + SMB_VFS_OP_GETWD, + SMB_VFS_OP_NTIMES, + SMB_VFS_OP_FTRUNCATE, + SMB_VFS_OP_LOCK, + SMB_VFS_OP_KERNEL_FLOCK, + SMB_VFS_OP_LINUX_SETLEASE, + SMB_VFS_OP_GETLOCK, + SMB_VFS_OP_SYMLINK, + SMB_VFS_OP_READLINK, + SMB_VFS_OP_LINK, + SMB_VFS_OP_MKNOD, + SMB_VFS_OP_REALPATH, + SMB_VFS_OP_NOTIFY_WATCH, + SMB_VFS_OP_CHFLAGS, + SMB_VFS_OP_FILE_ID_CREATE, + SMB_VFS_OP_STREAMINFO, + + /* NT ACL operations. */ + + SMB_VFS_OP_FGET_NT_ACL, + SMB_VFS_OP_GET_NT_ACL, + SMB_VFS_OP_FSET_NT_ACL, + + /* POSIX ACL operations. */ + + SMB_VFS_OP_CHMOD_ACL, + SMB_VFS_OP_FCHMOD_ACL, + + SMB_VFS_OP_SYS_ACL_GET_ENTRY, + SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, + SMB_VFS_OP_SYS_ACL_GET_PERMSET, + SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, + SMB_VFS_OP_SYS_ACL_GET_FILE, + SMB_VFS_OP_SYS_ACL_GET_FD, + SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, + SMB_VFS_OP_SYS_ACL_ADD_PERM, + SMB_VFS_OP_SYS_ACL_TO_TEXT, + SMB_VFS_OP_SYS_ACL_INIT, + SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, + SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, + SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, + SMB_VFS_OP_SYS_ACL_SET_PERMSET, + SMB_VFS_OP_SYS_ACL_VALID, + SMB_VFS_OP_SYS_ACL_SET_FILE, + SMB_VFS_OP_SYS_ACL_SET_FD, + SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, + SMB_VFS_OP_SYS_ACL_GET_PERM, + SMB_VFS_OP_SYS_ACL_FREE_TEXT, + SMB_VFS_OP_SYS_ACL_FREE_ACL, + SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, + + /* EA operations. */ + SMB_VFS_OP_GETXATTR, + SMB_VFS_OP_LGETXATTR, + SMB_VFS_OP_FGETXATTR, + SMB_VFS_OP_LISTXATTR, + SMB_VFS_OP_LLISTXATTR, + SMB_VFS_OP_FLISTXATTR, + SMB_VFS_OP_REMOVEXATTR, + SMB_VFS_OP_LREMOVEXATTR, + SMB_VFS_OP_FREMOVEXATTR, + SMB_VFS_OP_SETXATTR, + SMB_VFS_OP_LSETXATTR, + SMB_VFS_OP_FSETXATTR, + + /* aio operations */ + SMB_VFS_OP_AIO_READ, + SMB_VFS_OP_AIO_WRITE, + SMB_VFS_OP_AIO_RETURN, + SMB_VFS_OP_AIO_CANCEL, + SMB_VFS_OP_AIO_ERROR, + SMB_VFS_OP_AIO_FSYNC, + SMB_VFS_OP_AIO_SUSPEND, + SMB_VFS_OP_AIO_FORCE, + + /* offline operations */ + SMB_VFS_OP_IS_OFFLINE, + SMB_VFS_OP_SET_OFFLINE, + + /* This should always be last enum value */ + + SMB_VFS_OP_LAST +} vfs_op_type; + +/* + Please keep vfs_op_type, struct vfs_fn_pointers and struct vfs_handles_pointers in sync. +*/ +struct vfs_ops { + struct vfs_fn_pointers { + /* Disk operations */ + + int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user); + void (*disconnect)(struct vfs_handle_struct *handle); + SMB_BIG_UINT (*disk_free)(struct vfs_handle_struct *handle, const char *path, bool small_query, SMB_BIG_UINT *bsize, + SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); + int (*get_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt); + int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt); + int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels); + int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf); + uint32_t (*fs_capabilities)(struct vfs_handle_struct *handle); + + /* Directory operations */ + + SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes); + SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp); + void (*seekdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset); + long (*telldir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp); + void (*rewind_dir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp); + int (*mkdir)(struct vfs_handle_struct *handle, const char *path, mode_t mode); + int (*rmdir)(struct vfs_handle_struct *handle, const char *path); + int (*closedir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir); + + /* File operations */ + + int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode); + int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp); + ssize_t (*vfs_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n); + ssize_t (*pread)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); + ssize_t (*write)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n); + ssize_t (*pwrite)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); + SMB_OFF_T (*lseek)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence); + ssize_t (*sendfile)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); + ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t count); + int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname); + int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp); + int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf); + int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf); + int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); + int (*unlink)(struct vfs_handle_struct *handle, const char *path); + int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode); + int (*fchmod)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode); + int (*chown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); + int (*fchown)(struct vfs_handle_struct *handle, struct files_struct *fsp, uid_t uid, gid_t gid); + int (*lchown)(struct vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid); + int (*chdir)(struct vfs_handle_struct *handle, const char *path); + char *(*getwd)(struct vfs_handle_struct *handle, char *buf); + int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]); + int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset); + bool (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); + int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode); + int (*linux_setlease)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype); + bool (*getlock)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); + int (*symlink)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); + int (*vfs_readlink)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz); + int (*link)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); + int (*mknod)(struct vfs_handle_struct *handle, const char *path, mode_t mode, SMB_DEV_T dev); + char *(*realpath)(struct vfs_handle_struct *handle, const char *path, char *resolved_path); + NTSTATUS (*notify_watch)(struct vfs_handle_struct *handle, + struct sys_notify_context *ctx, + struct notify_entry *e, + void (*callback)(struct sys_notify_context *ctx, + void *private_data, + struct notify_event *ev), + void *private_data, void *handle_p); + int (*chflags)(struct vfs_handle_struct *handle, const char *path, unsigned int flags); + struct file_id (*file_id_create)(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode); + + NTSTATUS (*streaminfo)(struct vfs_handle_struct *handle, + struct files_struct *fsp, + const char *fname, + TALLOC_CTX *mem_ctx, + unsigned int *num_streams, + struct stream_struct **streams); + + /* NT ACL operations. */ + + NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle, + struct files_struct *fsp, + uint32 security_info, + struct security_descriptor **ppdesc); + NTSTATUS (*get_nt_acl)(struct vfs_handle_struct *handle, + const char *name, + uint32 security_info, + struct security_descriptor **ppdesc); + NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle, + struct files_struct *fsp, + uint32 security_info_sent, + struct security_descriptor *psd); + + /* POSIX ACL operations. */ + + int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode); + int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode); + + int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p); + int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p); + int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); + void * (*sys_acl_get_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d); + SMB_ACL_T (*sys_acl_get_file)(struct vfs_handle_struct *handle, const char *path_p, SMB_ACL_TYPE_T type); + SMB_ACL_T (*sys_acl_get_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp); + int (*sys_acl_clear_perms)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset); + int (*sys_acl_add_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm); + char * (*sys_acl_to_text)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, ssize_t *plen); + SMB_ACL_T (*sys_acl_init)(struct vfs_handle_struct *handle, int count); + int (*sys_acl_create_entry)(struct vfs_handle_struct *handle, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry); + int (*sys_acl_set_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype); + int (*sys_acl_set_qualifier)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, void *qual); + int (*sys_acl_set_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset); + int (*sys_acl_valid)(struct vfs_handle_struct *handle, SMB_ACL_T theacl ); + int (*sys_acl_set_file)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl); + int (*sys_acl_set_fd)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl); + int (*sys_acl_delete_def_file)(struct vfs_handle_struct *handle, const char *path); + int (*sys_acl_get_perm)(struct vfs_handle_struct *handle, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm); + int (*sys_acl_free_text)(struct vfs_handle_struct *handle, char *text); + int (*sys_acl_free_acl)(struct vfs_handle_struct *handle, SMB_ACL_T posix_acl); + int (*sys_acl_free_qualifier)(struct vfs_handle_struct *handle, void *qualifier, SMB_ACL_TAG_T tagtype); + + /* EA operations. */ + ssize_t (*getxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size); + ssize_t (*lgetxattr)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size); + ssize_t (*fgetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size); + ssize_t (*listxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); + ssize_t (*llistxattr)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size); + ssize_t (*flistxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size); + int (*removexattr)(struct vfs_handle_struct *handle, const char *path, const char *name); + int (*lremovexattr)(struct vfs_handle_struct *handle, const char *path, const char *name); + int (*fremovexattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name); + int (*setxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags); + int (*lsetxattr)(struct vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags); + int (*fsetxattr)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, const void *value, size_t size, int flags); + + /* aio operations */ + int (*aio_read)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); + int (*aio_write)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); + ssize_t (*aio_return_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); + int (*aio_cancel)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); + int (*aio_error_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); + int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb); + int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout); + bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp); + + /* offline operations */ + bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); + int (*set_offline)(struct vfs_handle_struct *handle, const char *path); + } ops; + + struct vfs_handles_pointers { + /* Disk operations */ + + struct vfs_handle_struct *connect_hnd; + struct vfs_handle_struct *disconnect; + struct vfs_handle_struct *disk_free; + struct vfs_handle_struct *get_quota; + struct vfs_handle_struct *set_quota; + struct vfs_handle_struct *get_shadow_copy_data; + struct vfs_handle_struct *statvfs; + struct vfs_handle_struct *fs_capabilities; + + /* Directory operations */ + + struct vfs_handle_struct *opendir; + struct vfs_handle_struct *readdir; + struct vfs_handle_struct *seekdir; + struct vfs_handle_struct *telldir; + struct vfs_handle_struct *rewind_dir; + struct vfs_handle_struct *mkdir; + struct vfs_handle_struct *rmdir; + struct vfs_handle_struct *closedir; + + /* File operations */ + + struct vfs_handle_struct *open; + struct vfs_handle_struct *close_hnd; + struct vfs_handle_struct *vfs_read; + struct vfs_handle_struct *pread; + struct vfs_handle_struct *write; + struct vfs_handle_struct *pwrite; + struct vfs_handle_struct *lseek; + struct vfs_handle_struct *sendfile; + struct vfs_handle_struct *recvfile; + struct vfs_handle_struct *rename; + struct vfs_handle_struct *fsync; + struct vfs_handle_struct *stat; + struct vfs_handle_struct *fstat; + struct vfs_handle_struct *lstat; + struct vfs_handle_struct *unlink; + struct vfs_handle_struct *chmod; + struct vfs_handle_struct *fchmod; + struct vfs_handle_struct *chown; + struct vfs_handle_struct *fchown; + struct vfs_handle_struct *lchown; + struct vfs_handle_struct *chdir; + struct vfs_handle_struct *getwd; + struct vfs_handle_struct *ntimes; + struct vfs_handle_struct *ftruncate; + struct vfs_handle_struct *lock; + struct vfs_handle_struct *kernel_flock; + struct vfs_handle_struct *linux_setlease; + struct vfs_handle_struct *getlock; + struct vfs_handle_struct *symlink; + struct vfs_handle_struct *vfs_readlink; + struct vfs_handle_struct *link; + struct vfs_handle_struct *mknod; + struct vfs_handle_struct *realpath; + struct vfs_handle_struct *notify_watch; + struct vfs_handle_struct *chflags; + struct vfs_handle_struct *file_id_create; + struct vfs_handle_struct *streaminfo; + + /* NT ACL operations. */ + + struct vfs_handle_struct *fget_nt_acl; + struct vfs_handle_struct *get_nt_acl; + struct vfs_handle_struct *fset_nt_acl; + + /* POSIX ACL operations. */ + + struct vfs_handle_struct *chmod_acl; + struct vfs_handle_struct *fchmod_acl; + + struct vfs_handle_struct *sys_acl_get_entry; + struct vfs_handle_struct *sys_acl_get_tag_type; + struct vfs_handle_struct *sys_acl_get_permset; + struct vfs_handle_struct *sys_acl_get_qualifier; + struct vfs_handle_struct *sys_acl_get_file; + struct vfs_handle_struct *sys_acl_get_fd; + struct vfs_handle_struct *sys_acl_clear_perms; + struct vfs_handle_struct *sys_acl_add_perm; + struct vfs_handle_struct *sys_acl_to_text; + struct vfs_handle_struct *sys_acl_init; + struct vfs_handle_struct *sys_acl_create_entry; + struct vfs_handle_struct *sys_acl_set_tag_type; + struct vfs_handle_struct *sys_acl_set_qualifier; + struct vfs_handle_struct *sys_acl_set_permset; + struct vfs_handle_struct *sys_acl_valid; + struct vfs_handle_struct *sys_acl_set_file; + struct vfs_handle_struct *sys_acl_set_fd; + struct vfs_handle_struct *sys_acl_delete_def_file; + struct vfs_handle_struct *sys_acl_get_perm; + struct vfs_handle_struct *sys_acl_free_text; + struct vfs_handle_struct *sys_acl_free_acl; + struct vfs_handle_struct *sys_acl_free_qualifier; + + /* EA operations. */ + struct vfs_handle_struct *getxattr; + struct vfs_handle_struct *lgetxattr; + struct vfs_handle_struct *fgetxattr; + struct vfs_handle_struct *listxattr; + struct vfs_handle_struct *llistxattr; + struct vfs_handle_struct *flistxattr; + struct vfs_handle_struct *removexattr; + struct vfs_handle_struct *lremovexattr; + struct vfs_handle_struct *fremovexattr; + struct vfs_handle_struct *setxattr; + struct vfs_handle_struct *lsetxattr; + struct vfs_handle_struct *fsetxattr; + + /* aio operations */ + struct vfs_handle_struct *aio_read; + struct vfs_handle_struct *aio_write; + struct vfs_handle_struct *aio_return; + struct vfs_handle_struct *aio_cancel; + struct vfs_handle_struct *aio_error; + struct vfs_handle_struct *aio_fsync; + struct vfs_handle_struct *aio_suspend; + struct vfs_handle_struct *aio_force; + + /* offline operations */ + struct vfs_handle_struct *is_offline; + struct vfs_handle_struct *set_offline; + } handles; +}; + +/* + Possible VFS operation layers (per-operation) + + These values are used by VFS subsystem when building vfs_ops for connection + from multiple VFS modules. Internally, Samba differentiates only opaque and + transparent layers at this process. Other types are used for providing better + diagnosing facilities. + + Most modules will provide transparent layers. Opaque layer is for modules + which implement actual file system calls (like DB-based VFS). For example, + default POSIX VFS which is built in into Samba is an opaque VFS module. + + Other layer types (audit, splitter, scanner) were designed to provide different + degree of transparency and for diagnosing VFS module behaviour. + + Each module can implement several layers at the same time provided that only + one layer is used per each operation. + +*/ + +typedef enum _vfs_op_layer { + SMB_VFS_LAYER_NOOP = -1, /* - For using in VFS module to indicate end of array */ + /* of operations description */ + SMB_VFS_LAYER_OPAQUE = 0, /* - Final level, does not call anything beyond itself */ + SMB_VFS_LAYER_TRANSPARENT, /* - Normal operation, calls underlying layer after */ + /* possibly changing passed data */ + SMB_VFS_LAYER_LOGGER, /* - Logs data, calls underlying layer, logging may not */ + /* use Samba VFS */ + SMB_VFS_LAYER_SPLITTER, /* - Splits operation, calls underlying layer _and_ own facility, */ + /* then combines result */ + SMB_VFS_LAYER_SCANNER /* - Checks data and possibly initiates additional */ + /* file activity like logging to files _inside_ samba VFS */ +} vfs_op_layer; + +/* + VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem, + which describes all operations this module is willing to intercept. + VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs + using this information. +*/ + +typedef struct vfs_op_tuple { + void* op; + vfs_op_type type; + vfs_op_layer layer; +} vfs_op_tuple; + + +typedef struct vfs_handle_struct { + struct vfs_handle_struct *next, *prev; + const char *param; + struct vfs_ops vfs_next; + struct connection_struct *conn; + void *data; + void (*free_data)(void **data); +} vfs_handle_struct; + + +typedef struct vfs_statvfs_struct { + /* For undefined recommended transfer size return -1 in that field */ + uint32 OptimalTransferSize; /* bsize on some os, iosize on other os */ + uint32 BlockSize; + + /* + The next three fields are in terms of the block size. + (above). If block size is unknown, 4096 would be a + reasonable block size for a server to report. + Note that returning the blocks/blocksavail removes need + to make a second call (to QFSInfo level 0x103 to get this info. + UserBlockAvail is typically less than or equal to BlocksAvail, + if no distinction is made return the same value in each. + */ + + SMB_BIG_UINT TotalBlocks; + SMB_BIG_UINT BlocksAvail; /* bfree */ + SMB_BIG_UINT UserBlocksAvail; /* bavail */ + + /* For undefined Node fields or FSID return -1 */ + SMB_BIG_UINT TotalFileNodes; + SMB_BIG_UINT FreeFileNodes; + SMB_BIG_UINT FsIdentifier; /* fsid */ + /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */ + /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */ + + int FsCapabilities; +} vfs_statvfs_struct; + +/* Add a new FSP extension of the given type. Returns a pointer to the + * extenstion data. + */ +#define VFS_ADD_FSP_EXTENSION(handle, fsp, type) \ + vfs_add_fsp_extension_notype(handle, (fsp), sizeof(type)) + +/* Return a pointer to the existing FSP extension data. */ +#define VFS_FETCH_FSP_EXTENSION(handle, fsp) \ + vfs_fetch_fsp_extension(handle, (fsp)) + +/* Return the talloc context associated with an FSP extension. */ +#define VFS_MEMCTX_FSP_EXTENSION(handle, fsp) \ + vfs_memctx_fsp_extension(handle, (fsp)) + +/* Remove and destroy an FSP extension. */ +#define VFS_REMOVE_FSP_EXTENSION(handle, fsp) \ + vfs_remove_fsp_extension((handle), (fsp)) + +#define SMB_VFS_HANDLE_GET_DATA(handle, datap, type, ret) { \ + if (!(handle)||((datap=(type *)(handle)->data)==NULL)) { \ + DEBUG(0,("%s() failed to get vfs_handle->data!\n",FUNCTION_MACRO)); \ + ret; \ + } \ +} + +#define SMB_VFS_HANDLE_SET_DATA(handle, datap, free_fn, type, ret) { \ + if (!(handle)) { \ + DEBUG(0,("%s() failed to set handle->data!\n",FUNCTION_MACRO)); \ + ret; \ + } else { \ + if ((handle)->free_data) { \ + (handle)->free_data(&(handle)->data); \ + } \ + (handle)->data = (void *)datap; \ + (handle)->free_data = free_fn; \ + } \ +} + +#define SMB_VFS_HANDLE_FREE_DATA(handle) { \ + if ((handle) && (handle)->free_data) { \ + (handle)->free_data(&(handle)->data); \ + } \ +} + +/* Check whether module-specific data handle was already allocated or not */ +#define SMB_VFS_HANDLE_TEST_DATA(handle) ( !(handle) || !(handle)->data ? False : True ) + +#define SMB_VFS_OP(x) ((void *) x) + +#define DEFAULT_VFS_MODULE_NAME "/[Default VFS]/" + +#include "vfs_macros.h" + +#endif /* _VFS_H */ diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h new file mode 100644 index 0000000000..7b3aeaa2c7 --- /dev/null +++ b/source3/include/vfs_macros.h @@ -0,0 +1,399 @@ +/* + Unix SMB/CIFS implementation. + VFS wrapper macros + Copyright (C) Stefan (metze) Metzmacher 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _VFS_MACROS_H +#define _VFS_MACROS_H + +/******************************************************************* + Don't access conn->vfs.ops.* directly!!! + Use this macros! + (Fixes should go also into the vfs_opaque_* and vfs_next_* macros!) +********************************************************************/ + +/* Disk operations */ +#define SMB_VFS_CONNECT(conn, service, user) ((conn)->vfs.ops.connect_fn((conn)->vfs.handles.connect_hnd, (service), (user))) +#define SMB_VFS_DISCONNECT(conn) ((conn)->vfs.ops.disconnect((conn)->vfs.handles.disconnect)) +#define SMB_VFS_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs.ops.disk_free((conn)->vfs.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) +#define SMB_VFS_GET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.get_quota((conn)->vfs.handles.get_quota, (qtype), (id), (qt))) +#define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs.ops.set_quota((conn)->vfs.handles.set_quota, (qtype), (id), (qt))) +#define SMB_VFS_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs.ops.get_shadow_copy_data((fsp)->conn->vfs.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels))) +#define SMB_VFS_STATVFS(conn, path, statbuf) ((conn)->vfs.ops.statvfs((conn)->vfs.handles.statvfs, (path), (statbuf))) +#define SMB_VFS_FS_CAPABILITIES(conn) ((conn)->vfs.ops.fs_capabilities((conn)->vfs.handles.fs_capabilities)) + +/* Directory operations */ +#define SMB_VFS_OPENDIR(conn, fname, mask, attr) ((conn)->vfs.ops.opendir((conn)->vfs.handles.opendir, (fname), (mask), (attr))) +#define SMB_VFS_READDIR(conn, dirp) ((conn)->vfs.ops.readdir((conn)->vfs.handles.readdir, (dirp))) +#define SMB_VFS_SEEKDIR(conn, dirp, offset) ((conn)->vfs.ops.seekdir((conn)->vfs.handles.seekdir, (dirp), (offset))) +#define SMB_VFS_TELLDIR(conn, dirp) ((conn)->vfs.ops.telldir((conn)->vfs.handles.telldir, (dirp))) +#define SMB_VFS_REWINDDIR(conn, dirp) ((conn)->vfs.ops.rewind_dir((conn)->vfs.handles.rewind_dir, (dirp))) +#define SMB_VFS_MKDIR(conn, path, mode) ((conn)->vfs.ops.mkdir((conn)->vfs.handles.mkdir,(path), (mode))) +#define SMB_VFS_RMDIR(conn, path) ((conn)->vfs.ops.rmdir((conn)->vfs.handles.rmdir, (path))) +#define SMB_VFS_CLOSEDIR(conn, dir) ((conn)->vfs.ops.closedir((conn)->vfs.handles.closedir, dir)) + +/* File operations */ +#define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode))) +#define SMB_VFS_CLOSE(fsp) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp))) +#define SMB_VFS_READ(fsp, data, n) ((fsp)->conn->vfs.ops.vfs_read((fsp)->conn->vfs.handles.vfs_read, (fsp), (data), (n))) +#define SMB_VFS_PREAD(fsp, data, n, off) ((fsp)->conn->vfs.ops.pread((fsp)->conn->vfs.handles.pread, (fsp), (data), (n), (off))) +#define SMB_VFS_WRITE(fsp, data, n) ((fsp)->conn->vfs.ops.write((fsp)->conn->vfs.handles.write, (fsp), (data), (n))) +#define SMB_VFS_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs.ops.pwrite((fsp)->conn->vfs.handles.pwrite, (fsp), (data), (n), (off))) +#define SMB_VFS_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs.ops.lseek((fsp)->conn->vfs.handles.lseek, (fsp), (offset), (whence))) +#define SMB_VFS_SENDFILE(tofd, fromfsp, header, offset, count) ((fsp)->conn->vfs.ops.sendfile((fsp)->conn->vfs.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) +#define SMB_VFS_RECVFILE(fromfd, tofsp, offset, count) ((fsp)->conn->vfs.ops.recvfile((fsp)->conn->vfs.handles.recvfile, (fromfd), (tofsp), (offset), (count))) +#define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new))) +#define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp))) +#define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf))) +#define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf))) +#define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf))) +#define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path))) +#define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode))) +#define SMB_VFS_FCHMOD(fsp, mode) ((fsp)->conn->vfs.ops.fchmod((fsp)->conn->vfs.handles.fchmod, (fsp), (mode))) +#define SMB_VFS_CHOWN(conn, path, uid, gid) ((conn)->vfs.ops.chown((conn)->vfs.handles.chown, (path), (uid), (gid))) +#define SMB_VFS_FCHOWN(fsp, uid, gid) ((fsp)->conn->vfs.ops.fchown((fsp)->conn->vfs.handles.fchown, (fsp), (uid), (gid))) +#define SMB_VFS_LCHOWN(conn, path, uid, gid) ((conn)->vfs.ops.lchown((conn)->vfs.handles.lchown, (path), (uid), (gid))) +#define SMB_VFS_CHDIR(conn, path) ((conn)->vfs.ops.chdir((conn)->vfs.handles.chdir, (path))) +#define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (buf))) +#define SMB_VFS_NTIMES(conn, path, ts) ((conn)->vfs.ops.ntimes((conn)->vfs.handles.ntimes, (path), (ts))) +#define SMB_VFS_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (offset))) +#define SMB_VFS_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (op), (offset), (count), (type))) +#define SMB_VFS_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (share_mode))) +#define SMB_VFS_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs.ops.linux_setlease((fsp)->conn->vfs.handles.linux_setlease, (fsp), (leasetype))) +#define SMB_VFS_GETLOCK(fsp, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs.ops.getlock((fsp)->conn->vfs.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid))) +#define SMB_VFS_SYMLINK(conn, oldpath, newpath) ((conn)->vfs.ops.symlink((conn)->vfs.handles.symlink, (oldpath), (newpath))) +#define SMB_VFS_READLINK(conn, path, buf, bufsiz) ((conn)->vfs.ops.vfs_readlink((conn)->vfs.handles.vfs_readlink, (path), (buf), (bufsiz))) +#define SMB_VFS_LINK(conn, oldpath, newpath) ((conn)->vfs.ops.link((conn)->vfs.handles.link, (oldpath), (newpath))) +#define SMB_VFS_MKNOD(conn, path, mode, dev) ((conn)->vfs.ops.mknod((conn)->vfs.handles.mknod, (path), (mode), (dev))) +#define SMB_VFS_REALPATH(conn, path, resolved_path) ((conn)->vfs.ops.realpath((conn)->vfs.handles.realpath, (path), (resolved_path))) +#define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs.ops.notify_watch((conn)->vfs.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p))) +#define SMB_VFS_CHFLAGS(conn, path, flags) ((conn)->vfs.ops.chflags((conn)->vfs.handles.chflags, (path), (flags))) +#define SMB_VFS_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops.file_id_create((conn)->vfs.handles.file_id_create, (dev), (inode))) +#define SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs.ops.streaminfo((conn)->vfs.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) + +/* NT ACL operations. */ +#define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) +#define SMB_VFS_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs.ops.get_nt_acl((conn)->vfs.handles.get_nt_acl, (name), (security_info), (ppdesc))) +#define SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd) ((fsp)->conn->vfs.ops.fset_nt_acl((fsp)->conn->vfs.handles.fset_nt_acl, (fsp), (security_info_sent), (psd))) + +/* POSIX ACL operations. */ +#define SMB_VFS_CHMOD_ACL(conn, name, mode) ((conn)->vfs.ops.chmod_acl((conn)->vfs.handles.chmod_acl, (name), (mode))) +#define SMB_VFS_FCHMOD_ACL(fsp, mode) ((fsp)->conn->vfs.ops.fchmod_acl((fsp)->conn->vfs.handles.chmod_acl, (fsp), (mode))) + +#define SMB_VFS_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs.ops.sys_acl_get_entry((conn)->vfs.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p))) +#define SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs.ops.sys_acl_get_tag_type((conn)->vfs.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p))) +#define SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs.ops.sys_acl_get_permset((conn)->vfs.handles.sys_acl_get_permset, (entry_d), (permset_p))) +#define SMB_VFS_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs.ops.sys_acl_get_qualifier((conn)->vfs.handles.sys_acl_get_qualifier, (entry_d))) +#define SMB_VFS_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs.ops.sys_acl_get_file((conn)->vfs.handles.sys_acl_get_file, (path_p), (type))) +#define SMB_VFS_SYS_ACL_GET_FD(fsp) ((fsp)->conn->vfs.ops.sys_acl_get_fd((fsp)->conn->vfs.handles.sys_acl_get_fd, (fsp))) +#define SMB_VFS_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs.ops.sys_acl_clear_perms((conn)->vfs.handles.sys_acl_clear_perms, (permset))) +#define SMB_VFS_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_add_perm((conn)->vfs.handles.sys_acl_add_perm, (permset), (perm))) +#define SMB_VFS_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs.ops.sys_acl_to_text((conn)->vfs.handles.sys_acl_to_text, (theacl), (plen))) +#define SMB_VFS_SYS_ACL_INIT(conn, count) ((conn)->vfs.ops.sys_acl_init((conn)->vfs.handles.sys_acl_init, (count))) +#define SMB_VFS_SYS_ACL_CREATE_ENTRY(conn, pacl, pentry) ((conn)->vfs.ops.sys_acl_create_entry((conn)->vfs.handles.sys_acl_create_entry, (pacl), (pentry))) +#define SMB_VFS_SYS_ACL_SET_TAG_TYPE(conn, entry, tagtype) ((conn)->vfs.ops.sys_acl_set_tag_type((conn)->vfs.handles.sys_acl_set_tag_type, (entry), (tagtype))) +#define SMB_VFS_SYS_ACL_SET_QUALIFIER(conn, entry, qual) ((conn)->vfs.ops.sys_acl_set_qualifier((conn)->vfs.handles.sys_acl_set_qualifier, (entry), (qual))) +#define SMB_VFS_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs.ops.sys_acl_set_permset((conn)->vfs.handles.sys_acl_set_permset, (entry), (permset))) +#define SMB_VFS_SYS_ACL_VALID(conn, theacl) ((conn)->vfs.ops.sys_acl_valid((conn)->vfs.handles.sys_acl_valid, (theacl))) +#define SMB_VFS_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs.ops.sys_acl_set_file((conn)->vfs.handles.sys_acl_set_file, (name), (acltype), (theacl))) +#define SMB_VFS_SYS_ACL_SET_FD(fsp, theacl) ((fsp)->conn->vfs.ops.sys_acl_set_fd((fsp)->conn->vfs.handles.sys_acl_set_fd, (fsp), (theacl))) +#define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs.ops.sys_acl_delete_def_file((conn)->vfs.handles.sys_acl_delete_def_file, (path))) +#define SMB_VFS_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs.ops.sys_acl_get_perm((conn)->vfs.handles.sys_acl_get_perm, (permset), (perm))) +#define SMB_VFS_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs.ops.sys_acl_free_text((conn)->vfs.handles.sys_acl_free_text, (text))) +#define SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl) ((conn)->vfs.ops.sys_acl_free_acl((conn)->vfs.handles.sys_acl_free_acl, (posix_acl))) +#define SMB_VFS_SYS_ACL_FREE_QUALIFIER(conn, qualifier, tagtype) ((conn)->vfs.ops.sys_acl_free_qualifier((conn)->vfs.handles.sys_acl_free_qualifier, (qualifier), (tagtype))) + +/* EA operations. */ +#define SMB_VFS_GETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.getxattr((conn)->vfs.handles.getxattr,(path),(name),(value),(size))) +#define SMB_VFS_LGETXATTR(conn,path,name,value,size) ((conn)->vfs.ops.lgetxattr((conn)->vfs.handles.lgetxattr,(path),(name),(value),(size))) +#define SMB_VFS_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs.ops.fgetxattr((fsp)->conn->vfs.handles.fgetxattr,(fsp),(name),(value),(size))) +#define SMB_VFS_LISTXATTR(conn,path,list,size) ((conn)->vfs.ops.listxattr((conn)->vfs.handles.listxattr,(path),(list),(size))) +#define SMB_VFS_LLISTXATTR(conn,path,list,size) ((conn)->vfs.ops.llistxattr((conn)->vfs.handles.llistxattr,(path),(list),(size))) +#define SMB_VFS_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs.ops.flistxattr((fsp)->conn->vfs.handles.flistxattr,(fsp),(list),(size))) +#define SMB_VFS_REMOVEXATTR(conn,path,name) ((conn)->vfs.ops.removexattr((conn)->vfs.handles.removexattr,(path),(name))) +#define SMB_VFS_LREMOVEXATTR(conn,path,name) ((conn)->vfs.ops.lremovexattr((conn)->vfs.handles.lremovexattr,(path),(name))) +#define SMB_VFS_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs.ops.fremovexattr((fsp)->conn->vfs.handles.fremovexattr,(fsp),(name))) +#define SMB_VFS_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.setxattr((conn)->vfs.handles.setxattr,(path),(name),(value),(size),(flags))) +#define SMB_VFS_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs.ops.lsetxattr((conn)->vfs.handles.lsetxattr,(path),(name),(value),(size),(flags))) +#define SMB_VFS_FSETXATTR(fsp,name,value,size,flags) ((fsp)->conn->vfs.ops.fsetxattr((fsp)->conn->vfs.handles.fsetxattr,(fsp),(name),(value),(size),(flags))) + +/* AIO operations. */ +#define SMB_VFS_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_read((fsp)->conn->vfs.handles.aio_read,(fsp),(aiocb))) +#define SMB_VFS_AIO_WRITE(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_write((fsp)->conn->vfs.handles.aio_write,(fsp),(aiocb))) +#define SMB_VFS_AIO_RETURN(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_return_fn((fsp)->conn->vfs.handles.aio_return,(fsp),(aiocb))) +#define SMB_VFS_AIO_CANCEL(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_cancel((fsp)->conn->vfs.handles.aio_cancel,(fsp),(aiocb))) +#define SMB_VFS_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_error_fn((fsp)->conn->vfs.handles.aio_error,(fsp),(aiocb))) +#define SMB_VFS_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs.ops.aio_fsync((fsp)->conn->vfs.handles.aio_fsync,(fsp),(op),(aiocb))) +#define SMB_VFS_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs.ops.aio_suspend((fsp)->conn->vfs.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) +#define SMB_VFS_AIO_FORCE(fsp) ((fsp)->conn->vfs.ops.aio_force((fsp)->conn->vfs.handles.aio_force,(fsp))) + +/* Offline operations */ +#define SMB_VFS_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf))) +#define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(path))) + +/******************************************************************* + Don't access conn->vfs_opaque.ops directly!!! + Use this macros! + (Fixes should also go into the vfs_* and vfs_next_* macros!) +********************************************************************/ + +/* Disk operations */ +#define SMB_VFS_OPAQUE_CONNECT(conn, service, user) ((conn)->vfs_opaque.ops.connect_fn((conn)->vfs_opaque.handles.connect_hnd, (service), (user))) +#define SMB_VFS_OPAQUE_DISCONNECT(conn) ((conn)->vfs_opaque.ops.disconnect((conn)->vfs_opaque.handles.disconnect)) +#define SMB_VFS_OPAQUE_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs_opaque.ops.disk_free((conn)->vfs_opaque.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) +#define SMB_VFS_OPAQUE_GET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.get_quota((conn)->vfs_opaque.handles.get_quota, (qtype), (id), (qt))) +#define SMB_VFS_OPAQUE_SET_QUOTA(conn, qtype, id, qt) ((conn)->vfs_opaque.ops.set_quota((conn)->vfs_opaque.handles.set_quota, (qtype), (id), (qt))) +#define SMB_VFS_OPAQUE_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) ((fsp)->conn->vfs_opaque.ops.get_shadow_copy_data((fsp)->conn->vfs_opaque.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels))) +#define SMB_VFS_OPAQUE_STATVFS(conn, path, statbuf) ((conn)->vfs_opaque.ops.statvfs((conn)->vfs_opaque.handles.statvfs, (path), (statbuf))) +#define SMB_VFS_OPAQUE_FS_CAPABILITIES(conn) ((conn)->vfs_opaque.ops.fs_capabilities((conn)->vfs_opaque.handles.fs_capabilities)) + +/* Directory operations */ +#define SMB_VFS_OPAQUE_OPENDIR(conn, fname, mask, attr) ((conn)->vfs_opaque.ops.opendir((conn)->vfs_opaque.handles.opendir, (fname), (mask), (attr))) +#define SMB_VFS_OPAQUE_READDIR(conn, dirp) ((conn)->vfs_opaque.ops.readdir((conn)->vfs_opaque.handles.readdir, (dirp))) +#define SMB_VFS_OPAQUE_SEEKDIR(conn, dirp, offset) ((conn)->vfs_opaque.ops.seekdir((conn)->vfs_opaque.handles.seekdir, (dirp), (offset))) +#define SMB_VFS_OPAQUE_TELLDIR(conn, dirp) ((conn)->vfs_opaque.ops.telldir((conn)->vfs_opaque.handles.telldir, (dirp))) +#define SMB_VFS_OPAQUE_REWINDDIR(conn, dirp) ((conn)->vfs_opaque.ops.rewind_dir((conn)->vfs_opaque.handles.rewind_dir, (dirp))) +#define SMB_VFS_OPAQUE_MKDIR(conn, path, mode) ((conn)->vfs_opaque.ops.mkdir((conn)->vfs_opaque.handles.mkdir,(path), (mode))) +#define SMB_VFS_OPAQUE_RMDIR(conn, path) ((conn)->vfs_opaque.ops.rmdir((conn)->vfs_opaque.handles.rmdir, (path))) +#define SMB_VFS_OPAQUE_CLOSEDIR(conn, dir) ((conn)->vfs_opaque.ops.closedir((conn)->vfs_opaque.handles.closedir, dir)) + +/* File operations */ +#define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode))) +#define SMB_VFS_OPAQUE_CLOSE(fsp) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp))) +#define SMB_VFS_OPAQUE_READ(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.vfs_read((fsp)->conn->vfs_opaque.handles.vfs_read, (fsp), (data), (n))) +#define SMB_VFS_OPAQUE_PREAD(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pread((fsp)->conn->vfs_opaque.handles.pread, (fsp), (data), (n), (off))) +#define SMB_VFS_OPAQUE_WRITE(fsp, data, n) ((fsp)->conn->vfs_opaque.ops.write((fsp)->conn->vfs_opaque.handles.write, (fsp), (data), (n))) +#define SMB_VFS_OPAQUE_PWRITE(fsp, data, n, off) ((fsp)->conn->vfs_opaque.ops.pwrite((fsp)->conn->vfs_opaque.handles.pwrite, (fsp), (data), (n), (off))) +#define SMB_VFS_OPAQUE_LSEEK(fsp, offset, whence) ((fsp)->conn->vfs_opaque.ops.lseek((fsp)->conn->vfs_opaque.handles.lseek, (fsp), (offset), (whence))) +#define SMB_VFS_OPAQUE_SENDFILE(tofd, fromfsp, header, offset, count) ((fsp)->conn->vfs_opaque.ops.sendfile((fsp)->conn->vfs_opaque.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) +#define SMB_VFS_OPAQUE_RECVFILE(fromfd, tofsp, offset, count) ((fsp)->conn->vfs_opaque.ops.recvfile((fsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (tofsp), (offset), (count))) +#define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new))) +#define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp))) +#define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf))) +#define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf))) +#define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf))) +#define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path))) +#define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode))) +#define SMB_VFS_OPAQUE_FCHMOD(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod((fsp)->conn->vfs_opaque.handles.fchmod, (fsp), (mode))) +#define SMB_VFS_OPAQUE_CHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.chown((conn)->vfs_opaque.handles.chown, (path), (uid), (gid))) +#define SMB_VFS_OPAQUE_FCHOWN(fsp, uid, gid) ((fsp)->conn->vfs_opaque.ops.fchown((fsp)->conn->vfs_opaque.handles.fchown, (fsp), (uid), (gid))) +#define SMB_VFS_OPAQUE_LCHOWN(conn, path, uid, gid) ((conn)->vfs_opaque.ops.lchown((conn)->vfs_opaque.handles.lchown, (path), (uid), (gid))) +#define SMB_VFS_OPAQUE_CHDIR(conn, path) ((conn)->vfs_opaque.ops.chdir((conn)->vfs_opaque.handles.chdir, (path))) +#define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (buf))) +#define SMB_VFS_OPAQUE_NTIMES(conn, path, ts) ((conn)->vfs_opaque.ops.ntimes((conn)->vfs_opaque.handles.ntimes, (path), (ts))) +#define SMB_VFS_OPAQUE_FTRUNCATE(fsp, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (offset))) +#define SMB_VFS_OPAQUE_LOCK(fsp, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (op), (offset), (count), (type))) +#define SMB_VFS_OPAQUE_KERNEL_FLOCK(fsp, share_mode) ((fsp)->conn->vfs_opaque.ops.kernel_flock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (share_mode))) +#define SMB_VFS_OPAQUE_LINUX_SETLEASE(fsp, leasetype) ((fsp)->conn->vfs_opaque.ops.linux_setlease((fsp)->conn->vfs_opaque.handles.linux_setlease, (fsp), (leasetype))) +#define SMB_VFS_OPAQUE_GETLOCK(fsp, poffset, pcount, ptype, ppid) ((fsp)->conn->vfs_opaque.ops.getlock((fsp)->conn->vfs_opaque.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid))) +#define SMB_VFS_OPAQUE_SYMLINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.symlink((conn)->vfs_opaque.handles.symlink, (oldpath), (newpath))) +#define SMB_VFS_OPAQUE_READLINK(conn, path, buf, bufsiz) ((conn)->vfs_opaque.ops.vfs_readlink((conn)->vfs_opaque.handles.vfs_readlink, (path), (buf), (bufsiz))) +#define SMB_VFS_OPAQUE_LINK(conn, oldpath, newpath) ((conn)->vfs_opaque.ops.link((conn)->vfs_opaque.handles.link, (oldpath), (newpath))) +#define SMB_VFS_OPAQUE_MKNOD(conn, path, mode, dev) ((conn)->vfs_opaque.ops.mknod((conn)->vfs_opaque.handles.mknod, (path), (mode), (dev))) +#define SMB_VFS_OPAQUE_REALPATH(conn, path, resolved_path) ((conn)->vfs_opaque.ops.realpath((conn)->vfs_opaque.handles.realpath, (path), (resolved_path))) +#define SMB_VFS_OPAQUE_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_opaque.ops.notify_watch((conn)->vfs_opaque.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p))) +#define SMB_VFS_OPAQUE_CHFLAGS(conn, path, flags) ((conn)->vfs_opaque.ops.chflags((conn)->vfs_opaque.handles.chflags, (path), (flags))) +#define SMB_VFS_OPAQUE_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops_opaque.file_id_create((conn)->vfs_opaque.handles.file_id_create, (dev), (inode))) +#define SMB_VFS_OPAQUE_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs_opaque.ops.streaminfo((conn)->vfs_opaque.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) + +/* NT ACL operations. */ +#define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) +#define SMB_VFS_OPAQUE_GET_NT_ACL(conn, name, security_info, ppdesc) ((conn)->vfs_opaque.ops.get_nt_acl((conn)->vfs_opaque.handles.get_nt_acl, (name), (security_info), (ppdesc))) +#define SMB_VFS_OPAQUE_FSET_NT_ACL(fsp, security_info_sent, psd) ((fsp)->conn->vfs_opaque.ops.fset_nt_acl((fsp)->conn->vfs_opaque.handles.fset_nt_acl, (fsp), (security_info_sent), (psd))) + +/* POSIX ACL operations. */ +#define SMB_VFS_OPAQUE_CHMOD_ACL(conn, name, mode) ((conn)->vfs_opaque.ops.chmod_acl((conn)->vfs_opaque.handles.chmod_acl, (name), (mode))) +#define SMB_VFS_OPAQUE_FCHMOD_ACL(fsp, mode) ((fsp)->conn->vfs_opaque.ops.fchmod_acl((fsp)->conn->vfs_opaque.handles.chmod_acl, (fsp), (mode))) + +#define SMB_VFS_OPAQUE_SYS_ACL_GET_ENTRY(conn, theacl, entry_id, entry_p) ((conn)->vfs_opaque.ops.sys_acl_get_entry((conn)->vfs_opaque.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p))) +#define SMB_VFS_OPAQUE_SYS_ACL_GET_TAG_TYPE(conn, entry_d, tag_type_p) ((conn)->vfs_opaque.ops.sys_acl_get_tag_type((conn)->vfs_opaque.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p))) +#define SMB_VFS_OPAQUE_SYS_ACL_GET_PERMSET(conn, entry_d, permset_p) ((conn)->vfs_opaque.ops.sys_acl_get_permset((conn)->vfs_opaque.handles.sys_acl_get_permset, (entry_d), (permset_p))) +#define SMB_VFS_OPAQUE_SYS_ACL_GET_QUALIFIER(conn, entry_d) ((conn)->vfs_opaque.ops.sys_acl_get_qualifier((conn)->vfs_opaque.handles.sys_acl_get_qualifier, (entry_d))) +#define SMB_VFS_OPAQUE_SYS_ACL_GET_FILE(conn, path_p, type) ((conn)->vfs_opaque.ops.sys_acl_get_file((conn)->vfs_opaque.handles.sys_acl_get_file, (path_p), (type))) +#define SMB_VFS_OPAQUE_SYS_ACL_GET_FD(fsp) ((fsp)->conn->vfs_opaque.ops.sys_acl_get_fd((fsp)->conn->vfs_opaque.handles.sys_acl_get_fd, (fsp))) +#define SMB_VFS_OPAQUE_SYS_ACL_CLEAR_PERMS(conn, permset) ((conn)->vfs_opaque.ops.sys_acl_clear_perms((conn)->vfs_opaque.handles.sys_acl_clear_perms, (permset))) +#define SMB_VFS_OPAQUE_SYS_ACL_ADD_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_add_perm((conn)->vfs_opaque.handles.sys_acl_add_perm, (permset), (perm))) +#define SMB_VFS_OPAQUE_SYS_ACL_TO_TEXT(conn, theacl, plen) ((conn)->vfs_opaque.ops.sys_acl_to_text((conn)->vfs_opaque.handles.sys_acl_to_text, (theacl), (plen))) +#define SMB_VFS_OPAQUE_SYS_ACL_INIT(conn, count) ((conn)->vfs_opaque.ops.sys_acl_init((conn)->vfs_opaque.handles.sys_acl_init, (count))) +#define SMB_VFS_OPAQUE_SYS_ACL_CREATE_ENTRY(conn, pacl, pentry) ((conn)->vfs_opaque.ops.sys_acl_create_entry((conn)->vfs_opaque.handles.sys_acl_create_entry, (pacl), (pentry))) +#define SMB_VFS_OPAQUE_SYS_ACL_SET_TAG_TYPE(conn, entry, tagtype) ((conn)->vfs_opaque.ops.sys_acl_set_tag_type((conn)->vfs_opaque.handles.sys_acl_set_tag_type, (entry), (tagtype))) +#define SMB_VFS_OPAQUE_SYS_ACL_SET_QUALIFIER(conn, entry, qual) ((conn)->vfs_opaque.ops.sys_acl_set_qualifier((conn)->vfs_opaque.handles.sys_acl_set_qualifier, (entry), (qual))) +#define SMB_VFS_OPAQUE_SYS_ACL_SET_PERMSET(conn, entry, permset) ((conn)->vfs_opaque.ops.sys_acl_set_permset((conn)->vfs_opaque.handles.sys_acl_set_permset, (entry), (permset))) +#define SMB_VFS_OPAQUE_SYS_ACL_VALID(conn, theacl) ((conn)->vfs_opaque.ops.sys_acl_valid((conn)->vfs_opaque.handles.sys_acl_valid, (theacl))) +#define SMB_VFS_OPAQUE_SYS_ACL_SET_FILE(conn, name, acltype, theacl) ((conn)->vfs_opaque.ops.sys_acl_set_file((conn)->vfs_opaque.handles.sys_acl_set_file, (name), (acltype), (theacl))) +#define SMB_VFS_OPAQUE_SYS_ACL_SET_FD(fsp, theacl) ((fsp)->conn->vfs_opaque.ops.sys_acl_set_fd((fsp)->conn->vfs_opaque.handles.sys_acl_set_fd, (fsp), (theacl))) +#define SMB_VFS_OPAQUE_SYS_ACL_DELETE_DEF_FILE(conn, path) ((conn)->vfs_opaque.ops.sys_acl_delete_def_file((conn)->vfs_opaque.handles.sys_acl_delete_def_file, (path))) +#define SMB_VFS_OPAQUE_SYS_ACL_GET_PERM(conn, permset, perm) ((conn)->vfs_opaque.ops.sys_acl_get_perm((conn)->vfs_opaque.handles.sys_acl_get_perm, (permset), (perm))) +#define SMB_VFS_OPAQUE_SYS_ACL_FREE_TEXT(conn, text) ((conn)->vfs_opaque.ops.sys_acl_free_text((conn)->vfs_opaque.handles.sys_acl_free_text, (text))) +#define SMB_VFS_OPAQUE_SYS_ACL_FREE_ACL(conn, posix_acl) ((conn)->vfs_opaque.ops.sys_acl_free_acl((conn)->vfs_opaque.handles.sys_acl_free_acl, (posix_acl))) +#define SMB_VFS_OPAQUE_SYS_ACL_FREE_QUALIFIER(conn, qualifier, tagtype) ((conn)->vfs_opaque.ops.sys_acl_free_qualifier((conn)->vfs_opaque.handles.sys_acl_free_qualifier, (qualifier), (tagtype))) + +/* EA operations. */ +#define SMB_VFS_OPAQUE_GETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.getxattr((conn)->vfs_opaque.handles.getxattr,(path),(name),(value),(size))) +#define SMB_VFS_OPAQUE_LGETXATTR(conn,path,name,value,size) ((conn)->vfs_opaque.ops.lgetxattr((conn)->vfs_opaque.handles.lgetxattr,(path),(name),(value),(size))) +#define SMB_VFS_OPAQUE_FGETXATTR(fsp,name,value,size) ((fsp)->conn->vfs_opaque.ops.fgetxattr((fsp)->conn->vfs_opaque.handles.fgetxattr,(fsp),(name),(value),(size))) +#define SMB_VFS_OPAQUE_LISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.listxattr((conn)->vfs_opaque.handles.listxattr,(path),(list),(size))) +#define SMB_VFS_OPAQUE_LLISTXATTR(conn,path,list,size) ((conn)->vfs_opaque.ops.llistxattr((conn)->vfs_opaque.handles.llistxattr,(path),(list),(size))) +#define SMB_VFS_OPAQUE_FLISTXATTR(fsp,list,size) ((fsp)->conn->vfs_opaque.ops.flistxattr((fsp)->conn->vfs_opaque.handles.flistxattr,(fsp),(list),(size))) +#define SMB_VFS_OPAQUE_REMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.removexattr((conn)->vfs_opaque.handles.removexattr,(path),(name))) +#define SMB_VFS_OPAQUE_LREMOVEXATTR(conn,path,name) ((conn)->vfs_opaque.ops.lremovexattr((conn)->vfs_opaque.handles.lremovexattr,(path),(name))) +#define SMB_VFS_OPAQUE_FREMOVEXATTR(fsp,name) ((fsp)->conn->vfs_opaque.ops.fremovexattr((fsp)->conn->vfs_opaque.handles.fremovexattr,(fsp),(name))) +#define SMB_VFS_OPAQUE_SETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.setxattr((conn)->vfs_opaque.handles.setxattr,(path),(name),(value),(size),(flags))) +#define SMB_VFS_OPAQUE_LSETXATTR(conn,path,name,value,size,flags) ((conn)->vfs_opaque.ops.lsetxattr((conn)->vfs_opaque.handles.lsetxattr,(path),(name),(value),(size),(flags))) +#define SMB_VFS_OPAQUE_FSETXATTR(fsp,name,value,size,flags) ((fsp)->conn->vfs_opaque.ops.fsetxattr((fsp)->conn->vfs_opaque.handles.fsetxattr,(fsp),(name),(value),(size),(flags))) + +/* AIO operations. */ +#define SMB_VFS_OPAQUE_AIO_READ(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_read((fsp)->conn->vfs_opaque.handles.aio_read,(fsp),(aiocb))) +#define SMB_VFS_OPAQUE_AIO_WRITE(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_write((fsp)->conn->vfs_opaque.handles.aio_write,(fsp),(aiocb))) +#define SMB_VFS_OPAQUE_AIO_RETURN(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_return_fn((fsp)->conn->vfs_opaque.handles.aio_return,(fsp),(aiocb))) +#define SMB_VFS_OPAQUE_AIO_CANCEL(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_cancel((fsp)->conn->vfs_opaque.handles.cancel,(fsp),(aiocb))) +#define SMB_VFS_OPAQUE_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_error_fn((fsp)->conn->vfs_opaque.handles.aio_error,(fsp),(aiocb))) +#define SMB_VFS_OPAQUE_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_fsync((fsp)->conn->vfs_opaque.handles.aio_fsync,(fsp),(op),(aiocb))) +#define SMB_VFS_OPAQUE_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs_opaque.ops.aio_suspend((fsp)->conn->vfs_opaque.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) +#define SMB_VFS_OPAQUE_AIO_FORCE(fsp) ((fsp)->conn->vfs_opaque.ops.aio_force((fsp)->conn->vfs_opaque.handles.aio_force,(fsp))) + +/* Offline operations */ +#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf))) +#define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(path))) + +/******************************************************************* + Don't access handle->vfs_next.ops.* directly!!! + Use this macros! + (Fixes should go also into the vfs_* and vfs_opaque_* macros!) +********************************************************************/ + +/* Disk operations */ +#define SMB_VFS_NEXT_CONNECT(handle, service, user) ((handle)->vfs_next.ops.connect_fn((handle)->vfs_next.handles.connect_hnd, (service), (user))) +#define SMB_VFS_NEXT_DISCONNECT(handle) ((handle)->vfs_next.ops.disconnect((handle)->vfs_next.handles.disconnect)) +#define SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, dfree ,dsize) ((handle)->vfs_next.ops.disk_free((handle)->vfs_next.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) +#define SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt) ((handle)->vfs_next.ops.get_quota((handle)->vfs_next.handles.get_quota, (qtype), (id), (qt))) +#define SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt) ((handle)->vfs_next.ops.set_quota((handle)->vfs_next.handles.set_quota, (qtype), (id), (qt))) +#define SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data ,labels) ((handle)->vfs_next.ops.get_shadow_copy_data((handle)->vfs_next.handles.get_shadow_copy_data,(fsp),(shadow_copy_data),(labels))) +#define SMB_VFS_NEXT_STATVFS(handle, path, statbuf) ((handle)->vfs_next.ops.statvfs((handle)->vfs_next.handles.statvfs, (path), (statbuf))) +#define SMB_VFS_NEXT_FS_CAPABILITIES(handle) ((handle)->vfs_next.ops.fs_capabilities((handle)->vfs_next.handles.fs_capabilities)) + +/* Directory operations */ +#define SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr) ((handle)->vfs_next.ops.opendir((handle)->vfs_next.handles.opendir, (fname), (mask), (attr))) +#define SMB_VFS_NEXT_READDIR(handle, dirp) ((handle)->vfs_next.ops.readdir((handle)->vfs_next.handles.readdir, (dirp))) +#define SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset) ((handle)->vfs_next.ops.seekdir((handle)->vfs_next.handles.seekdir, (dirp), (offset))) +#define SMB_VFS_NEXT_TELLDIR(handle, dirp) ((handle)->vfs_next.ops.telldir((handle)->vfs_next.handles.telldir, (dirp))) +#define SMB_VFS_NEXT_REWINDDIR(handle, dirp) ((handle)->vfs_next.ops.rewind_dir((handle)->vfs_next.handles.rewind_dir, (dirp))) +#define SMB_VFS_NEXT_DIR(handle, dirp) ((handle)->vfs_next.ops.readdir((handle)->vfs_next.handles.readdir, (dirp))) +#define SMB_VFS_NEXT_MKDIR(handle, path, mode) ((handle)->vfs_next.ops.mkdir((handle)->vfs_next.handles.mkdir,(path), (mode))) +#define SMB_VFS_NEXT_RMDIR(handle, path) ((handle)->vfs_next.ops.rmdir((handle)->vfs_next.handles.rmdir, (path))) +#define SMB_VFS_NEXT_CLOSEDIR(handle, dir) ((handle)->vfs_next.ops.closedir((handle)->vfs_next.handles.closedir, dir)) + +/* File operations */ +#define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode))) +#define SMB_VFS_NEXT_CLOSE(handle, fsp) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp))) +#define SMB_VFS_NEXT_READ(handle, fsp, data, n) ((handle)->vfs_next.ops.vfs_read((handle)->vfs_next.handles.vfs_read, (fsp), (data), (n))) +#define SMB_VFS_NEXT_PREAD(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pread((handle)->vfs_next.handles.pread, (fsp), (data), (n), (off))) +#define SMB_VFS_NEXT_WRITE(handle, fsp, data, n) ((handle)->vfs_next.ops.write((handle)->vfs_next.handles.write, (fsp), (data), (n))) +#define SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, off) ((handle)->vfs_next.ops.pwrite((handle)->vfs_next.handles.pwrite, (fsp), (data), (n), (off))) +#define SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence) ((handle)->vfs_next.ops.lseek((handle)->vfs_next.handles.lseek, (fsp), (offset), (whence))) +#define SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, header, offset, count) ((handle)->vfs_next.ops.sendfile((handle)->vfs_next.handles.sendfile, (tofd), (fromfsp), (header), (offset), (count))) +#define SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (tofsp), (offset), (count))) +#define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new))) +#define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp))) +#define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf))) +#define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf))) +#define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf))) +#define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path))) +#define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode))) +#define SMB_VFS_NEXT_FCHMOD(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod((handle)->vfs_next.handles.fchmod, (fsp), (mode))) +#define SMB_VFS_NEXT_CHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.chown((handle)->vfs_next.handles.chown, (path), (uid), (gid))) +#define SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid) ((handle)->vfs_next.ops.fchown((handle)->vfs_next.handles.fchown, (fsp), (uid), (gid))) +#define SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid) ((handle)->vfs_next.ops.lchown((handle)->vfs_next.handles.lchown, (path), (uid), (gid))) +#define SMB_VFS_NEXT_CHDIR(handle, path) ((handle)->vfs_next.ops.chdir((handle)->vfs_next.handles.chdir, (path))) +#define SMB_VFS_NEXT_GETWD(handle, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (buf))) +#define SMB_VFS_NEXT_NTIMES(handle, path, ts) ((handle)->vfs_next.ops.ntimes((handle)->vfs_next.handles.ntimes, (path), (ts))) +#define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (offset))) +#define SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (op), (offset), (count), (type))) +#define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (share_mode))) +#define SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype)((handle)->vfs_next.ops.linux_setlease((handle)->vfs_next.handles.linux_setlease, (fsp), (leasetype))) +#define SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid) ((handle)->vfs_next.ops.getlock((handle)->vfs_next.handles.getlock, (fsp), (poffset), (pcount), (ptype), (ppid))) +#define SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.symlink((handle)->vfs_next.handles.symlink, (oldpath), (newpath))) +#define SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz) ((handle)->vfs_next.ops.vfs_readlink((handle)->vfs_next.handles.vfs_readlink, (path), (buf), (bufsiz))) +#define SMB_VFS_NEXT_LINK(handle, oldpath, newpath) ((handle)->vfs_next.ops.link((handle)->vfs_next.handles.link, (oldpath), (newpath))) +#define SMB_VFS_NEXT_MKNOD(handle, path, mode, dev) ((handle)->vfs_next.ops.mknod((handle)->vfs_next.handles.mknod, (path), (mode), (dev))) +#define SMB_VFS_NEXT_REALPATH(handle, path, resolved_path) ((handle)->vfs_next.ops.realpath((handle)->vfs_next.handles.realpath, (path), (resolved_path))) +#define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_next.ops.notify_watch((conn)->vfs_next.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p))) +#define SMB_VFS_NEXT_CHFLAGS(handle, path, flags) ((handle)->vfs_next.ops.chflags((handle)->vfs_next.handles.chflags, (path), (flags))) +#define SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode) ((handle)->vfs_next.ops.file_id_create((handle)->vfs_next.handles.file_id_create, (dev), (inode))) +#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, num_streams, streams) ((handle)->vfs_next.ops.streaminfo((handle)->vfs_next.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) + +/* NT ACL operations. */ +#define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) +#define SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc) ((handle)->vfs_next.ops.get_nt_acl((handle)->vfs_next.handles.get_nt_acl, (name), (security_info), (ppdesc))) +#define SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd) ((handle)->vfs_next.ops.fset_nt_acl((handle)->vfs_next.handles.fset_nt_acl, (fsp), (security_info_sent), (psd))) + +/* POSIX ACL operations. */ +#define SMB_VFS_NEXT_CHMOD_ACL(handle, name, mode) ((handle)->vfs_next.ops.chmod_acl((handle)->vfs_next.handles.chmod_acl, (name), (mode))) +#define SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode) ((handle)->vfs_next.ops.fchmod_acl((handle)->vfs_next.handles.chmod_acl, (fsp), (mode))) + +#define SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id, entry_p) ((handle)->vfs_next.ops.sys_acl_get_entry((handle)->vfs_next.handles.sys_acl_get_entry, (theacl), (entry_id), (entry_p))) +#define SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d, tag_type_p) ((handle)->vfs_next.ops.sys_acl_get_tag_type((handle)->vfs_next.handles.sys_acl_get_tag_type, (entry_d), (tag_type_p))) +#define SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d, permset_p) ((handle)->vfs_next.ops.sys_acl_get_permset((handle)->vfs_next.handles.sys_acl_get_permset, (entry_d), (permset_p))) +#define SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d) ((handle)->vfs_next.ops.sys_acl_get_qualifier((handle)->vfs_next.handles.sys_acl_get_qualifier, (entry_d))) +#define SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type) ((handle)->vfs_next.ops.sys_acl_get_file((handle)->vfs_next.handles.sys_acl_get_file, (path_p), (type))) +#define SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp) ((handle)->vfs_next.ops.sys_acl_get_fd((handle)->vfs_next.handles.sys_acl_get_fd, (fsp))) +#define SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset) ((handle)->vfs_next.ops.sys_acl_clear_perms((handle)->vfs_next.handles.sys_acl_clear_perms, (permset))) +#define SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm) ((handle)->vfs_next.ops.sys_acl_add_perm((handle)->vfs_next.handles.sys_acl_add_perm, (permset), (perm))) +#define SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen) ((handle)->vfs_next.ops.sys_acl_to_text((handle)->vfs_next.handles.sys_acl_to_text, (theacl), (plen))) +#define SMB_VFS_NEXT_SYS_ACL_INIT(handle, count) ((handle)->vfs_next.ops.sys_acl_init((handle)->vfs_next.handles.sys_acl_init, (count))) +#define SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry) ((handle)->vfs_next.ops.sys_acl_create_entry((handle)->vfs_next.handles.sys_acl_create_entry, (pacl), (pentry))) +#define SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry, tagtype) ((handle)->vfs_next.ops.sys_acl_set_tag_type((handle)->vfs_next.handles.sys_acl_set_tag_type, (entry), (tagtype))) +#define SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual) ((handle)->vfs_next.ops.sys_acl_set_qualifier((handle)->vfs_next.handles.sys_acl_set_qualifier, (entry), (qual))) +#define SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset) ((handle)->vfs_next.ops.sys_acl_set_permset((handle)->vfs_next.handles.sys_acl_set_permset, (entry), (permset))) +#define SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl) ((handle)->vfs_next.ops.sys_acl_valid((handle)->vfs_next.handles.sys_acl_valid, (theacl))) +#define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl) ((handle)->vfs_next.ops.sys_acl_set_file((handle)->vfs_next.handles.sys_acl_set_file, (name), (acltype), (theacl))) +#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl) ((handle)->vfs_next.ops.sys_acl_set_fd((handle)->vfs_next.handles.sys_acl_set_fd, (fsp), (theacl))) +#define SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path) ((handle)->vfs_next.ops.sys_acl_delete_def_file((handle)->vfs_next.handles.sys_acl_delete_def_file, (path))) +#define SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm) ((handle)->vfs_next.ops.sys_acl_get_perm((handle)->vfs_next.handles.sys_acl_get_perm, (permset), (perm))) +#define SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text) ((handle)->vfs_next.ops.sys_acl_free_text((handle)->vfs_next.handles.sys_acl_free_text, (text))) +#define SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl) ((handle)->vfs_next.ops.sys_acl_free_acl((handle)->vfs_next.handles.sys_acl_free_acl, (posix_acl))) +#define SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier, tagtype) ((handle)->vfs_next.ops.sys_acl_free_qualifier((handle)->vfs_next.handles.sys_acl_free_qualifier, (qualifier), (tagtype))) + +/* EA operations. */ +#define SMB_VFS_NEXT_GETXATTR(handle,path,name,value,size) ((handle)->vfs_next.ops.getxattr((handle)->vfs_next.handles.getxattr,(path),(name),(value),(size))) +#define SMB_VFS_NEXT_LGETXATTR(handle,path,name,value,size) ((handle)->vfs_next.ops.lgetxattr((handle)->vfs_next.handles.lgetxattr,(path),(name),(value),(size))) +#define SMB_VFS_NEXT_FGETXATTR(handle,fsp,name,value,size) ((handle)->vfs_next.ops.fgetxattr((handle)->vfs_next.handles.fgetxattr,(fsp),(name),(value),(size))) +#define SMB_VFS_NEXT_LISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.listxattr((handle)->vfs_next.handles.listxattr,(path),(list),(size))) +#define SMB_VFS_NEXT_LLISTXATTR(handle,path,list,size) ((handle)->vfs_next.ops.llistxattr((handle)->vfs_next.handles.llistxattr,(path),(list),(size))) +#define SMB_VFS_NEXT_FLISTXATTR(handle,fsp,list,size) ((handle)->vfs_next.ops.flistxattr((handle)->vfs_next.handles.flistxattr,(fsp),(list),(size))) +#define SMB_VFS_NEXT_REMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.removexattr((handle)->vfs_next.handles.removexattr,(path),(name))) +#define SMB_VFS_NEXT_LREMOVEXATTR(handle,path,name) ((handle)->vfs_next.ops.lremovexattr((handle)->vfs_next.handles.lremovexattr,(path),(name))) +#define SMB_VFS_NEXT_FREMOVEXATTR(handle,fsp,name) ((handle)->vfs_next.ops.fremovexattr((handle)->vfs_next.handles.fremovexattr,(fsp),(name))) +#define SMB_VFS_NEXT_SETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.setxattr((handle)->vfs_next.handles.setxattr,(path),(name),(value),(size),(flags))) +#define SMB_VFS_NEXT_LSETXATTR(handle,path,name,value,size,flags) ((handle)->vfs_next.ops.lsetxattr((handle)->vfs_next.handles.lsetxattr,(path),(name),(value),(size),(flags))) +#define SMB_VFS_NEXT_FSETXATTR(handle,fsp,name,value,size,flags) ((handle)->vfs_next.ops.fsetxattr((handle)->vfs_next.handles.fsetxattr,(fsp),(name),(value),(size),(flags))) + +/* AIO operations. */ +#define SMB_VFS_NEXT_AIO_READ(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_read((handle)->vfs_next.handles.aio_read,(fsp),(aiocb))) +#define SMB_VFS_NEXT_AIO_WRITE(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_write((handle)->vfs_next.handles.aio_write,(fsp),(aiocb))) +#define SMB_VFS_NEXT_AIO_RETURN(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_return_fn((handle)->vfs_next.handles.aio_return,(fsp),(aiocb))) +#define SMB_VFS_NEXT_AIO_CANCEL(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_cancel((handle)->vfs_next.handles.aio_cancel,(fsp),(aiocb))) +#define SMB_VFS_NEXT_AIO_ERROR(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_error_fn((handle)->vfs_next.handles.aio_error,(fsp),(aiocb))) +#define SMB_VFS_NEXT_AIO_FSYNC(handle,fsp,op,aiocb) ((handle)->vfs_next.ops.aio_fsync((handle)->vfs_next.handles.aio_fsync,(fsp),(op),(aiocb))) +#define SMB_VFS_NEXT_AIO_SUSPEND(handle,fsp,aiocb,n,ts) ((handle)->vfs_next.ops.aio_suspend((handle)->vfs_next.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) +#define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) ((handle)->vfs_next.ops.aio_force((handle)->vfs_next.handles.aio_force,(fsp))) + +/* Offline operations */ +#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf))) +#define SMB_VFS_NEXT_SET_OFFLINE(handle,path) ((handle)->vfs_next.ops.set_offline((handle)->vfs_next.handles.set_offline,(path))) + +#endif /* _VFS_MACROS_H */ diff --git a/source3/include/xfile.h b/source3/include/xfile.h new file mode 100644 index 0000000000..ffe4481a64 --- /dev/null +++ b/source3/include/xfile.h @@ -0,0 +1,48 @@ +/* + Unix SMB/CIFS implementation. + stdio replacement + Copyright (C) Andrew Tridgell 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _XFILE_H_ +#define _XFILE_H_ +/* + see xfile.c for explanations +*/ + +typedef struct { + int fd; + char *buf; + char *next; + int bufsize; + int bufused; + int open_flags; + int buftype; + int flags; +} XFILE; + +extern XFILE *x_stdin, *x_stdout, *x_stderr; + +/* buffering type */ +#define X_IOFBF 0 +#define X_IOLBF 1 +#define X_IONBF 2 + +#define x_getc(f) x_fgetc(f) + +int x_vfprintf(XFILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0); +int x_fprintf(XFILE *f, const char *format, ...) PRINTF_ATTRIBUTE(2, 3); +#endif /* _XFILE_H_ */ |