From b2edf254eda92f775e7d3d9b6793b4d77f9000b6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 17 Aug 2002 17:00:51 +0000 Subject: sync 3.0 branch with head (This used to be commit 3928578b52cfc949be5e0ef444fce1558d75f290) --- source3/include/ads.h | 62 ++++++++++--- source3/include/config.h.in | 17 ++-- source3/include/includes.h | 2 + source3/include/local.h | 14 ++- source3/include/messages.h | 1 + source3/include/nameserv.h | 2 + source3/include/nt_printing.h | 32 ++++--- source3/include/passdb.h | 4 +- source3/include/rpc_lsa.h | 38 ++++++++ source3/include/rpc_reg.h | 108 +++++++++++++++++++++-- source3/include/rpc_samr.h | 72 ++++++++------- source3/include/rpc_spoolss.h | 14 +-- source3/include/rpc_srvsvc.h | 116 +++++++++++++++++++++--- source3/include/secrets.h | 4 + source3/include/smb.h | 27 ++++-- source3/include/version.h | 2 +- source3/include/vfs.h | 201 +++++++++++++++++++++++++++++++++++++++++- 17 files changed, 615 insertions(+), 101 deletions(-) (limited to 'source3/include') diff --git a/source3/include/ads.h b/source3/include/ads.h index b3e18f18b8..7504a369b4 100644 --- a/source3/include/ads.h +++ b/source3/include/ads.h @@ -5,18 +5,34 @@ */ typedef struct { - void *ld; - char *realm; - char *workgroup; - char *ldap_server; - char *ldap_server_name; - char *kdc_server; + void *ld; /* the active ldap structure */ + struct in_addr ldap_ip; /* the ip of the active connection, if any */ + time_t last_attempt; /* last attempt to reconnect */ int ldap_port; - char *bind_path; - time_t last_attempt; - char *password; - char *user_name; - char *server_realm; + + /* 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 */ + } server; + + /* info needed to authenticate */ + struct { + char *realm; + char *password; + char *user_name; + char *kdc_server; + int no_bind; + } auth; + + /* info derived from the servers config */ + struct { + char *realm; + char *bind_path; + char *ldap_server_name; + } config; } ADS_STRUCT; typedef struct { @@ -94,7 +110,7 @@ typedef void **ADS_MODLIST; /* macros to simplify error returning */ #define ADS_ERROR(rc) ads_build_error(ADS_ERROR_LDAP, rc, 0) -#define ADS_ERROR_SYSTEM(rc) ads_build_error(ADS_ERROR_SYSTEM, rc, 0) +#define ADS_ERROR_SYSTEM(rc) ads_build_error(ADS_ERROR_SYSTEM, rc?rc:EINVAL, 0) #define ADS_ERROR_KRB5(rc) ads_build_error(ADS_ERROR_KRB5, rc, 0) #define ADS_ERROR_GSS(rc, minor) ads_build_error(ADS_ERROR_GSS, rc, minor) @@ -129,3 +145,25 @@ typedef void **ADS_MODLIST; /* account types */ #define ATYPE_GROUP 0x10000000 #define ATYPE_USER 0x30000000 + +/* Mailslot or cldap getdcname response flags */ +#define ADS_PDC 0x00000001 /* DC is PDC */ +#define ADS_GC 0x00000004 /* DC is a GC of forest */ +#define ADS_LDAP 0x00000008 /* DC is an LDAP server */ +#define ADS_DS 0x00000010 /* DC supports DS */ +#define ADS_KDC 0x00000020 /* DC is running KDC */ +#define ADS_TIMESERV 0x00000040 /* DC is running time services */ +#define ADS_CLOSEST 0x00000080 /* DC is closest to client */ +#define ADS_WRITABLE 0x00000100 /* DC has writable DS */ +#define ADS_GOOD_TIMESERV 0x00000200 /* DC has hardware clock + (and running time) */ +#define ADS_NDNC 0x00000400 /* DomainName is non-domain NC serviced + by LDAP server */ +#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 */ + +/* DomainCntrollerAddressType */ +#define ADS_INET_ADDRESS 0x00000001 +#define ADS_NETBIOS_ADDRESS 0x00000002 diff --git a/source3/include/config.h.in b/source3/include/config.h.in index ac28c0856c..4a138b6db6 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -285,6 +285,8 @@ #undef _GNU_SOURCE #endif +#undef LDAP_SET_REBIND_PROC_ARGS + /* The number of bytes in a int. */ #undef SIZEOF_INT @@ -615,6 +617,9 @@ /* Define if you have the getgrnam function. */ #undef HAVE_GETGRNAM +/* Define if you have the getgrouplist function. */ +#undef HAVE_GETGROUPLIST + /* Define if you have the getnetgrent function. */ #undef HAVE_GETNETGRENT @@ -645,6 +650,9 @@ /* Define if you have the innetgr function. */ #undef HAVE_INNETGR +/* Define if you have the ldap_set_rebind_proc function. */ +#undef HAVE_LDAP_SET_REBIND_PROC + /* Define if you have the link function. */ #undef HAVE_LINK @@ -873,12 +881,6 @@ /* Define if you have the header file. */ #undef HAVE_CTYPE_H -/* Define if you have the header file. */ -#undef HAVE_CUPS_CUPS_H - -/* Define if you have the header file. */ -#undef HAVE_CUPS_LANGUAGE_H - /* Define if you have the header file. */ #undef HAVE_DIRENT_H @@ -1125,9 +1127,6 @@ /* Define if you have the acl library (-lacl). */ #undef HAVE_LIBACL -/* Define if you have the cups library (-lcups). */ -#undef HAVE_LIBCUPS - /* Define if you have the gen library (-lgen). */ #undef HAVE_LIBGEN diff --git a/source3/include/includes.h b/source3/include/includes.h index 435810a1ba..6084d583ed 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -707,9 +707,11 @@ extern int errno; #include "hash.h" #include "trans2.h" #include "nterr.h" +#include "ntioctl.h" #include "messages.h" #include "charset.h" #include "dynconfig.h" +#include "adt_tree.h" #include "util_getent.h" diff --git a/source3/include/local.h b/source3/include/local.h index 24f3fa7724..2538715c41 100644 --- a/source3/include/local.h +++ b/source3/include/local.h @@ -187,8 +187,20 @@ 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 -#define SESSION_TEMPLATE "smb/%d" +/* 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 */ diff --git a/source3/include/messages.h b/source3/include/messages.h index 79a08a7546..58e606b40f 100644 --- a/source3/include/messages.h +++ b/source3/include/messages.h @@ -51,6 +51,7 @@ /* #define MSG_PRINTER_NOTIFY 2001*/ /* Obsolete */ #define MSG_PRINTER_DRVUPGRADE 2002 #define MSG_PRINTER_NOTIFY2 2003 +#define MSG_PRINTERDATA_INIT_RESET 2004 /* smbd messages */ #define MSG_SMB_CONF_UPDATED 3001 diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h index fefa243c3f..14561cf44d 100644 --- a/source3/include/nameserv.h +++ b/source3/include/nameserv.h @@ -557,6 +557,8 @@ struct packet_struct #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. */ diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h index 57181c6659..5e2b8f7f64 100644 --- a/source3/include/nt_printing.h +++ b/source3/include/nt_printing.h @@ -174,14 +174,27 @@ typedef struct nt_printer_driver_info_level NT_PRINTER_DRIVER_INFO_LEVEL_6 *info_6; } NT_PRINTER_DRIVER_INFO_LEVEL; -typedef struct nt_printer_param -{ - fstring value; - uint32 type; - uint8 *data; - int data_len; - struct nt_printer_param *next; -} NT_PRINTER_PARAM; +/* 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" + +/* 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; typedef struct ntdevicemode { @@ -246,9 +259,8 @@ typedef struct nt_printer_info_level_2 fstring printprocessor; fstring datatype; fstring parameters; - NT_PRINTER_PARAM *specific; + NT_PRINTER_DATA data; SEC_DESC_BUF *secdesc_buf; - /* not used but ... and how ??? */ uint32 changeid; uint32 c_setprinter; uint32 setuptime; diff --git a/source3/include/passdb.h b/source3/include/passdb.h index a79c8a0289..7a791ddac4 100644 --- a/source3/include/passdb.h +++ b/source3/include/passdb.h @@ -57,7 +57,7 @@ typedef struct pdb_context BOOL (*pdb_getsampwnam)(struct pdb_context *, SAM_ACCOUNT *sam_acct, const char *username); - BOOL (*pdb_getsampwsid)(struct pdb_context *, SAM_ACCOUNT *sam_acct, DOM_SID *sid); + BOOL (*pdb_getsampwsid)(struct pdb_context *, SAM_ACCOUNT *sam_acct, const DOM_SID *sid); BOOL (*pdb_add_sam_account)(struct pdb_context *, SAM_ACCOUNT *sampass); @@ -88,7 +88,7 @@ typedef struct pdb_methods BOOL (*getsampwnam)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const char *username); - BOOL (*getsampwsid)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, DOM_SID *Sid); + BOOL (*getsampwsid)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const DOM_SID *Sid); BOOL (*add_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass); diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index 8e42ac7d2c..39f3e47dc8 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -73,6 +73,7 @@ #define LSA_RETRPRIVDATA 0x2b #define LSA_OPENPOLICY2 0x2c #define LSA_UNK_GET_CONNUSER 0x2d /* LsaGetConnectedCredentials ? */ +#define LSA_QUERYINFO2 0x2e /* XXXX these are here to get a compile! */ #define LSA_LOOKUPRIDS 0xFD @@ -261,6 +262,43 @@ typedef struct lsa_r_query_info } LSA_R_QUERY_INFO; +/* LSA_DNS_DOM_INFO - DNS domain info - info class 12*/ +typedef struct lsa_dns_dom_info +{ + UNIHDR hdr_nb_dom_name; /* netbios domain name */ + UNIHDR hdr_dns_dom_name; + UNIHDR hdr_forest_name; + + GUID dom_guid; /* domain GUID */ + + UNISTR2 uni_nb_dom_name; + UNISTR2 uni_dns_dom_name; + UNISTR2 uni_forest_name; + + uint32 ptr_dom_sid; + DOM_SID2 dom_sid; /* domain SID */ +} LSA_DNS_DOM_INFO; + +typedef union lsa_info2_union +{ + LSA_DNS_DOM_INFO dns_dom_info; +} LSA_INFO2_UNION; + +/* LSA_Q_QUERY_INFO2 - LSA query info */ +typedef struct lsa_q_query_info2 +{ + POLICY_HND pol; /* policy handle */ + uint16 info_class; /* info class */ +} LSA_Q_QUERY_INFO2; + +typedef struct lsa_r_query_info2 +{ + uint32 ptr; /* pointer to info struct */ + uint16 info_class; + LSA_INFO2_UNION info; /* so far the only one */ + NTSTATUS status; +} LSA_R_QUERY_INFO2; + /* LSA_Q_ENUM_TRUST_DOM - LSA enumerate trusted domains */ typedef struct lsa_enum_trust_dom_info { diff --git a/source3/include/rpc_reg.h b/source3/include/rpc_reg.h index 3f3db0f2ba..92175cf287 100644 --- a/source3/include/rpc_reg.h +++ b/source3/include/rpc_reg.h @@ -1,9 +1,10 @@ /* 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) Andrew Tridgell 1992-1997. + Copyright (C) Luke Kenneth Casson Leighton 1996-1997. + Copyright (C) Paul Ashton 1997. + Copyright (C) Gerald Carter 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 @@ -26,35 +27,35 @@ /* winreg pipe defines NOT IMPLEMENTED !! -#define REG_OPEN_HKCR 0x00 #define _REG_UNK_01 0x01 #define _REG_UNK_03 0x03 #define REG_CREATE_KEY 0x06 #define REG_DELETE_KEY 0x07 #define REG_DELETE_VALUE 0x08 -#define REG_ENUM_VALUE 0x0a #define REG_FLUSH_KEY 0x0b #define REG_GET_KEY_SEC 0x0c #define _REG_UNK_0D 0x0d #define _REG_UNK_0E 0x0e #define _REG_UNK_12 0x12 #define _REG_UNK_13 0x13 -#define _REG_UNK_14 0x14 #define REG_SET_KEY_SEC 0x15 #define REG_CREATE_VALUE 0x16 #define _REG_UNK_17 0x17 */ /* Implemented */ +#define REG_OPEN_HKCR 0x00 #define REG_OPEN_HKLM 0x02 #define REG_OPEN_HKU 0x04 #define REG_CLOSE 0x05 #define REG_ENUM_KEY 0x09 +#define REG_ENUM_VALUE 0x0a #define REG_OPEN_ENTRY 0x0f #define REG_QUERY_KEY 0x10 #define REG_INFO 0x11 #define REG_SHUTDOWN 0x18 #define REG_ABORT_SHUTDOWN 0x19 +#define REG_SAVE_KEY 0x14 /* no idea what the real name is */ #define REG_UNKNOWN_1A 0x1a @@ -63,6 +64,12 @@ #define HKEY_LOCAL_MACHINE 0x80000002 #define HKEY_USERS 0x80000003 +#define KEY_HKLM "HKLM" +#define KEY_HKU "HKU" +#define KEY_HKCR "HKCR" +#define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" +#define KEY_TREE_ROOT "" + /* Registry data types */ #define REG_NONE 0 @@ -82,6 +89,65 @@ #define REG_FORCE_SHUTDOWN 0x001 #define REG_REBOOT_ON_SHUTDOWN 0x100 +/* structure to contain registry values */ + +typedef struct { + fstring valuename; + uint16 type; + uint32 size; /* in bytes */ + uint8 *data_p; +} REGISTRY_VALUE; + +/* container for regostry values */ + +typedef struct { + TALLOC_CTX *ctx; + uint32 num_values; + REGISTRY_VALUE **values; +} REGVAL_CTR; + +/* container for registry subkey names */ + +typedef struct { + TALLOC_CTX *ctx; + uint32 num_subkeys; + char **subkeys; +} REGSUBKEY_CTR; + + +/* + * container for function pointers to enumeration routines + * for vitural registry view + */ + +typedef struct { + /* functions for enumerating subkeys and values */ + int (*subkey_fn)( char *key, REGSUBKEY_CTR *subkeys); + int (*value_fn) ( char *key, REGVAL_CTR *val ); + BOOL (*store_subkeys_fn)( char *key, REGSUBKEY_CTR *subkeys ); + BOOL (*store_values_fn)( char *key, REGVAL_CTR *val ); +} REGISTRY_OPS; + +typedef struct { + 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 { + + struct _RegistryKey *prev, *next; + + POLICY_HND hnd; + pstring name; /* full name of registry key */ + REGISTRY_HOOK *hook; + +} REGISTRY_KEY; + + /* REG_Q_OPEN_HKCR */ typedef struct q_reg_open_hkcr_info { @@ -107,7 +173,7 @@ typedef struct q_reg_open_hklm_info uint32 ptr; uint16 unknown_0; /* 0xE084 - 16 bit unknown */ uint16 unknown_1; /* random. changes */ - uint32 access_mask; /* 0x0000 0002 - 32 bit unknown */ + uint32 access_mask; } REG_Q_OPEN_HKLM; @@ -246,6 +312,7 @@ typedef struct q_reg_query_value_info uint32 ptr2; /* pointer */ uint32 len_value2; /* */ + } REG_Q_ENUM_VALUE; /* REG_R_ENUM_VALUE */ @@ -258,7 +325,7 @@ typedef struct r_reg_enum_value_info uint32 type; /* 1 = UNISTR, 3 = BYTES, 4 = DWORD, 7 = MULTI_UNISTR */ uint32 ptr_value; /* pointer */ - BUFFER2 *buf_value; /* value, in byte buffer */ + BUFFER2 buf_value; /* value, in byte buffer */ uint32 ptr1; /* pointer */ uint32 len_value1; /* */ @@ -388,6 +455,29 @@ typedef struct r_reg_unk_1a_info } REG_R_UNKNOWN_1A; +/* REG_Q_UNKNOWN_1A */ +typedef struct q_reg_unknown_14 +{ + POLICY_HND pol; /* policy handle */ + + UNIHDR hdr_file; /* unicode product type header */ + UNISTR2 uni_file; /* local filename to save key as from regedt32.exe */ + /* e.g. "c:\temp\test.dat" */ + + uint32 unknown; /* 0x0000 0000 */ + +} REG_Q_SAVE_KEY; + + +/* REG_R_UNKNOWN_1A */ +typedef struct r_reg_unknown_14 +{ + NTSTATUS status; /* return status */ + +} REG_R_SAVE_KEY; + + + /* REG_Q_CLOSE */ typedef struct reg_q_close_info { @@ -481,7 +571,7 @@ typedef struct r_reg_info_info uint32 type; /* key datatype */ uint32 ptr_uni_val; /* key value pointer */ - BUFFER2 *uni_val; /* key value */ + BUFFER2 uni_val; /* key value */ uint32 ptr_max_len; uint32 buf_max_len; diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index 78d5c244a6..11438ae067 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -4,7 +4,10 @@ Copyright (C) Andrew Tridgell 1992-2000 Copyright (C) Luke Kenneth Casson Leighton 1996-2000 Copyright (C) Paul Ashton 1997-2000 - Copyright (C) Jean François Micouleau 1998-2001. + Copyright (C) Jean François Micouleau 1998-2001 + Copyright (C) Anthony Liguori 2002 + Copyright (C) Jim McDonough 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 @@ -24,10 +27,8 @@ #ifndef _RPC_SAMR_H /* _RPC_SAMR_H */ #define _RPC_SAMR_H - #include "rpc_misc.h" - /******************************************************************* the following information comes from a QuickView on samsrv.dll, and gives an idea of exactly what is needed: @@ -144,6 +145,7 @@ SamrTestPrivateFunctionsUser #define SAMR_GET_DOM_PWINFO 0x38 #define SAMR_CONNECT 0x39 #define SAMR_SET_USERINFO 0x3A +#define SAMR_CONNECT4 0x3E /* Access bits to the SAM-object */ @@ -176,17 +178,17 @@ SamrTestPrivateFunctionsUser /* Access bits to Domain-objects */ -#define DOMAIN_ACCESS_LOOKUP_INFO_1 0x000000001 -#define DOMAIN_ACCESS_SET_INFO_1 0x000000002 -#define DOMAIN_ACCESS_LOOKUP_INFO_2 0x000000004 -#define DOMAIN_ACCESS_SET_INFO_2 0x000000008 -#define DOMAIN_ACCESS_CREATE_USER 0x000000010 -#define DOMAIN_ACCESS_CREATE_GROUP 0x000000020 -#define DOMAIN_ACCESS_CREATE_ALIAS 0x000000040 -#define DOMAIN_ACCESS_UNKNOWN_80 0x000000080 -#define DOMAIN_ACCESS_ENUM_ACCOUNTS 0x000000100 -#define DOMAIN_ACCESS_OPEN_ACCOUNT 0x000000200 -#define DOMAIN_ACCESS_SET_INFO_3 0x000000400 +#define DOMAIN_ACCESS_LOOKUP_INFO_1 0x00000001 +#define DOMAIN_ACCESS_SET_INFO_1 0x00000002 +#define DOMAIN_ACCESS_LOOKUP_INFO_2 0x00000004 +#define DOMAIN_ACCESS_SET_INFO_2 0x00000008 +#define DOMAIN_ACCESS_CREATE_USER 0x00000010 +#define DOMAIN_ACCESS_CREATE_GROUP 0x00000020 +#define DOMAIN_ACCESS_CREATE_ALIAS 0x00000040 +#define DOMAIN_ACCESS_UNKNOWN_80 0x00000080 +#define DOMAIN_ACCESS_ENUM_ACCOUNTS 0x00000100 +#define DOMAIN_ACCESS_OPEN_ACCOUNT 0x00000200 +#define DOMAIN_ACCESS_SET_INFO_3 0x00000400 #define DOMAIN_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED_ACCESS | \ DOMAIN_ACCESS_SET_INFO_3 | \ @@ -220,17 +222,17 @@ SamrTestPrivateFunctionsUser /* Access bits to User-objects */ -#define USER_ACCESS_GET_NAME_ETC 0x000000001 -#define USER_ACCESS_GET_LOCALE 0x000000002 -#define USER_ACCESS_SET_LOC_COM 0x000000004 -#define USER_ACCESS_GET_LOGONINFO 0x000000008 -#define USER_ACCESS_UNKNOWN_10 0x000000010 -#define USER_ACCESS_SET_ATTRIBUTES 0x000000020 -#define USER_ACCESS_CHANGE_PASSWORD 0x000000040 -#define USER_ACCESS_SET_PASSWORD 0x000000080 -#define USER_ACCESS_GET_GROUPS 0x000000100 -#define USER_ACCESS_UNKNOWN_200 0x000000200 -#define USER_ACCESS_UNKNOWN_400 0x000000400 +#define USER_ACCESS_GET_NAME_ETC 0x00000001 +#define USER_ACCESS_GET_LOCALE 0x00000002 +#define USER_ACCESS_SET_LOC_COM 0x00000004 +#define USER_ACCESS_GET_LOGONINFO 0x00000008 +#define USER_ACCESS_UNKNOWN_10 0x00000010 +#define USER_ACCESS_SET_ATTRIBUTES 0x00000020 +#define USER_ACCESS_CHANGE_PASSWORD 0x00000040 +#define USER_ACCESS_SET_PASSWORD 0x00000080 +#define USER_ACCESS_GET_GROUPS 0x00000100 +#define USER_ACCESS_UNKNOWN_200 0x00000200 +#define USER_ACCESS_UNKNOWN_400 0x00000400 #define USER_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED_ACCESS | \ USER_ACCESS_UNKNOWN_400 | \ @@ -312,9 +314,6 @@ SamrTestPrivateFunctionsUser #define ALIAS_EXECUTE ( STANDARD_RIGHTS_EXECUTE_ACCESS | \ ALIAS_ACCESS_LOOKUP_INFO ) - - - typedef struct _DISP_USER_INFO { SAM_ACCOUNT *sam; } DISP_USER_INFO; @@ -1647,7 +1646,7 @@ typedef struct r_samr_create_user_info { POLICY_HND user_pol; /* policy handle associated with user */ - uint32 unknown_0; /* 0x0007 03ff */ + uint32 access_granted; uint32 user_rid; /* user RID */ NTSTATUS status; /* return status */ @@ -1870,6 +1869,19 @@ typedef struct r_samr_connect_info } SAMR_R_CONNECT; +/* SAMR_Q_CONNECT4 */ +typedef struct q_samr_connect4_info +{ + uint32 ptr_srv_name; /* pointer to server name */ + UNISTR2 uni_srv_name; + + uint32 unk_0; /* possible server name type, 1 for IP num, 2 for name */ + uint32 access_mask; +} SAMR_Q_CONNECT4; + +/* SAMR_R_CONNECT4 - same format as connect */ +typedef struct r_samr_connect_info SAMR_R_CONNECT4; + /* SAMR_Q_GET_DOM_PWINFO */ typedef struct q_samr_get_dom_pwinfo { @@ -2008,6 +2020,4 @@ typedef struct r_samr_set_domain_info } SAMR_R_SET_DOMAIN_INFO; - #endif /* _RPC_SAMR_H */ - diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 7ec9a509bf..b7acf44c5d 100755 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -202,6 +202,7 @@ #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 @@ -801,15 +802,16 @@ typedef struct spool_notify_info_data uint16 field; uint32 reserved; uint32 id; - union - { + union { uint32 value[2]; - struct - { + struct { uint32 length; uint16 *string; - } - data; + } data; + struct { + uint32 size; + SEC_DESC *desc; + } sd; } notify_data; uint32 size; diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h index 1753c19783..94d23bb4bc 100644 --- a/source3/include/rpc_srvsvc.h +++ b/source3/include/rpc_srvsvc.h @@ -4,6 +4,7 @@ Copyright (C) Andrew Tridgell 1992-1997 Copyright (C) Luke Kenneth Casson Leighton 1996-1997 Copyright (C) Paul Ashton 1997 + Copyright (C) Nigel Williams 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 @@ -33,6 +34,7 @@ #define SRV_NET_SHARE_GET_INFO 0x10 #define SRV_NET_SHARE_SET_INFO 0x11 #define SRV_NET_SHARE_DEL 0x12 +#define SRV_NET_SHARE_DEL_STICKY 0x13 #define SRV_NET_SRV_GET_INFO 0x15 #define SRV_NET_SRV_SET_INFO 0x16 #define SRV_NET_DISK_ENUM 0x17 @@ -54,7 +56,7 @@ typedef struct disk_enum_container { uint32 entries_read; uint32 unknown; uint32 disk_info_ptr; - DISK_INFO disk_info[MAX_SERVER_DISK_ENTRIES]; + DISK_INFO *disk_info; } DISK_ENUM_CONTAINER; typedef struct net_srv_disk_enum { @@ -294,6 +296,29 @@ typedef struct r_net_conn_enum_info } SRV_R_NET_CONN_ENUM; +/* SH_INFO_0 */ +typedef struct ptr_share_info0 +{ + uint32 ptr_netname; /* pointer to net name. */ +} SH_INFO_0; + +/* SH_INFO_0_STR (level 0 share info strings) */ +typedef struct str_share_info0 +{ + SH_INFO_0 *ptrs; + + UNISTR2 uni_netname; /* unicode string of net name */ + +} SH_INFO_0_STR; + +/* SRV_SHARE_INFO_0 */ +typedef struct share_info_0_info +{ + SH_INFO_0 info_0; + SH_INFO_0_STR info_0_str; + +} SRV_SHARE_INFO_0; + /* SH_INFO_1 (pointers to level 1 share info strings) */ typedef struct ptr_share_info1 { @@ -306,6 +331,8 @@ typedef struct ptr_share_info1 /* SH_INFO_1_STR (level 1 share info strings) */ typedef struct str_share_info1 { + SH_INFO_1 *ptrs; + UNISTR2 uni_netname; /* unicode string of net name */ UNISTR2 uni_remark; /* unicode string of comment */ @@ -336,6 +363,8 @@ typedef struct ptr_share_info2 /* SH_INFO_2_STR (level 2 share info strings) */ typedef struct str_share_info2 { + SH_INFO_2 *ptrs; + UNISTR2 uni_netname; /* unicode string of net name (e.g NETLOGON) */ UNISTR2 uni_remark; /* unicode string of comment (e.g "Logon server share") */ UNISTR2 uni_path; /* unicode string of local path (e.g c:\winnt\system32\repl\import\scripts) */ @@ -383,6 +412,8 @@ typedef struct ptr_share_info502 uint32 num_uses; /* current uses */ uint32 ptr_path; /* pointer to path name */ uint32 ptr_passwd; /* pointer to password */ + uint32 reserved; /* this holds the space taken by the sd in the rpc packet */ + uint32 reserved_offset; /* required for _post operation when marshalling */ uint32 sd_size; /* size of security descriptor */ uint32 ptr_sd; /* pointer to security descriptor */ @@ -398,6 +429,7 @@ typedef struct str_share_info502 UNISTR2 uni_path; /* unicode string of local path (e.g c:\winnt\system32\repl\import\scripts) */ UNISTR2 uni_passwd; /* unicode string of password - presumably for share level security (e.g NULL) */ + uint32 reserved; uint32 sd_size; SEC_DESC *sd; @@ -411,12 +443,57 @@ typedef struct share_info_502_info } SRV_SHARE_INFO_502; -/* SRV_SHARE_INFO_1005 */ +typedef struct ptr_share_info1004 +{ + uint32 ptr_remark; + +} SH_INFO_1004; + +typedef struct str_share_info1004 +{ + SH_INFO_1004 *ptrs; + + UNISTR2 uni_remark; + +} SH_INFO_1004_STR; + +typedef struct ptr_info_1004_info +{ + SH_INFO_1004 info_1004; + SH_INFO_1004_STR info_1004_str; +} SRV_SHARE_INFO_1004; + typedef struct share_info_1005_info { uint32 dfs_root_flag; } SRV_SHARE_INFO_1005; +typedef struct share_info_1006_info +{ + uint32 max_uses; +} SRV_SHARE_INFO_1006; + +typedef struct ptr_share_info1007 +{ + uint32 flags; + uint32 ptr_AlternateDirectoryName; + +} SH_INFO_1007; + +typedef struct str_share_info1007 +{ + SH_INFO_1007 *ptrs; + + UNISTR2 uni_AlternateDirectoryName; + +} SH_INFO_1007_STR; + +typedef struct ptr_info_1007_info +{ + SH_INFO_1007 info_1007; + SH_INFO_1007_STR info_1007_str; +} SRV_SHARE_INFO_1007; + /* SRV_SHARE_INFO_1501 */ typedef struct share_info_1501_info { @@ -435,10 +512,16 @@ typedef struct srv_share_info_ctr_info uint32 num_entries2; union { - SRV_SHARE_INFO_1 *info1; /* share info level 1 */ - SRV_SHARE_INFO_2 *info2; /* share info level 2 */ - SRV_SHARE_INFO_501 *info501; /* share info level 501 */ - SRV_SHARE_INFO_502 *info502; /* share info level 502 */ + SRV_SHARE_INFO_0 *info0; + SRV_SHARE_INFO_1 *info1; /* share info level 1 */ + SRV_SHARE_INFO_2 *info2; /* share info level 2 */ + SRV_SHARE_INFO_501 *info501; /* share info level 501 */ + SRV_SHARE_INFO_502 *info502; /* share info level 502 */ + SRV_SHARE_INFO_1004 *info1004; + SRV_SHARE_INFO_1005 *info1005; + SRV_SHARE_INFO_1006 *info1006; + SRV_SHARE_INFO_1007 *info1007; + SRV_SHARE_INFO_1501 *info1501; void *info; } share; @@ -484,19 +567,21 @@ typedef struct q_net_share_get_info_info } SRV_Q_NET_SHARE_GET_INFO; -/* JRA. NB. We also need level 1004 and 1006 here. */ - /* SRV_SHARE_INFO */ typedef struct srv_share_info { uint32 switch_value; uint32 ptr_share_ctr; union { + SRV_SHARE_INFO_0 info0; SRV_SHARE_INFO_1 info1; SRV_SHARE_INFO_2 info2; SRV_SHARE_INFO_501 info501; SRV_SHARE_INFO_502 info502; + SRV_SHARE_INFO_1004 info1004; SRV_SHARE_INFO_1005 info1005; + SRV_SHARE_INFO_1006 info1006; + SRV_SHARE_INFO_1007 info1007; SRV_SHARE_INFO_1501 info1501; } share; } SRV_SHARE_INFO; @@ -520,12 +605,16 @@ typedef struct q_net_share_set_info_info SRV_SHARE_INFO info; + uint32 ptr_parm_error; + uint32 parm_error; + } SRV_Q_NET_SHARE_SET_INFO; /* SRV_R_NET_SHARE_SET_INFO */ typedef struct r_net_share_set_info { - uint32 switch_value; /* switch value */ + uint32 ptr_parm_error; + uint32 parm_error; WERROR status; /* return status */ @@ -549,7 +638,9 @@ typedef struct q_net_share_add /* SRV_R_NET_SHARE_ADD */ typedef struct r_net_share_add { - uint32 switch_value; /* switch value */ + + uint32 ptr_parm_error; + uint32 parm_error; WERROR status; /* return status */ @@ -594,9 +685,12 @@ typedef struct str_file_info3_info /* SRV_FILE_INFO_3 */ typedef struct srv_file_info_3 { + uint32 num_entries_read; /* EntriesRead */ + uint32 ptr_file_info; /* Buffer */ + + uint32 num_entries_read2; /* EntriesRead */ FILE_INFO_3 info_3; /* file entry details */ FILE_INFO_3_STR info_3_str; /* file entry strings */ - } SRV_FILE_INFO_3; /* SRV_FILE_INFO_CTR */ diff --git a/source3/include/secrets.h b/source3/include/secrets.h index 8a5a573bcc..183b29d7a8 100644 --- a/source3/include/secrets.h +++ b/source3/include/secrets.h @@ -35,6 +35,10 @@ #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 */ diff --git a/source3/include/smb.h b/source3/include/smb.h index a67101ff09..263dd67c54 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -38,7 +38,9 @@ #define NMB_PORT 137 #define DGRAM_PORT 138 -#define SMB_PORT 139 +#define SMB_PORT1 445 +#define SMB_PORT2 139 +#define SMB_PORTS "445 139" #define False (0) #define True (1) @@ -383,7 +385,7 @@ typedef struct files_struct int fnum; struct connection_struct *conn; int fd; - int print_jobid; + uint32 print_jobid; SMB_DEV_T dev; SMB_INO_T inode; BOOL delete_on_close; @@ -444,6 +446,15 @@ typedef struct #include "smb_acls.h" #include "vfs.h" +typedef struct smb_vfs_handle_struct +{ + void *data; + /* Handle on dlopen() call */ + void *handle; + struct smb_vfs_handle_struct *next, *prev; + +} smb_vfs_handle_struct; + typedef struct connection_struct { struct connection_struct *next, *prev; @@ -461,9 +472,7 @@ typedef struct connection_struct char *origpath; struct vfs_ops vfs_ops; /* Filesystem operations */ - /* Handle on dlopen() call */ - void *dl_handle; - void *vfs_private; + struct smb_vfs_handle_struct *vfs_private; char *user; /* name of user who *opened* this connection */ uid_t uid; /* uid of user who *opened* this connection */ @@ -1594,8 +1603,8 @@ typedef struct user_struct uint8 session_key[16]; - int session_id; /* used by utmp and pam session code */ - + char *session_keystr; /* used by utmp and pam session code. + TDB key string */ int homes_snum; } user_struct; @@ -1667,4 +1676,8 @@ typedef struct { #define DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH 14 +/* Common popt structures */ + +extern struct poptOption popt_common_debug[]; + #endif /* _SMB_H */ diff --git a/source3/include/version.h b/source3/include/version.h index afc40a8cf9..74df1c9914 100644 --- a/source3/include/version.h +++ b/source3/include/version.h @@ -1 +1 @@ -#define VERSION "3.0-alpha17" +#define VERSION "3.0-alpha18" diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 2f9fedf77d..1b1a13d7c1 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -1,7 +1,8 @@ /* Unix SMB/CIFS implementation. VFS structures and parameters - Copyright (C) Tim Potter 1999 + Copyright (C) Tim Potter 1999 + Copyright (C) Alexander Bokovoy 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 @@ -16,6 +17,8 @@ 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. + + This work was sponsored by Optifacio Software Services, Inc. */ #ifndef _VFS_H @@ -40,7 +43,48 @@ /* Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA. */ /* Changed to version 3 for POSIX acl extensions. JRA. */ -#define SMB_VFS_INTERFACE_VERSION 3 +/* Changed to version 4 for cascaded VFS interface. Alexander Bokovoy. */ +#define SMB_VFS_INTERFACE_VERSION 5 + + +/* Version of supported cascaded interface backward copmatibility. + (version 4 corresponds to SMB_VFS_INTERFACE_VERSION 4) + It is used in vfs_init_custom() to detect VFS modules which conform to cascaded + VFS interface but implement elder version than current version of Samba uses. + This allows to use old modules with new VFS interface as far as combined VFS operation + set is coherent (will be in most cases). +*/ +#define SMB_VFS_INTERFACE_CASCADED 4 + +/* + Each VFS module must provide following global functions: + vfs_init -- initialization function + vfs_done -- finalization function + + vfs_init must return proper initialized vfs_op_tuple[] array + which describes all operations this module claims to intercept. This function + is called whenever module is loaded into smbd process using sys_dlopen(). + + vfs_init must store somewhere vfs_handle reference if module wants to store per-instance + private information for further usage. vfs_handle->data should be used to + store such information. Do not try to change other fields in this structure + or results likely to be unpredictable. + + vfs_done must perform finalization of the module. In particular, + this function must free vfs_ops structure returned to module from smb_vfs_get_opaque_ops() + function if it is used (see below). This function is called whenever module + is unloaded from smbd process using sys_dlclose(). + + Prototypes: + vfs_op_tuple *vfs_init(int *vfs_version, const struct vfs_ops *def_vfs_ops, + struct smb_vfs_handle_struct *vfs_handle); + void vfs_done(connection_struct *conn); + + All intercepted VFS operations must be declared as static functions inside module source + in order to keep smbd namespace unpolluted. See source of skel, audit, and recycle bin + example VFS modules for more details. + +*/ /* VFS operations structure */ @@ -135,4 +179,157 @@ struct vfs_options { char *value; }; +/* + Available VFS operations. These values must be in sync with vfs_ops struct. + 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, + + /* Directory operations */ + + SMB_VFS_OP_OPENDIR, + SMB_VFS_OP_READDIR, + 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_WRITE, + SMB_VFS_OP_LSEEK, + 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_CHDIR, + SMB_VFS_OP_GETWD, + SMB_VFS_OP_UTIME, + SMB_VFS_OP_FTRUNCATE, + SMB_VFS_OP_LOCK, + SMB_VFS_OP_SYMLINK, + SMB_VFS_OP_READLINK, + SMB_VFS_OP_LINK, + SMB_VFS_OP_MKNOD, + SMB_VFS_OP_REALPATH, + + /* NT ACL operations. */ + + SMB_VFS_OP_FGET_NT_ACL, + SMB_VFS_OP_GET_NT_ACL, + SMB_VFS_OP_FSET_NT_ACL, + SMB_VFS_OP_SET_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, + + /* This should always be last enum value */ + + SMB_VFS_OP_LAST +} vfs_op_type; + +/* + 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 does 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 initialization function returns to VFS subsystem + an array of vfs_op_tuple which describes all operations this module is willing to intercept. + VFS subsystem initializes then vfs_ops using this information and passes it + to next VFS module as underlying vfs_ops and to connection after all VFS modules are initialized. +*/ + +typedef struct _vfs_op_tuple { + void* op; + vfs_op_type type; + vfs_op_layer layer; +} vfs_op_tuple; + +/* + Return vfs_ops filled with current opaque VFS operations. This function is designed to + be called from VFS module initialization function for those modules which needs 'direct' VFS + access (loggers or initiators of file operations other than connection asks for). + + Returned vfs_ops must be cleaned up in VFS module's finalizer function (vfs_done_) + using safe_free(). + + Prototype: + struct vfs_ops *smb_vfs_get_opaque_ops(); + + This prototype will be available via include/proto.h +*/ + #endif /* _VFS_H */ -- cgit