From 475c958450c863a8fc530ccf5bb712bd7a6e8aa4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2004 05:46:52 +0000 Subject: r3425: got rid of a bunch of cruft from rewrite.h (This used to be commit 3f902f8d851d32fa81d89ed61bfda6edaea00984) --- source4/include/rewrite.h | 112 ------------------------------- source4/include/smb.h | 13 ++++ source4/lib/interface.c | 8 +++ source4/libads/ads_ldap.c | 4 +- source4/libcli/namequery.c | 8 +++ source4/param/loadparm.c | 124 ++++++++++++++--------------------- source4/rpc_server/samr/samr_utils.c | 2 +- source4/smb_server/smb_server.h | 1 - source4/smb_server/trans2.c | 2 +- 9 files changed, 83 insertions(+), 191 deletions(-) (limited to 'source4') diff --git a/source4/include/rewrite.h b/source4/include/rewrite.h index 599503be12..584cc215f9 100644 --- a/source4/include/rewrite.h +++ b/source4/include/rewrite.h @@ -51,89 +51,9 @@ typedef int BOOL; #include "debug.h" #include "doserr.h" -/* for compatibility */ -#define SID_NAME_USE samr_SidType - -/* used to hold an arbitrary blob of data */ -typedef struct data_blob { - uint8_t *data; - size_t length; -} DATA_BLOB; - -/* Globally Unique ID */ -#define GUID_SIZE 16 - -/* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30 */ -typedef uint64_t NTTIME; - -/* 8 byte aligned 'hyper' type from MS IDL */ -typedef uint64_t HYPER_T; - - #include "enums.h" #include "events.h" -/* used for network interfaces */ -struct interface -{ - struct interface *next, *prev; - struct in_addr ip; - struct in_addr bcast; - struct in_addr nmask; -}; - -/* the following are used by loadparm for option lists */ -typedef enum -{ - P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST, - P_STRING,P_USTRING,P_ENUM,P_SEP -} parm_type; - -typedef enum -{ - P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE -} parm_class; - -struct enum_list { - int value; - const char *name; -}; - -struct parm_struct -{ - const char *label; - parm_type type; - parm_class class; - void *ptr; - BOOL (*special)(const char *, char **); - const struct enum_list *enum_list; - uint_t flags; - union { - BOOL bvalue; - int ivalue; - char *svalue; - char cvalue; - char **lvalue; - } def; -}; - -struct bitmap { - uint32_t *b; - uint_t n; -}; - -#define FLAG_BASIC 0x0001 /* fundamental options */ -#define FLAG_SHARE 0x0002 /* file sharing options */ -#define FLAG_PRINT 0x0004 /* printing options */ -#define FLAG_GLOBAL 0x0008 /* local options that should be globally settable in SWAT */ -#define FLAG_WIZARD 0x0010 /* Parameters that the wizard will operate on */ -#define FLAG_ADVANCED 0x0020 /* Parameters that the wizard will operate on */ -#define FLAG_DEVELOPER 0x0040 /* Parameters that the wizard will operate on */ -#define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */ -#define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */ -#define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */ -#define FLAG_CMDLINE 0x8000 /* this option was set from the command line */ - #ifndef LOCKING_VERSION #define LOCKING_VERSION 4 #endif /* LOCKING_VERSION */ @@ -196,42 +116,10 @@ struct nmb_name { }; -/* A netbios node status array element. */ -struct node_status { - char name[16]; - uint8_t type; - uint8_t flags; -}; - #include "rpc_secdes.h" #include "client.h" -/* - Do you want session setups at user level security with a invalid - password to be rejected or allowed in as guest? WinNT rejects them - but it can be a pain as it means "net view" needs to use a password - - You have 3 choices in the setting of map_to_guest: - - "NEVER_MAP_TO_GUEST" means session setups with an invalid password - are rejected. This is the default. - - "MAP_TO_GUEST_ON_BAD_USER" means session setups with an invalid password - are rejected, unless the username does not exist, in which case it - is treated as a guest login - - "MAP_TO_GUEST_ON_BAD_PASSWORD" means session setups with an invalid password - are treated as a guest login - - Note that map_to_guest only has an effect in user or server - level security. -*/ - -#define NEVER_MAP_TO_GUEST 0 -#define MAP_TO_GUEST_ON_BAD_USER 1 -#define MAP_TO_GUEST_ON_BAD_PASSWORD 2 - #define SAFE_NETBIOS_CHARS ". -_" /* generic iconv conversion structure */ diff --git a/source4/include/smb.h b/source4/include/smb.h index 623316087c..bc9eb2acb8 100644 --- a/source4/include/smb.h +++ b/source4/include/smb.h @@ -200,6 +200,19 @@ typedef struct nt_user_token { struct dom_sid **user_sids; } NT_USER_TOKEN; +/* used to hold an arbitrary blob of data */ +typedef struct data_blob { + uint8_t *data; + size_t length; +} DATA_BLOB; + +/* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30 */ +typedef uint64_t NTTIME; + +/* 8 byte aligned 'hyper' type from MS IDL */ +typedef uint64_t HYPER_T; + + /* the basic packet size, assuming no words or bytes. Does not include the NBT header */ #define MIN_SMB_SIZE 35 diff --git a/source4/lib/interface.c b/source4/lib/interface.c index b842fbb292..72568912af 100644 --- a/source4/lib/interface.c +++ b/source4/lib/interface.c @@ -26,6 +26,14 @@ static int total_probed; static struct in_addr allones_ip; struct in_addr loopback_ip; +/* used for network interfaces */ +struct interface { + struct interface *next, *prev; + struct in_addr ip; + struct in_addr bcast; + struct in_addr nmask; +}; + static struct interface *local_interfaces; #define ALLONES ((uint32_t)0xFFFFFFFF) diff --git a/source4/libads/ads_ldap.c b/source4/libads/ads_ldap.c index b9e07e4c33..1b1613e90c 100644 --- a/source4/libads/ads_ldap.c +++ b/source4/libads/ads_ldap.c @@ -28,7 +28,7 @@ NTSTATUS ads_name_to_sid(ADS_STRUCT *ads, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type) + enum samr_SidType *type) { const char *attrs[] = {"objectSid", "sAMAccountType", NULL}; int count; @@ -95,7 +95,7 @@ NTSTATUS ads_sid_to_name(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const DOM_SID *sid, char **name, - enum SID_NAME_USE *type) + enum samr_SidType *type) { const char *attrs[] = {"userPrincipalName", "sAMAccountName", diff --git a/source4/libcli/namequery.c b/source4/libcli/namequery.c index 0f21e33b85..a9464718c5 100644 --- a/source4/libcli/namequery.c +++ b/source4/libcli/namequery.c @@ -21,6 +21,14 @@ #include "includes.h" +/* A netbios node status array element. */ +struct node_status { + char name[16]; + uint8_t type; + uint8_t flags; +}; + + /* nmbd.c sets this to True. */ BOOL global_in_nmbd = False; diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index cddb85f80e..e1f006d889 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -78,6 +78,56 @@ static BOOL do_parameter_var(const char *pszParmName, const char *fmt, ...); static BOOL defaults_saved = False; + +#define FLAG_BASIC 0x0001 /* fundamental options */ +#define FLAG_SHARE 0x0002 /* file sharing options */ +#define FLAG_PRINT 0x0004 /* printing options */ +#define FLAG_GLOBAL 0x0008 /* local options that should be globally settable in SWAT */ +#define FLAG_WIZARD 0x0010 /* Parameters that the wizard will operate on */ +#define FLAG_ADVANCED 0x0020 /* Parameters that the wizard will operate on */ +#define FLAG_DEVELOPER 0x0040 /* Parameters that the wizard will operate on */ +#define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */ +#define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */ +#define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */ +#define FLAG_CMDLINE 0x8000 /* this option was set from the command line */ + + +/* the following are used by loadparm for option lists */ +typedef enum +{ + P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST, + P_STRING,P_USTRING,P_ENUM,P_SEP +} parm_type; + +typedef enum +{ + P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE +} parm_class; + +struct enum_list { + int value; + const char *name; +}; + +struct parm_struct +{ + const char *label; + parm_type type; + parm_class class; + void *ptr; + BOOL (*special)(const char *, char **); + const struct enum_list *enum_list; + uint_t flags; + union { + BOOL bvalue; + int ivalue; + char *svalue; + char cvalue; + char **lvalue; + } def; +}; + + struct param_opt { struct param_opt *prev, *next; char *key; @@ -465,33 +515,6 @@ static const struct enum_list enum_smb_signing_vals[] = { {-1, NULL} }; -/* - Do you want session setups at user level security with a invalid - password to be rejected or allowed in as guest? WinNT rejects them - but it can be a pain as it means "net view" needs to use a password - - You have 3 choices in the setting of map_to_guest: - - "Never" means session setups with an invalid password - are rejected. This is the default. - - "Bad User" means session setups with an invalid password - are rejected, unless the username does not exist, in which case it - is treated as a guest login - - "Bad Password" means session setups with an invalid password - are treated as a guest login - - Note that map_to_guest only has an effect in user or server - level security. -*/ - -static const struct enum_list enum_map_to_guest[] = { - {NEVER_MAP_TO_GUEST, "Never"}, - {MAP_TO_GUEST_ON_BAD_USER, "Bad User"}, - {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"}, - {-1, NULL} -}; /* Note: We do not initialise the defaults union - it is not allowed in ANSI C * @@ -1375,26 +1398,6 @@ static BOOL lp_bool(const char *s) return ret; } -/******************************************************************* -convenience routine to return enum parameters. -********************************************************************/ -static int lp_enum(const char *s,const struct enum_list *_enum) -{ - int i; - - if (!s || !_enum) { - DEBUG(0,("lp_enum(%s,enum): is called with NULL!\n",s)); - return False; - } - - for (i=0; _enum[i].name; i++) { - if (strcasecmp(_enum[i].name,s)==0) - return _enum[i].value; - } - - DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s)); - return (-1); -} /* Return parametric option from a given service. Type is a part of option before ':' */ /* Parametric option has following syntax: 'Type: option = value' */ @@ -1464,20 +1467,6 @@ BOOL lp_parm_bool(int lookup_service, const char *type, const char *option, BOOL return default_v; } -/* Return parametric option from a given service. Type is a part of option before ':' */ -/* Parametric option has following syntax: 'Type: option = value' */ - -int lp_parm_enum(int lookup_service, const char *type, const char *option, - const struct enum_list *_enum) -{ - const char *value = get_parametrics(lookup_service, type, option); - - if (value) - return lp_enum(value, _enum); - - return (-1); -} - /*************************************************************************** Initialise a service to the defaults. @@ -2717,19 +2706,6 @@ static void dump_globals(FILE *f) } -/*************************************************************************** - Return True if a local parameter is currently set to the global default. -***************************************************************************/ - -BOOL lp_is_default(int snum, struct parm_struct *parm) -{ - int pdiff = PTR_DIFF(parm->ptr, &sDefault); - - return equal_parameter(parm->type, - ((char *)ServicePtrs[snum]) + pdiff, - ((char *)&sDefault) + pdiff); -} - /*************************************************************************** Display the contents of a single services record. ***************************************************************************/ diff --git a/source4/rpc_server/samr/samr_utils.c b/source4/rpc_server/samr/samr_utils.c index 8297792cc2..f67f828b68 100644 --- a/source4/rpc_server/samr/samr_utils.c +++ b/source4/rpc_server/samr/samr_utils.c @@ -118,7 +118,7 @@ uint32_t samdb_gtype2atype(uint32_t gtype) } /* turn a sAMAccountType into a SID_NAME_USE */ -enum SID_NAME_USE samdb_atype_map(uint32_t atype) +enum samr_SidType samdb_atype_map(uint32_t atype) { switch (atype & 0xF0000000) { case ATYPE_GLOBAL_GROUP: diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h index 53ef5cd575..054fc7c35d 100644 --- a/source4/smb_server/smb_server.h +++ b/source4/smb_server/smb_server.h @@ -213,7 +213,6 @@ struct smbsrv_connection { /* the context associated with open files on an smb socket */ struct { struct files_struct *files; /* open files */ - struct bitmap *file_bmap; /* bitmap used to allocate file handles */ /* a fsp to use when chaining */ struct files_struct *chain_fsp; diff --git a/source4/smb_server/trans2.c b/source4/smb_server/trans2.c index c5c48d3f64..3c447c555e 100644 --- a/source4/smb_server/trans2.c +++ b/source4/smb_server/trans2.c @@ -390,7 +390,7 @@ static NTSTATUS trans2_qfsinfo(struct smbsrv_request *req, struct smb_trans2 *tr return status; } - memcpy(trans->out.data.data, guid_blob.data, GUID_SIZE); + memcpy(trans->out.data.data, guid_blob.data, guid_blob.length); for (i=0;i<6;i++) { SBVAL(trans->out.data.data, 16 + 8*i, fsinfo.objectid_information.out.unknown[i]); -- cgit