From adfefcdcb6e9d8ea0458a11b6f684a5cf231c3ba Mon Sep 17 00:00:00 2001 From: Jim McDonough <jmcd@samba.org> Date: Wed, 19 Feb 2003 01:16:40 +0000 Subject: Try to get heimdal working with HEAD. - Provide generic functions for - get valid encryption types - free encryption types - Add encryption type parm to generic function create_kerberos_key_from_string() - Try to merge the two versions (between HEAD and SAMBA_3_0) of kerberos_verify.c I think this should work for both MIT and heimdal, in HEAD. If all goes smooth, I'll move it over to 3.0 soon... (This used to be commit 45e409fc8da9f26cf888e13d004392660d7c55d4) --- source3/include/includes.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index 988913d16c..c5738f0a61 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1224,11 +1224,12 @@ krb5_error_code krb5_auth_con_setuseruserkey(krb5_context context, krb5_auth_con /* Samba wrapper function for krb5 functionality. */ void setup_kaddr( krb5_address *pkaddr, struct sockaddr *paddr); -int create_kerberos_key_from_string(krb5_context context, krb5_principal host_princ, krb5_data *password, krb5_keyblock *key); +int create_kerberos_key_from_string(krb5_context context, krb5_principal host_princ, krb5_data *password, krb5_keyblock *key, krb5_enctype enctype); void get_auth_data_from_tkt(DATA_BLOB *auth_data, krb5_ticket *tkt); krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt); krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters); - +krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes); +void free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); #endif /* HAVE_KRB5 */ #endif /* _INCLUDES_H */ -- cgit From 3b541bdcfe14d30d961a5de20d382af179c381ee Mon Sep 17 00:00:00 2001 From: Jim McDonough <jmcd@samba.org> Date: Wed, 19 Feb 2003 03:19:30 +0000 Subject: Get non-krb systems to compile. How the heck do I keep something from being sucked into proto.h? (This used to be commit 7e84497882df5bf933ab7ae7fe9af3728393202c) --- source3/include/includes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index c5738f0a61..bb78ae0780 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1229,7 +1229,7 @@ void get_auth_data_from_tkt(DATA_BLOB *auth_data, krb5_ticket *tkt); krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt); krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters); krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes); -void free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); +krb5_error_code free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); #endif /* HAVE_KRB5 */ #endif /* _INCLUDES_H */ -- cgit From 1f1125577c000ab72754af00cd83c57fadcc85f1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Wed, 19 Feb 2003 11:33:35 +0000 Subject: Move to a in-memory ccache for winbind, and replace setenv() properly. (According to the manpages, you cannot put a stack variable into putenv()). Yes, this leaks memory. Andrew Bartlett (This used to be commit 50bced1e26434ecc7474964062746e2831e5f433) --- source3/include/includes.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index bb78ae0780..731d94996c 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -966,6 +966,10 @@ size_t strnlen(const char *s, size_t n); unsigned long strtoul(const char *nptr, char **endptr, int base); #endif +#ifndef HAVE_SETENV +int setenv(const char *name, const char *value, int overwrite); +#endif + #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESUID_DECL)) /* stupid glibc */ int setresuid(uid_t ruid, uid_t euid, uid_t suid); -- cgit From 02cb49bffae34d0f373f5d400077a7a8b7e809b2 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy <ab@samba.org> Date: Wed, 19 Feb 2003 13:24:06 +0000 Subject: Improve detection of iconv(3) for various platforms. M4 code is similar to what I use in Midgard for past few years, modified for Samba needs. (This used to be commit 747d2d70a9eb4d9222d7b63e5fcec269eda76672) --- source3/include/includes.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index 731d94996c..0d1c72cf1c 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -393,8 +393,13 @@ #endif /* HAVE_SYS_SHM_H */ #ifdef HAVE_NATIVE_ICONV +#ifdef HAVE_ICONV #include <iconv.h> #endif +#ifdef HAVE_GICONV +#include <giconv.h> +#endif +#endif #if HAVE_KRB5_H #include <krb5.h> -- cgit From ffcee0c95e05f652f4eebf9b9d46bd51d059891b Mon Sep 17 00:00:00 2001 From: Jim McDonough <jmcd@samba.org> Date: Wed, 19 Feb 2003 15:22:46 +0000 Subject: Correct way to keep fucntion from proto.h (This used to be commit 762b072efb0d6801775a874494cb19ea3d61fa97) --- source3/include/includes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index 0d1c72cf1c..5b4c5a695f 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1238,7 +1238,7 @@ void get_auth_data_from_tkt(DATA_BLOB *auth_data, krb5_ticket *tkt); krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt); krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters); krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes); -krb5_error_code free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); +void free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); #endif /* HAVE_KRB5 */ #endif /* _INCLUDES_H */ -- cgit From 8d8a8c9633ea04d269d70b1fa8f4393cc73f7bbd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij <jelmer@samba.org> Date: Thu, 20 Feb 2003 22:26:28 +0000 Subject: Make init_module() and thus smb_load_module() return an int. modules/developer.c: init_module() should return an int (This used to be commit 7f59703550378ff2333e3c851bf1a77037510abd) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/smb.h b/source3/include/smb.h index f96a19954a..71051e341e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1721,6 +1721,6 @@ extern struct poptOption popt_common_netbios_name[]; extern struct poptOption popt_common_log_base[]; /* Module support */ -typedef NTSTATUS (init_module_function) (void); +typedef int (init_module_function) (void); #endif /* _SMB_H */ -- cgit From 7e110f782a55d4dca1fb3fedd95bf059c9ec0638 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sat, 22 Feb 2003 12:22:06 +0000 Subject: More signed/unsigned fixes (yes, I run with funny compiler options) and make x_fwrite() match fwrite() in returning a size_t. Andrew Bartlett (This used to be commit 2943c695787b742e9a96b2eefe2d75f681bacf7c) --- source3/include/hash.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include') diff --git a/source3/include/hash.h b/source3/include/hash.h index c327c971ab..40cc8b7cab 100644 --- a/source3/include/hash.h +++ b/source3/include/hash.h @@ -66,8 +66,8 @@ typedef struct hash_element { typedef struct hash_table { ubi_dlList *buckets; ubi_dlList lru_chain; - int num_elements; - int size; + unsigned num_elements; + unsigned size; compare_function comp_func; } hash_table; -- cgit From bd0bbde1bba4ad4e6e95f269912943d9d583dce4 Mon Sep 17 00:00:00 2001 From: Simo Sorce <idra@samba.org> Date: Sun, 23 Feb 2003 18:08:07 +0000 Subject: forgot the altered include file (This used to be commit f3be08472b8b34d8921ff23c52dd2ba030c96f25) --- source3/include/genparser.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/include') diff --git a/source3/include/genparser.h b/source3/include/genparser.h index 002d79f8f9..f28cd78249 100644 --- a/source3/include/genparser.h +++ b/source3/include/genparser.h @@ -46,8 +46,8 @@ struct parse_string { char *s; }; -typedef int (*gen_dump_fn)(struct parse_string *, const char *ptr, unsigned indent); -typedef int (*gen_parse_fn)(char *ptr, const char *str); +typedef int (*gen_dump_fn)(TALLOC_CTX *, struct parse_string *, const char *ptr, unsigned indent); +typedef int (*gen_parse_fn)(TALLOC_CTX *, char *ptr, const char *str); /* genstruct.pl generates arrays of these */ struct parse_struct { @@ -63,8 +63,8 @@ struct parse_struct { }; #define DUMP_PARSE_DECL(type) \ - int gen_dump_ ## type(struct parse_string *, const char *, unsigned); \ - int gen_parse_ ## type(char *, const char *); + int gen_dump_ ## type(TALLOC_CTX *, struct parse_string *, const char *, unsigned); \ + int gen_parse_ ## type(TALLOC_CTX *, char *, const char *); DUMP_PARSE_DECL(char) DUMP_PARSE_DECL(int) -- cgit From eb64538dba772a9846c05e2712839dbaa12c39a1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Mon, 24 Feb 2003 11:09:21 +0000 Subject: Patch from Luke Howard to add mutual kerberos authentication, and SMB session keys for kerberos authentication. Andrew Bartlett (This used to be commit 8b798f03dbbdd670ff9af4eb46f7b0845c611e0f) --- source3/include/ads.h | 5 +++++ source3/include/asn_1.h | 7 +++++++ 2 files changed, 12 insertions(+) (limited to 'source3/include') diff --git a/source3/include/ads.h b/source3/include/ads.h index 304a997b2c..f90983e405 100644 --- a/source3/include/ads.h +++ b/source3/include/ads.h @@ -208,3 +208,8 @@ typedef void **ADS_MODLIST; /* 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 diff --git a/source3/include/asn_1.h b/source3/include/asn_1.h index ab7fa5d398..7d4da0db0c 100644 --- a/source3/include/asn_1.h +++ b/source3/include/asn_1.h @@ -59,4 +59,11 @@ typedef struct { #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 "\x01\x00" +#define TOK_ID_KRB_AP_REP "\x02\x00" +#define TOK_ID_KRB_ERROR "\x03\x00" +#define TOK_ID_GSS_GETMIC "\x01\x01" +#define TOK_ID_GSS_WRAP "\x02\x01" + #endif /* _ASN_1_H */ -- cgit From 79aaa35ea5e8c74ff7755ec650aca88cc7e4cf7e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Mon, 24 Feb 2003 21:07:03 +0000 Subject: Clean up non-krb5 breakages from my modifications to luke howard's patch. Andrew Bartlett (This used to be commit 32fd0c49009e38022523cc5c14567dd55de08206) --- source3/include/includes.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index 5b4c5a695f..fab02141cb 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1239,6 +1239,7 @@ krb5_const_principal get_principal_from_tkt(krb5_ticket *tkt); krb5_error_code krb5_locate_kdc(krb5_context ctx, const krb5_data *realm, struct sockaddr **addr_pp, int *naddrs, int get_masters); krb5_error_code get_kerberos_allowed_etypes(krb5_context context, krb5_enctype **enctypes); void free_kerberos_etypes(krb5_context context, krb5_enctype *enctypes); +BOOL krb5_get_smb_session_key(krb5_context context, krb5_auth_context auth_context, uint8 session_key[16]); #endif /* HAVE_KRB5 */ #endif /* _INCLUDES_H */ -- cgit From 7c7d796b6d292a7c98b099ad1e1adbc4f2363512 Mon Sep 17 00:00:00 2001 From: Gerald Carter <jerry@samba.org> Date: Tue, 25 Feb 2003 20:51:23 +0000 Subject: Progress on CR 601 cache the printer_info_2 with the open printer handle. cache is invalidated on a mod_a_printer() call **on that smbd**. Yes, this means that the window for admins to step on each other from different clients just got larger, but since handles a generally short lived this is probably ok. (This used to be commit 33c7b7522504fb15989f32add8e9a087c8d9d0fa) --- source3/include/nt_printing.h | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'source3/include') diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h index 6d952a89a5..ca65a40d48 100644 --- a/source3/include/nt_printing.h +++ b/source3/include/nt_printing.h @@ -434,4 +434,49 @@ typedef struct { SPOOLSS_NOTIFY_MSG_GROUP *msg_groups; } SPOOLSS_NOTIFY_MSG_CTR; +#define PRINTER_HANDLE_IS_PRINTER 0 +#define PRINTER_HANDLE_IS_PRINTSERVER 1 + +/* 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 */ + BOOL printer_type; + TALLOC_CTX *ctx; + union { + fstring handlename; + fstring printerservername; + } dev; + 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_ */ -- cgit From f6f76ad5ed7b3eee7cbd3bca6f3ccd1194a0e98a Mon Sep 17 00:00:00 2001 From: Jeremy Allison <jra@samba.org> Date: Thu, 27 Feb 2003 00:43:23 +0000 Subject: Fix to allow blocking lock notification to be done rapidly (no wait for smb -> smb lock release). Adds new PENDING_LOCK type to lockdb (does not interfere with existing locks). Jeremy. (This used to be commit 22fc0d48ff2052b4274c65f85050c58b235bf4e4) --- source3/include/messages.h | 1 + source3/include/smb.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/messages.h b/source3/include/messages.h index 2b8ca8bbe9..ce167a772d 100644 --- a/source3/include/messages.h +++ b/source3/include/messages.h @@ -62,6 +62,7 @@ #define MSG_SMB_FORCE_TDIS 3002 #define MSG_SMB_SAM_SYNC 3003 #define MSG_SMB_SAM_REPL 3004 +#define MSG_SMB_UNLOCK 3005 /* Flags to classify messages - used in message_send_all() */ /* Sender will filter by flag. */ diff --git a/source3/include/smb.h b/source3/include/smb.h index 71051e341e..a2b341d0fc 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -772,7 +772,7 @@ typedef enum } parm_class; /* passed to br lock code */ -enum brl_type {READ_LOCK, WRITE_LOCK}; +enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_LOCK}; struct enum_list { int value; -- cgit From 97e7d2ffae74c9c07b38143c8fb028ee91b153bd Mon Sep 17 00:00:00 2001 From: Gerald Carter <jerry@samba.org> Date: Thu, 27 Feb 2003 21:21:02 +0000 Subject: additional fix for CR 601 * distinguish WinXP from Win2k * add a 1/3 of a second delay in OpenPrinter in order to trigger a LAN/WAN optimization in 2k clients. (This used to be commit 96570699d1b715f47c35aa211da6ec18f6fc4109) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/smb.h b/source3/include/smb.h index a2b341d0fc..bd4f113039 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1408,7 +1408,7 @@ enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS}; 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_SAMBA}; +enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_SAMBA}; /* case handling */ enum case_handling {CASE_LOWER,CASE_UPPER}; -- cgit From 9f0ae6fad2d0099a58fec389ddd430c0448ec02e Mon Sep 17 00:00:00 2001 From: Jeremy Allison <jra@samba.org> Date: Fri, 28 Feb 2003 00:26:20 +0000 Subject: *Excellent* patch from Michael Steffens <michael_steffens@hp.com> to limit the unix domain sockets used by winbindd (also solves FD_SETSIZE problem in winbindd to boot !). Adds a "last_access" field to winbindd connections, and will close the oldest idle connection once the number of open connections goes over WINBINDD_MAX_SIMULTANEOUS_CLIENTS (defined in local.h as 200 currently). Jeremy. (This used to be commit a82caefda49396641e8650db8a7ef51752ba6c41) --- source3/include/local.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include') diff --git a/source3/include/local.h b/source3/include/local.h index e16cdbbc5d..29b0641119 100644 --- a/source3/include/local.h +++ b/source3/include/local.h @@ -221,4 +221,6 @@ /* 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 #endif -- cgit From 4e5439438c452e7153f122de2ca7428e885b4c6a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell <tridge@samba.org> Date: Sat, 1 Mar 2003 01:07:18 +0000 Subject: the new DEVELOPER checks for string overflows have (as expected) broken a lot of stuff. These two macros are meant to make life easier when fixing these bugs. I'm guessing we will see more macros like this (eg. fstrcpy_base) (This used to be commit 50389c0cb2504d7941ec691af21d6a20ae5c5de7) --- source3/include/safe_string.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 26bf6cdd6f..431dc400aa 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -87,4 +87,13 @@ char * __unsafe_string_function_usage_here__(void); #define strlower(s) strlower_m(s) #define strupper(s) strupper_m(s) +/* 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 */ +#define pstrcpy_base(dest, src, pstring_base) \ + safe_strcpy(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1) + +#define push_pstring_base(dest, src, pstring_base) \ + push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE) + #endif -- cgit From 487a0562859e393e12b91eed17ab893236764763 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Wed, 5 Mar 2003 09:40:08 +0000 Subject: Use new configure test to turn on this automated test for correct string function usage. Andrew Bartlett (This used to be commit cdc6139a9646b267a9921fc11fa532640a2e4c7f) --- source3/include/safe_string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 431dc400aa..6c2bd82bb9 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -50,7 +50,7 @@ char * __unsafe_string_function_usage_here__(void); -#if 0 && defined __GNUC__ && __GNUC__ >= 2 && defined __OPTIMIZE__ +#ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS #define pstrcpy(d,s) ((sizeof(d) != sizeof(pstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcpy((d), (s),sizeof(pstring)-1)) #define pstrcat(d,s) ((sizeof(d) != sizeof(pstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcat((d), (s),sizeof(pstring)-1)) -- cgit From 26b1ed7cc05e3bfd9f83bdb664cc6ca0a9883c4a Mon Sep 17 00:00:00 2001 From: Gerald Carter <jerry@samba.org> Date: Thu, 6 Mar 2003 16:06:12 +0000 Subject: add #define for the max device name length in a DEVICEMODE (This used to be commit 21ec2b6ba3ddba6964f6ddb53f8494e4a8b48a83) --- source3/include/nt_printing.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include') diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h index ca65a40d48..762b1c6917 100644 --- a/source3/include/nt_printing.h +++ b/source3/include/nt_printing.h @@ -255,6 +255,8 @@ typedef struct { NT_PRINTER_KEY *keys; } NT_PRINTER_DATA; +#define MAXDEVICENAME 32 + typedef struct ntdevicemode { fstring devicename; -- cgit From 8a751c019c21b1925fd352639f8237cf0a6ebac9 Mon Sep 17 00:00:00 2001 From: Simo Sorce <idra@samba.org> Date: Fri, 7 Mar 2003 18:26:24 +0000 Subject: Some progress towards gums and tdbsam2 genparser works fine, and it is a marvelous tool to store objects in tdb :) (This used to be commit 4c6d461a8572f03cd33cba95500cc837638b732c) --- source3/include/gums.h | 102 +++++++++++++++++++++++++-------------------- source3/include/includes.h | 2 + source3/include/tdbsam2.h | 11 ++--- 3 files changed, 64 insertions(+), 51 deletions(-) (limited to 'source3/include') diff --git a/source3/include/gums.h b/source3/include/gums.h index ca124d7442..789acc269f 100644 --- a/source3/include/gums.h +++ b/source3/include/gums.h @@ -21,8 +21,8 @@ #ifndef _GUMS_H #define _GUMS_H -#define GUMS_VERSION_MAJOR 0 -#define GUMS_VERSION_MINOR 1 +#define GUMS_VERSION_MAJOR 0 +#define GUMS_VERSION_MINOR 1 #define GUMS_OBJECT_VERSION 1 #define GUMS_OBJ_DOMAIN 1 @@ -74,10 +74,17 @@ typedef struct gums_group } GUMS_GROUP; +typedef struct gums_domain +{ + uint32 next_rid; + +} GUMS_DOMAIN; + union gums_obj_p { - gums_user *user; - gums_group *group; -} + GUMS_USER *user; + GUMS_GROUP *group; + GUMS_DOMAIN *domain; +}; typedef struct gums_object { @@ -112,6 +119,7 @@ typedef struct gums_commit_set DOM_SID sid; /* Object Sid */ uint32 count; /* number of changes */ GUMS_DATA_SET **data; + } GUMS_COMMIT_SET; typedef struct gums_privilege @@ -145,7 +153,7 @@ typedef struct gums_functions NTSTATUS (*delete_object) (const DOM_SID *sid); NTSTATUS (*get_object_from_sid) (GUMS_OBJECT **object, const DOM_SID *sid, const int obj_type); - NTSTATUS (*get_sid_from_name) (GUMS_OBJECT **object, const char *name); + NTSTATUS (*get_object_from_name) (GUMS_OBJECT **object, const char *name, const int onj_type); /* This function is used to get the list of all objects changed since b_time, it is used to support PDC<->BDC synchronization */ NTSTATUS (*get_updated_objects) (GUMS_OBJECT **objects, const NTTIME base_time); @@ -159,10 +167,10 @@ typedef struct gums_functions NTSTATUS (*set_object) (const GUMS_OBJECT *object); /* set object values function */ - NTSTATUS (*set_object_values) (DOM_SID *sid, uint32 count, GUMS_DATA_SET *data_set); + NTSTATUS (*set_object_values) (DOM_SID *sid, uint32 count, GUMS_DATA_SET **data_set); /* Group related functions */ - NTSTATUS (*add_memberss_to_group) (const DOM_SID *group, const DOM_SID **members); + NTSTATUS (*add_members_to_group) (const DOM_SID *group, const DOM_SID **members); NTSTATUS (*delete_members_from_group) (const DOM_SID *group, const DOM_SID **members); NTSTATUS (*enumerate_group_members) (DOM_SID **members, const DOM_SID *sid, const int type); @@ -177,54 +185,56 @@ typedef struct gums_functions NTSTATUS (*delete_members_from_privilege) (const LUID_ATTR *priv, const DOM_SID **members); NTSTATUS (*enumerate_privilege_members) (DOM_SID **members, const LUID_ATTR *priv); NTSTATUS (*get_sid_privileges) (DOM_SID **privs, const DOM_SID *sid); + /* warning!: set_privilege will overwrite a prior existing privilege if such exist */ NTSTATUS (*set_privilege) (GUMS_PRIVILEGE *priv); } GUMS_FUNCTIONS; /* define value types */ +#define GUMS_SET_PRIMARY_GROUP 0x1 +#define GUMS_SET_SEC_DESC 0x2 -#define GUMS_SET_PRIMARY_GROUP 1 -#define GUMS_SET_SEC_DESC 2 +#define GUMS_SET_NAME 0x10 +#define GUMS_SET_DESCRIPTION 0x11 +#define GUMS_SET_FULL_NAME 0x12 /* user specific type values */ -#define GUMS_SET_LOGON_TIME 10 /* keep NTTIME consecutive */ -#define GUMS_SET_LOGOFF_TIME 11 /* too ease checking */ -#define GUMS_SET_KICKOFF_TIME 13 -#define GUMS_SET_PASS_LAST_SET_TIME 14 -#define GUMS_SET_PASS_CAN_CHANGE_TIME 15 -#define GUMS_SET_PASS_MUST_CHANGE_TIME 16 /* NTTIME end */ - -#define GUMS_SET_NAME 20 /* keep strings consecutive */ -#define GUMS_SET_DESCRIPTION 21 /* too ease checking */ -#define GUMS_SET_FULL_NAME 22 -#define GUMS_SET_HOME_DIRECTORY 23 -#define GUMS_SET_DRIVE 24 -#define GUMS_SET_LOGON_SCRIPT 25 -#define GUMS_SET_PROFILE_PATH 26 -#define GUMS_SET_WORKSTATIONS 27 -#define GUMS_SET_UNKNOWN_STRING 28 -#define GUMS_SET_MUNGED_DIAL 29 /* strings end */ - -#define GUMS_SET_LM_PASSWORD 40 -#define GUMS_SET_NT_PASSWORD 41 -#define GUMS_SET_PLAINTEXT_PASSWORD 42 -#define GUMS_SET_UNKNOWN_3 43 -#define GUMS_SET_LOGON_DIVS 44 -#define GUMS_SET_HOURS_LEN 45 -#define GUMS_SET_HOURS 46 -#define GUMS_SET_UNKNOWN_5 47 -#define GUMS_SET_UNKNOWN_6 48 - -#define GUMS_SET_MUST_CHANGE_PASS 50 -#define GUMS_SET_CANNOT_CHANGE_PASS 51 -#define GUMS_SET_PASS_NEVER_EXPIRE 52 -#define GUMS_SET_ACCOUNT_DISABLED 53 -#define GUMS_SET_ACCOUNT_LOCKOUT 54 +#define GUMS_SET_LOGON_TIME 0x20 +#define GUMS_SET_LOGOFF_TIME 0x21 +#define GUMS_SET_KICKOFF_TIME 0x23 +#define GUMS_SET_PASS_LAST_SET_TIME 0x24 +#define GUMS_SET_PASS_CAN_CHANGE_TIME 0x25 +#define GUMS_SET_PASS_MUST_CHANGE_TIME 0x26 + + +#define GUMS_SET_HOME_DIRECTORY 0x31 +#define GUMS_SET_DRIVE 0x32 +#define GUMS_SET_LOGON_SCRIPT 0x33 +#define GUMS_SET_PROFILE_PATH 0x34 +#define GUMS_SET_WORKSTATIONS 0x35 +#define GUMS_SET_UNKNOWN_STRING 0x36 +#define GUMS_SET_MUNGED_DIAL 0x37 + +#define GUMS_SET_LM_PASSWORD 0x40 +#define GUMS_SET_NT_PASSWORD 0x41 +#define GUMS_SET_PLAINTEXT_PASSWORD 0x42 +#define GUMS_SET_UNKNOWN_3 0x43 +#define GUMS_SET_LOGON_DIVS 0x44 +#define GUMS_SET_HOURS_LEN 0x45 +#define GUMS_SET_HOURS 0x46 +#define GUMS_SET_UNKNOWN_5 0x47 +#define GUMS_SET_UNKNOWN_6 0x48 + +#define GUMS_SET_MUST_CHANGE_PASS 0x50 +#define GUMS_SET_CANNOT_CHANGE_PASS 0x51 +#define GUMS_SET_PASS_NEVER_EXPIRE 0x52 +#define GUMS_SET_ACCOUNT_DISABLED 0x53 +#define GUMS_SET_ACCOUNT_LOCKOUT 0x54 /*group specific type values */ -#define GUMS_ADD_SID_LIST 60 -#define GUMS_DEL_SID_LIST 61 -#define GUMS_SET_SID_LIST 62 +#define GUMS_ADD_SID_LIST 0x60 +#define GUMS_DEL_SID_LIST 0x61 +#define GUMS_SET_SID_LIST 0x62 #endif /* _GUMS_H */ diff --git a/source3/include/includes.h b/source3/include/includes.h index fab02141cb..b9ba4b84d5 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -775,6 +775,8 @@ extern int errno; #include "sam.h" +#include "gums.h" + #include "session.h" #include "asn_1.h" diff --git a/source3/include/tdbsam2.h b/source3/include/tdbsam2.h index 0ca9d34618..047b4e7c90 100644 --- a/source3/include/tdbsam2.h +++ b/source3/include/tdbsam2.h @@ -18,16 +18,17 @@ * Mass Ave, Cambridge, MA 02139, USA. */ - /* ALL strings assumes UTF8 as encoding */ GENSTRUCT struct tdbsam2_domain_data { uint32 xcounter; /* counter to be updated at any change */ SEC_DESC *sec_desc; /* Security Descriptor */ - DOM_SID *user_sid; /* The User SID */ - char *name; _NULLTERM /* NT User Name */ + DOM_SID *dom_sid; /* The Domain SID */ + char *name; _NULLTERM /* NT Domain Name */ char *description; _NULLTERM /* Descritpion (Gecos) */ + + uint32 next_rid; /* The Next free RID */ }; GENSTRUCT struct tdbsam2_user_data { @@ -67,14 +68,14 @@ GENSTRUCT struct tdbsam2_user_data { uint32 unknown_3; /* 0x00ff ffff */ uint32 unknown_5; /* 0x0002 0000 */ uint32 unknown_6; /* 0x0000 04ec */ -}; +}; GENSTRUCT struct tdbsam2_group_data { uint32 xcounter; /* counter to be updated at any change */ SEC_DESC *sec_desc; /* Security Descriptor */ DOM_SID *group_sid; /* The Group SID */ - char *name; _NULLTERM /* NT User Name */ + char *name; _NULLTERM /* NT Group Name */ char *description; _NULLTERM /* Descritpion (Gecos) */ uint32 count; /* number of sids */ -- cgit From 64e49aa3c5392fd0ba5fc33ea21eff87c548995e Mon Sep 17 00:00:00 2001 From: Simo Sorce <idra@samba.org> Date: Fri, 7 Mar 2003 23:47:59 +0000 Subject: initial work for the new idmpa interface (This used to be commit 8338e74ac4e5f31150c96f459a67e52090dc6013) --- source3/include/idmap.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 source3/include/idmap.h (limited to 'source3/include') diff --git a/source3/include/idmap.h b/source3/include/idmap.h new file mode 100644 index 0000000000..0d358d3fbe --- /dev/null +++ b/source3/include/idmap.h @@ -0,0 +1,49 @@ +/* + Unix SMB/CIFS implementation. + + Idmap headers + + Copyright (C) Anthony Liguori 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 Library General Public + License as published by the Free Software Foundation; either + version 2 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 Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#define ID_USERID 1 +#define ID_GROUPID 2 +#define ID_OTHER 3 + +typedef union id_t { + uid_t uid; + gid_t gid; +} id_t; + +/* Filled out by IDMAP backends */ +struct idmap_methods { + + /* Called when backend is first loaded */ + NTSTATUS (*init)(void); + + NTSTATUS (*get_sid_from_id)(DOM_SID *sid, id_t id, int id_type); + NTSTATUS (*get_id_from_sid)(id_t *id, int *id_type, DOM_SID *sid); + + /* Called when backend is unloaded */ + NTSTATUS (*close)(void); + + /* Called to dump backend status */ + void (*status)(void); +}; + -- cgit From 4a1d2ddd48c1c06b1874ff473275d22a0038c2c8 Mon Sep 17 00:00:00 2001 From: Simo Sorce <idra@samba.org> Date: Sat, 8 Mar 2003 00:49:18 +0000 Subject: some more code (not tested yet) (This used to be commit 0d6cec90c13731827abcbc61974efc993e794003) --- source3/include/debug.h | 1 + source3/include/idmap.h | 1 + 2 files changed, 2 insertions(+) (limited to 'source3/include') diff --git a/source3/include/debug.h b/source3/include/debug.h index d4f45539f4..70f9f7706d 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -88,6 +88,7 @@ extern int DEBUGLEVEL; #define DBGC_AUTH 10 #define DBGC_WINBIND 11 #define DBGC_VFS 12 +#define DBGC_IDMAP 13 /* So you can define DBGC_CLASS before including debug.h */ #ifndef DBGC_CLASS diff --git a/source3/include/idmap.h b/source3/include/idmap.h index 0d358d3fbe..5a1f4fafc3 100644 --- a/source3/include/idmap.h +++ b/source3/include/idmap.h @@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */ +#define ID_EMPTY 0 #define ID_USERID 1 #define ID_GROUPID 2 #define ID_OTHER 3 -- cgit From bebdbcd248ccb3021d0b94f360fc3cf8ba9e90a6 Mon Sep 17 00:00:00 2001 From: Simo Sorce <idra@samba.org> Date: Sat, 8 Mar 2003 17:29:40 +0000 Subject: more on idmap two layers structure with - local tdb cache - remote idmap repository compiles (This used to be commit 8fb4e210bc7564ed491d121c20d598ba0bfbddff) --- source3/include/idmap.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'source3/include') diff --git a/source3/include/idmap.h b/source3/include/idmap.h index 5a1f4fafc3..fd7646a324 100644 --- a/source3/include/idmap.h +++ b/source3/include/idmap.h @@ -22,24 +22,30 @@ Boston, MA 02111-1307, USA. */ -#define ID_EMPTY 0 -#define ID_USERID 1 -#define ID_GROUPID 2 -#define ID_OTHER 3 +#define ID_EMPTY 0x00 +#define ID_USERID 0x01 +#define ID_GROUPID 0x02 +#define ID_OTHER 0x04 -typedef union id_t { +#define ID_TYPEMASK 0x0f + +#define ID_NOMAP 0x10 +#define ID_CACHE 0x20 + +typedef union unid_t { uid_t uid; gid_t gid; -} id_t; +} unid_t; /* Filled out by IDMAP backends */ struct idmap_methods { /* Called when backend is first loaded */ - NTSTATUS (*init)(void); + NTSTATUS (*init)(const char *init_str); - NTSTATUS (*get_sid_from_id)(DOM_SID *sid, id_t id, int id_type); - NTSTATUS (*get_id_from_sid)(id_t *id, int *id_type, DOM_SID *sid); + NTSTATUS (*get_sid_from_id)(DOM_SID *sid, unid_t id, int id_type); + NTSTATUS (*get_id_from_sid)(unid_t *id, int *id_type, DOM_SID *sid); + NTSTATUS (*set_mapping)(DOM_SID *sid, unid_t id, int id_type); /* Called when backend is unloaded */ NTSTATUS (*close)(void); -- cgit From 2ed7730f2d498a446dc7281e652d02a9dd2d94cf Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sun, 9 Mar 2003 09:23:09 +0000 Subject: Change the way we sign SMB packets, to a function pointer interface. The intention is to allow for NTLMSSP and kerberos signing of packets, but for now it's just what I call 'simple' signing. (aka SMB signing per the SNIA spec) Andrew Bartlett (This used to be commit b9cf95c3dc04a45de71fb16e85c1bfbae50e6d8f) --- source3/include/client.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source3/include') diff --git a/source3/include/client.h b/source3/include/client.h index 73e29a1fff..2e6b9337e4 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -58,14 +58,15 @@ struct print_job_info }; typedef struct smb_sign_info { - BOOL use_smb_signing; + void (*sign_outgoing_message)(struct cli_state *cli); + BOOL (*check_incoming_message)(struct cli_state *cli); + void (*free_signing_context)(struct cli_state *cli); + void *signing_context; + BOOL negotiated_smb_signing; - BOOL temp_smb_signing; - size_t mac_key_len; - uint8 mac_key[64]; - uint32 send_seq_num; - uint32 reply_seq_num; BOOL allow_smb_signing; + BOOL doing_signing; + BOOL mandetory_signing; } smb_sign_info; struct cli_state { -- cgit From becf7a099710ba50f4611d0e16151337236b8a93 Mon Sep 17 00:00:00 2001 From: Martin Pool <mbp@samba.org> Date: Mon, 10 Mar 2003 00:45:28 +0000 Subject: Include valgrind.h if present on the system. (This used to be commit 65ba78c6bd4c5ab7ec9bf4d15e4410482e82588d) --- source3/include/includes.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index b9ba4b84d5..297f38ae97 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -433,6 +433,11 @@ #include <com_err.h> #endif +#if HAVE_VALGRIND_H +/* Special macros that are no-ops except when run under Valgrind on x86. */ +#include <valgrind.h> +#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 -- cgit From e9a94cd2c9cab4518603620259dae44b40d9049e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Mon, 10 Mar 2003 02:14:35 +0000 Subject: Further work on NTLMSSP-based SMB signing. Current status is that I cannnot get Win2k to send a valid signiture in it's session setup reply - which it will give to win2k clients. So, I need to look at becoming 'more like MS', but for now I'll get this code into the tree. It's actually based on the TNG cli_pipe_ntlmssp.c, as it was slightly easier to understand than our own (but only the utility functions remain in any way intact...). This includes the mysical 'NTLM2' code - I have no idea if it actually works. (I couldn't get TNG to use it for its pipes either). Andrew Bartlett (This used to be commit a034a5e381ba5612be21e2ba640d11f82cd945da) --- source3/include/ntlmssp.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source3/include') diff --git a/source3/include/ntlmssp.h b/source3/include/ntlmssp.h index 4fa4259a6a..f0278ffece 100644 --- a/source3/include/ntlmssp.h +++ b/source3/include/ntlmssp.h @@ -92,6 +92,8 @@ typedef struct ntlmssp_state typedef struct ntlmssp_client_state { TALLOC_CTX *mem_ctx; + unsigned int ref_count; + BOOL unicode; BOOL use_ntlmv2; char *user; @@ -102,9 +104,30 @@ typedef struct ntlmssp_client_state const char *(*get_global_myname)(void); const char *(*get_domain)(void); + DATA_BLOB chal; + DATA_BLOB lm_resp; + DATA_BLOB nt_resp; DATA_BLOB session_key; uint32 neg_flags; + + /* SMB Signing */ + + uint32 ntlmssp_seq_num; + + /* ntlmv2 */ + char cli_sign_const[16]; + char cli_seal_const[16]; + char srv_sign_const[16]; + char srv_seal_const[16]; + + unsigned char cli_sign_hash[258]; + unsigned char cli_seal_hash[258]; + unsigned char srv_sign_hash[258]; + unsigned char srv_seal_hash[258]; + + /* ntlmv1 */ + unsigned char ntlmssp_hash[258]; } NTLMSSP_CLIENT_STATE; -- cgit From cca61adcd242b96a1cf3c3b6528fd23a4998c2c3 Mon Sep 17 00:00:00 2001 From: Martin Pool <mbp@samba.org> Date: Tue, 11 Mar 2003 05:57:53 +0000 Subject: If using --enable-developer and valgrind.h is present, define VALGRIND. (This used to be commit 71c8e90117f00f168416f2f35a1c25755e2d0ed4) --- source3/include/includes.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index 297f38ae97..7e5ad0e3cd 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -438,6 +438,14 @@ #include <valgrind.h> #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) && HAVE_VALGRIND_H +#define VALGRIND +#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 -- cgit From 2e01ef5957bcdecb057d94122529b7cbd7f40ec2 Mon Sep 17 00:00:00 2001 From: Martin Pool <mbp@samba.org> Date: Tue, 11 Mar 2003 07:25:48 +0000 Subject: Remove valgrind_strlen function, hopefully no longer needed with recent Valgrind relases and clashing with -DVALGRIND. (This used to be commit 98479f1315cf8968152e1566966ac57e171008c3) --- source3/include/includes.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index 7e5ad0e3cd..b6abdd99ce 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1220,10 +1220,6 @@ int smb_xvasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE( time_t timegm(struct tm *tm); #endif -#if defined(VALGRIND) -#define strlen(x) valgrind_strlen(x) -#endif - /* * Veritas File System. Often in addition to native. * Quotas different. -- cgit From c992f66d733d230bc71f61ab4d13c08354ec0685 Mon Sep 17 00:00:00 2001 From: Gerald Carter <jerry@samba.org> Date: Wed, 12 Mar 2003 15:40:43 +0000 Subject: adding some initiaial code to sert %a to Win2K3 (using Native LanMan string from .NET RC2) (This used to be commit 4c823e61d14a33344deb887043b60b2e3c83416f) --- source3/include/smb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/smb.h b/source3/include/smb.h index bd4f113039..bf2d5631a7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -1408,7 +1408,7 @@ enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS}; 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_SAMBA}; +enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_WIN2K3, RA_SAMBA}; /* case handling */ enum case_handling {CASE_LOWER,CASE_UPPER}; -- cgit From ddfed383a0791986c6d08fde67840e99424ebb1a Mon Sep 17 00:00:00 2001 From: Jeremy Allison <jra@samba.org> Date: Wed, 12 Mar 2003 22:24:12 +0000 Subject: Change size parameters from signed to unsigned to fix up warnings. Jeremy. (This used to be commit 2e9880ef7c259b67eb75edc8098b734c3b7b22c1) --- source3/include/client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/client.h b/source3/include/client.h index 2e6b9337e4..a3efda4918 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -114,7 +114,7 @@ struct cli_state { int max_mux; char *outbuf; char *inbuf; - int bufsize; + unsigned int bufsize; int initialised; int win95; uint32 capabilities; -- cgit From 197f98aededbb456951be2d0d7f8ac587006a60d Mon Sep 17 00:00:00 2001 From: Martin Pool <mbp@samba.org> Date: Thu, 13 Mar 2003 06:18:18 +0000 Subject: In Valgrind 1.9.4, the headers have moved to <valgrind/valgrind.h>, etc. So check for that as well as the old names when including macros and conditionally defining -DVALGRIND. (This used to be commit c9151c7b1113e2f01bd33d4dd301a2e7e2040b35) --- source3/include/includes.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index b6abdd99ce..25245e9c0c 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -433,15 +433,19 @@ #include <com_err.h> #endif -#if HAVE_VALGRIND_H -/* Special macros that are no-ops except when run under Valgrind on x86. */ +/* 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 /* 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) && HAVE_VALGRIND_H +#if defined(DEVELOPER) && (HAVE_VALGRIND_H || HAVE_VALGRIND_VALGRIND_H) #define VALGRIND #endif -- cgit From e583dd6278fedf9ad45b551dccf94fbe6c785119 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak <mimir@samba.org> Date: Fri, 14 Mar 2003 17:12:40 +0000 Subject: Fresh meat in trusted domains code: - packing/unpacking utility functions for trusted domain password struct; can be used to prepare buffer to store in secrets.tdb or (soon) passdb backend - similiar functions for DOM_SID - respectively modified secrets_(fetch|store) routines - new auth mapping code utilising introduced is_trusted_domain function - added tdb (un)packing of single bytes Rafal (This used to be commit 5281ee7e84421b9be746aed2f1718ceaf2a2fe3d) --- source3/include/secrets.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include') diff --git a/source3/include/secrets.h b/source3/include/secrets.h index 183b29d7a8..07faf28d43 100644 --- a/source3/include/secrets.h +++ b/source3/include/secrets.h @@ -57,14 +57,14 @@ struct machine_acct_pass { /* * storage structure for trusted domain */ -struct trusted_dom_pass { +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 -- cgit From 3b5bc93e9db4df6ded2eef7b32bda74328b04811 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sat, 15 Mar 2003 07:14:55 +0000 Subject: String handling parinoia fixes. This patch enables the compile-time checking of strings assable by means of sizeof(). (Original code had the configure check reversed). This is extended to all safe_strcpy() users, push_string and pull_string, as well as the cli and srv derivitives. There is an attempt to cap strings at the end of the cli buffer, and clobber_region() of the speified length (when not -1 :-). Becouse of the way they are declared, the 'overmalloc a string' users of safe_strcpy() have been changed to use overmalloc_safe_strcpy() (which skips some of the checks). This whole ball of mud worked fine, until I pulled out my 'fix' for our statcache. When jeremy fixes that, we should be able to get back to testing this stuff. This patch also includes a 'marker' of the last caller to clobber_region (ie, the function that called pstrcpy() that called clobber_region) to assist in debugging problems that may have smashed the stack. This is printed at smb_panic() time. (Original idea and patch by metze). It also removes some unsused functions, and #if 0's some others that are unused but probably should be used in the near future. For now, this patch gives us some confidence on one class of trivial parsing error in our code. Andrew Bartlett (This used to be commit 31f4827acc2a2f00399a5528fc83a0dae5cebaf4) --- source3/include/includes.h | 1 + source3/include/safe_string.h | 161 +++++++++++++++++++++++++++++++++++------- source3/include/srvstr.h | 36 ++++++++++ 3 files changed, 174 insertions(+), 24 deletions(-) create mode 100644 source3/include/srvstr.h (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index 25245e9c0c..2bba9d5084 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -855,6 +855,7 @@ struct printjob; /* String routines */ +#include "srvstr.h" #include "safe_string.h" #ifdef __COMPAR_FN_T diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 6c2bd82bb9..c7386d3ac4 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -48,29 +48,45 @@ #endif /* !_SPLINT_ */ + char * __unsafe_string_function_usage_here__(void); -#ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS +size_t __unsafe_string_function_usage_here2__(void); -#define pstrcpy(d,s) ((sizeof(d) != sizeof(pstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcpy((d), (s),sizeof(pstring)-1)) -#define pstrcat(d,s) ((sizeof(d) != sizeof(pstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcat((d), (s),sizeof(pstring)-1)) -#define fstrcpy(d,s) ((sizeof(d) != sizeof(fstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcpy((d),(s),sizeof(fstring)-1)) -#define fstrcat(d,s) ((sizeof(d) != sizeof(fstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : safe_strcat((d),(s),sizeof(fstring)-1)) +#ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS -#define fstrterminate(d) ((sizeof(d) != sizeof(fstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : (((d)[sizeof(fstring)-1]) = '\0')) -#define pstrterminate(d) ((sizeof(d) != sizeof(pstring) && sizeof(d) != sizeof(char *)) ? __unsafe_string_function_usage_here__() : (((d)[sizeof(pstring)-1]) = '\0')) +/* 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 *)) + +#define fstrterminate(d) (CHECK_STRING_SIZE(d, sizeof(fstring)) \ + ? __unsafe_string_function_usage_here__() \ + : (((d)[sizeof(fstring)-1]) = '\0')) +#define pstrterminate(d) (CHECK_STRING_SIZE(d, sizeof(pstring)) \ + ? __unsafe_string_function_usage_here__() \ + : (((d)[sizeof(pstring)-1]) = '\0')) + +#define wpstrcpy(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ + ? __unsafe_string_function_usage_here__() \ + : safe_strcpy_w((d),(s),sizeof(wpstring))) +#define wpstrcat(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ + ? __unsafe_string_function_usage_here__() \ + : safe_strcat_w((d),(s),sizeof(wpstring))) +#define wfstrcpy(d,s) ((sizeof(d) != sizeof(wfstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ + ? __unsafe_string_function_usage_here__() \ + : safe_strcpy_w((d),(s),sizeof(wfstring))) +#define wfstrcat(d,s) ((sizeof(d) != sizeof(wfstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ + ? __unsafe_string_function_usage_here__() \ + : safe_strcat_w((d),(s),sizeof(wfstring))) -#define wpstrcpy(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) ? __unsafe_string_function_usage_here__() : safe_strcpy_w((d),(s),sizeof(wpstring))) -#define wpstrcat(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) ? __unsafe_string_function_usage_here__() : safe_strcat_w((d),(s),sizeof(wpstring))) -#define wfstrcpy(d,s) ((sizeof(d) != sizeof(wfstring) && sizeof(d) != sizeof(smb_ucs2_t *)) ? __unsafe_string_function_usage_here__() : safe_strcpy_w((d),(s),sizeof(wfstring))) -#define wfstrcat(d,s) ((sizeof(d) != sizeof(wfstring) && sizeof(d) != sizeof(smb_ucs2_t *)) ? __unsafe_string_function_usage_here__() : safe_strcat_w((d),(s),sizeof(wfstring))) +#define push_pstring_base(dest, src, pstring_base) \ + (CHECK_STRING_SIZE(pstring_base, sizeof(pstring)) \ + ? __unsafe_string_function_usage_here2__() \ + : push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE)) -#else - -#define pstrcpy(d,s) safe_strcpy((d), (s),sizeof(pstring)-1) -#define pstrcat(d,s) safe_strcat((d), (s),sizeof(pstring)-1) -#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1) -#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1) +#else /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */ #define fstrterminate(d) (((d)[sizeof(fstring)-1]) = '\0') #define pstrterminate(d) (((d)[sizeof(pstring)-1]) = '\0') @@ -80,12 +96,10 @@ char * __unsafe_string_function_usage_here__(void); #define wfstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wfstring)) #define wfstrcat(d,s) safe_strcat_w((d),(s),sizeof(wfstring)) -#endif +#define push_pstring_base(dest, src, pstring_base) \ + push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE) -/* replace some string functions with multi-byte - versions */ -#define strlower(s) strlower_m(s) -#define strupper(s) strupper_m(s) +#endif /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */ /* 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 @@ -93,7 +107,106 @@ char * __unsafe_string_function_usage_here__(void); #define pstrcpy_base(dest, src, pstring_base) \ safe_strcpy(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1) -#define push_pstring_base(dest, src, pstring_base) \ - push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE) + +/* 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 pstrcpy(d,s) safe_strcpy((d), (s),sizeof(pstring)-1) +#define pstrcat(d,s) safe_strcat((d), (s),sizeof(pstring)-1) +#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1) +#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-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 */ +#define pstrcpy_base(dest, src, pstring_base) \ + safe_strcpy(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1) + + +/* inside the _fn varients of these is a call to 'clobber_region' - which might + destory the stack on a buggy function. Help the debugging process by putting + the function and line it was last called from into a static buffer + + But only for developers */ + +#ifdef DEVELOPER +#define overmalloc_safe_strcpy(dest,src,maxlength) safe_strcpy_fn(__FUNCTION__,__LINE__,dest,src,maxlength) +#define safe_strcpy(dest,src,maxlength) safe_strcpy_fn2(__FUNCTION__,__LINE__,dest,src,maxlength) +#define safe_strcat(dest,src,maxlength) safe_strcat_fn2(__FUNCTION__,__LINE__,dest,src,maxlength) +#define push_string(base_ptr, dest, src, dest_len, flags) push_string_fn2(__FUNCTION__, __LINE__, base_ptr, dest, src, dest_len, flags) +#define pull_string(base_ptr, dest, src, dest_len, src_len, flags) pull_string_fn2(__FUNCTION__, __LINE__, base_ptr, dest, src, dest_len, src_len, flags) +#define clistr_push(cli, dest, src, dest_len, flags) clistr_push_fn2(__FUNCTION__, __LINE__, cli, dest, src, dest_len, flags) +#define clistr_pull(cli, dest, src, dest_len, src_len, flags) clistr_pull_fn2(__FUNCTION__, __LINE__, cli, dest, src, dest_len, src_len, flags) + +#define alpha_strcpy(dest,src,other_safe_chars,maxlength) alpha_strcpy_fn(__FUNCTION__,__LINE__,dest,src,other_safe_chars,maxlength) +#define StrnCpy(dest,src,n) StrnCpy_fn(__FUNCTION__,__LINE__,dest,src,n) + +#else + +#define overmalloc_safe_strcpy(dest,src,maxlength) safe_strcpy_fn(NULL,0,dest,src,maxlength) +#define safe_strcpy(dest,src,maxlength) safe_strcpy_fn2(NULL,0,dest,src,maxlength) +#define safe_strcat(dest,src,maxlength) safe_strcat_fn2(NULL,0,dest,src,maxlength) +#define push_string(base_ptr, dest, src, dest_len, flags) push_string_fn2(NULL, 0, base_ptr, dest, src, dest_len, flags) +#define pull_string(base_ptr, dest, src, dest_len, src_len, flags) pull_string_fn2(NULL, 0, base_ptr, dest, src, dest_len, src_len, flags) +#define clistr_push(cli, dest, src, dest_len, flags) clistr_push_fn2(NULL, 0, cli, dest, src, dest_len, flags) +#define clistr_pull(cli, dest, src, dest_len, src_len, flags) clistr_push_fn2(NULL, 0, cli, dest, src, dest_len, src_len, flags) + +#define alpha_strcpy(dest,src,other_safe_chars,maxlength) alpha_strcpy_fn(NULL,0,dest,src,other_safe_chars,maxlength) +#define StrnCpy(dest,src,n) StrnCpy_fn(NULL,0,dest,src,n) +#endif /* DEVELOPER */ + + +#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, dest, src, dest_len, flags) \ + (CHECK_STRING_SIZE(dest, dest_len) \ + ? __unsafe_string_function_usage_here2__() \ + : push_string_fn(fn_name, fn_line, base_ptr, dest, src, dest_len, flags)) + +#define pull_string_fn2(fn_name, fn_line, base_ptr, dest, src, dest_len, src_len, flags) \ + (CHECK_STRING_SIZE(dest, dest_len) \ + ? __unsafe_string_function_usage_here2__() \ + : pull_string_fn(fn_name, fn_line, base_ptr, dest, src, dest_len, 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_here2__() \ + : 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_here2__() \ + : clistr_pull_fn(fn_name, fn_line, cli, dest, src, dest_len, srclen, 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 clistr_push_fn2 clistr_push_fn2 +#define clistr_pull_fn2 clistr_pull_fn2 + +#endif + +/* replace some string functions with multi-byte + versions */ +#define strlower(s) strlower_m(s) +#define strupper(s) strupper_m(s) #endif diff --git a/source3/include/srvstr.h b/source3/include/srvstr.h new file mode 100644 index 0000000000..a433e0e3f9 --- /dev/null +++ b/source3/include/srvstr.h @@ -0,0 +1,36 @@ +/* + 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 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. +*/ + +#include "includes.h" + +#define srvstr_push(base_ptr, dest, src, dest_len, flags) \ + push_string(base_ptr, dest, src, dest_len, flags) + +#define srvstr_pull(base_ptr, dest, src, dest_len, src_len, flags) \ + pull_string(base_ptr, dest, src, dest_len, 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, dest, src, dest_len, flags) \ + pull_string(inbuf, dest, src, dest_len, smb_bufrem(inbuf, src), flags) + -- cgit From d8549b0360b86f151a8cd221838d005e083bfba8 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sat, 15 Mar 2003 07:16:32 +0000 Subject: signed/unsigned fix (This used to be commit f6bcfa59447700e0ccfc069d0228019a9bdca9d2) --- source3/include/client.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include') diff --git a/source3/include/client.h b/source3/include/client.h index a3efda4918..0ea793de68 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -110,8 +110,8 @@ struct cli_state { int readbraw_supported; int writebraw_supported; int timeout; /* in milliseconds. */ - int max_xmit; - int max_mux; + size_t max_xmit; + size_t max_mux; char *outbuf; char *inbuf; unsigned int bufsize; -- cgit From 02704f973347f05af5ebcb0d4a494a6102199536 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sat, 15 Mar 2003 08:18:29 +0000 Subject: Minor fixes. - signed/unsigned - quieten warning about assignment as truth value - whitespace Andrew Bartlett (This used to be commit a13ce0df4b4a776fa635a1fb804dd00d195f58d0) --- source3/include/rpc_lsa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index c091e73321..8e1368810f 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -237,7 +237,7 @@ typedef struct r_lsa_query_sec_obj_info typedef struct lsa_query_info { POLICY_HND pol; /* policy handle */ - uint16 info_class; /* info class */ + uint16 info_class; /* info class */ } LSA_Q_QUERY_INFO; -- cgit From 662b5498183a7ed981bc0fa9d29acb634f326d7c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sat, 15 Mar 2003 10:59:14 +0000 Subject: Fix the non-DEVELOPER case of my macro madness... Andrew Bartlett (This used to be commit 618bda3a28f65417e3c31a70229f6da70cf223fc) --- source3/include/safe_string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index c7386d3ac4..8b3665d97b 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -150,7 +150,7 @@ size_t __unsafe_string_function_usage_here2__(void); #define push_string(base_ptr, dest, src, dest_len, flags) push_string_fn2(NULL, 0, base_ptr, dest, src, dest_len, flags) #define pull_string(base_ptr, dest, src, dest_len, src_len, flags) pull_string_fn2(NULL, 0, base_ptr, dest, src, dest_len, src_len, flags) #define clistr_push(cli, dest, src, dest_len, flags) clistr_push_fn2(NULL, 0, cli, dest, src, dest_len, flags) -#define clistr_pull(cli, dest, src, dest_len, src_len, flags) clistr_push_fn2(NULL, 0, cli, dest, src, dest_len, src_len, flags) +#define clistr_pull(cli, dest, src, dest_len, src_len, flags) clistr_pull_fn2(NULL, 0, cli, dest, src, dest_len, src_len, flags) #define alpha_strcpy(dest,src,other_safe_chars,maxlength) alpha_strcpy_fn(NULL,0,dest,src,other_safe_chars,maxlength) #define StrnCpy(dest,src,n) StrnCpy_fn(NULL,0,dest,src,n) -- cgit From a4261c229571bea5ce3fc00f024133b3b50cd4bf Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sat, 15 Mar 2003 11:28:45 +0000 Subject: Fix the 'non-optomizing compiler' case... Andrew Bartlett (This used to be commit 94424c5d72246b2e58f3a21aa0de6949d7eb2da1) --- source3/include/safe_string.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 8b3665d97b..3e19659961 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -199,8 +199,8 @@ size_t __unsafe_string_function_usage_here2__(void); #define safe_strcat_fn2 safe_strcat_fn #define push_string_fn2 push_string_fn #define pull_string_fn2 pull_string_fn -#define clistr_push_fn2 clistr_push_fn2 -#define clistr_pull_fn2 clistr_pull_fn2 +#define clistr_push_fn2 clistr_push_fn +#define clistr_pull_fn2 clistr_pull_fn #endif -- cgit From 0dca6fab27039a8874c4b3ab0da5401975344fa9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sat, 15 Mar 2003 23:16:40 +0000 Subject: A hack to get us building on a slightly older heimdal kerberos. It appears that we don't need this flag - heimdal's internal password change routines don't set it. Andrew Bartlett (This used to be commit 069825bd78f2bf125e8a4e72933da924d393f5a5) --- source3/include/ads.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source3/include') diff --git a/source3/include/ads.h b/source3/include/ads.h index f90983e405..07bf6e4b3b 100644 --- a/source3/include/ads.h +++ b/source3/include/ads.h @@ -213,3 +213,10 @@ typedef void **ADS_MODLIST; #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 AP_OPTS_USE_SUBKEY +#define AP_OPTS_USE_SUBKEY 0 +#endif -- cgit From 3a9bdacca98560706eeb4e625ef1ce7c92d4dfab Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sun, 16 Mar 2003 00:39:40 +0000 Subject: More work on my macro mess - we need function prototypes of different types, and we were missing the 'char' type. Andrew Bartlett (This used to be commit 193e80fafbda9e3af58fec1e629ec607f29b4099) --- source3/include/safe_string.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 3e19659961..3bd38ea74e 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -48,10 +48,13 @@ #endif /* !_SPLINT_ */ - +/* 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_here2__(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 @@ -62,10 +65,10 @@ size_t __unsafe_string_function_usage_here2__(void); #define CHECK_STRING_SIZE(d, len) (sizeof(d) != (len) && sizeof(d) != sizeof(char *)) #define fstrterminate(d) (CHECK_STRING_SIZE(d, sizeof(fstring)) \ - ? __unsafe_string_function_usage_here__() \ + ? __unsafe_string_function_usage_here_char__() \ : (((d)[sizeof(fstring)-1]) = '\0')) #define pstrterminate(d) (CHECK_STRING_SIZE(d, sizeof(pstring)) \ - ? __unsafe_string_function_usage_here__() \ + ? __unsafe_string_function_usage_here_char__() \ : (((d)[sizeof(pstring)-1]) = '\0')) #define wpstrcpy(d,s) ((sizeof(d) != sizeof(wpstring) && sizeof(d) != sizeof(smb_ucs2_t *)) \ @@ -83,7 +86,7 @@ size_t __unsafe_string_function_usage_here2__(void); #define push_pstring_base(dest, src, pstring_base) \ (CHECK_STRING_SIZE(pstring_base, sizeof(pstring)) \ - ? __unsafe_string_function_usage_here2__() \ + ? __unsafe_string_function_usage_here_size_t__() \ : push_ascii(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1, STR_TERMINATE)) #else /* HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS */ @@ -175,22 +178,22 @@ size_t __unsafe_string_function_usage_here2__(void); #define push_string_fn2(fn_name, fn_line, base_ptr, dest, src, dest_len, flags) \ (CHECK_STRING_SIZE(dest, dest_len) \ - ? __unsafe_string_function_usage_here2__() \ + ? __unsafe_string_function_usage_here_size_t__() \ : push_string_fn(fn_name, fn_line, base_ptr, dest, src, dest_len, flags)) #define pull_string_fn2(fn_name, fn_line, base_ptr, dest, src, dest_len, src_len, flags) \ (CHECK_STRING_SIZE(dest, dest_len) \ - ? __unsafe_string_function_usage_here2__() \ + ? __unsafe_string_function_usage_here_size_t__() \ : pull_string_fn(fn_name, fn_line, base_ptr, dest, src, dest_len, 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_here2__() \ + ? __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_here2__() \ + ? __unsafe_string_function_usage_here_size_t__() \ : clistr_pull_fn(fn_name, fn_line, cli, dest, src, dest_len, srclen, flags)) #else -- cgit From 7cf0003dd23114947eec5fb6956f65f85efac7c1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett <abartlet@samba.org> Date: Sun, 16 Mar 2003 03:21:58 +0000 Subject: Fix nmbd under -DDEVELOPER (pstrcpy on not-pstring). Make a new macro to help in this situation, and add memcpy() parinoia Andrew Bartlett (This used to be commit 4d00626b6e003952df6715fa80615ec028facdf4) --- source3/include/safe_string.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 3bd38ea74e..65ec05a5c6 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -110,6 +110,8 @@ size_t __unsafe_string_function_usage_here_char__(void); #define pstrcpy_base(dest, src, pstring_base) \ safe_strcpy(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1) +#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 -- cgit From b9a8ad5f3bcf8f0d75c39b8f993010f3d1fded7e Mon Sep 17 00:00:00 2001 From: Martin Pool <mbp@samba.org> Date: Tue, 18 Mar 2003 05:04:44 +0000 Subject: Speling fixes and a little extra documentation. (This used to be commit 8da383bb3e63d25ceb0204c775580f2f1b3336ec) --- source3/include/safe_string.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 65ec05a5c6..d01a6c6321 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -129,12 +129,12 @@ size_t __unsafe_string_function_usage_here_char__(void); safe_strcpy(dest, src, sizeof(pstring)-PTR_DIFF(dest,pstring_base)-1) -/* inside the _fn varients of these is a call to 'clobber_region' - which might - destory the stack on a buggy function. Help the debugging process by putting - the function and line it was last called from into a static buffer - - But only for developers */ - +/* 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. */ #ifdef DEVELOPER #define overmalloc_safe_strcpy(dest,src,maxlength) safe_strcpy_fn(__FUNCTION__,__LINE__,dest,src,maxlength) #define safe_strcpy(dest,src,maxlength) safe_strcpy_fn2(__FUNCTION__,__LINE__,dest,src,maxlength) -- cgit From c52a31b21a656928caedc48211905b713779801a Mon Sep 17 00:00:00 2001 From: Martin Pool <mbp@samba.org> Date: Tue, 18 Mar 2003 05:42:53 +0000 Subject: Comment about deprecated macro overmalloc_safe_strcpy(). (This used to be commit 5ac062580690eee9b4bd423dbb82631c0cdb8b30) --- source3/include/safe_string.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source3/include') diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index d01a6c6321..61ef4bdf96 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -135,6 +135,12 @@ size_t __unsafe_string_function_usage_here_char__(void); * 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! */ + #ifdef DEVELOPER #define overmalloc_safe_strcpy(dest,src,maxlength) safe_strcpy_fn(__FUNCTION__,__LINE__,dest,src,maxlength) #define safe_strcpy(dest,src,maxlength) safe_strcpy_fn2(__FUNCTION__,__LINE__,dest,src,maxlength) -- cgit