From 5eef37058bcbee1324ca45c6a0fbd2a57e236ff9 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sun, 19 Nov 2006 18:30:06 +0000 Subject: [PATCH] r19795: * bring the 'enum lsa_SidType', 'struct GUID', & 'struct policy_handle' over from SAMBA_3_0. --- source/auth/auth_util.c | 4 +- source/groupdb/mapping.c | 659 +---------------------------------- source/groupdb/mapping.h | 2 +- source/groupdb/mapping_ldb.c | 4 +- source/groupdb/mapping_tdb.c | 2 +- source/include/client.h | 2 +- source/include/idmap.h | 5 +- source/include/libmsrpc.h | 2 +- source/include/mapping.h | 2 +- source/include/nt_status.h | 34 +- source/include/passdb.h | 12 +- source/include/rpc_dce.h | 2 +- source/include/rpc_dfs.h | 2 +- source/include/rpc_ds.h | 6 +- source/include/rpc_lsa.h | 2 +- source/include/rpc_misc.h | 28 +- source/include/rpc_netlogon.h | 6 +- source/include/rpc_secdes.h | 4 +- source/include/smb.h | 23 +- source/lib/secace.c | 4 +- source/lib/util_sid.c | 4 +- source/lib/util_uuid.c | 16 +- source/libads/ads_utils.c | 2 +- source/libads/ldap.c | 2 +- source/libmsrpc/cac_lsarpc.c | 2 +- source/libsmb/cliconnect.c | 4 +- source/modules/nfs4_acls.c | 2 +- source/modules/vfs_afsacl.c | 6 +- source/nmbd/nmbd_processlogon.c | 2 +- source/nsswitch/wb_client.c | 14 +- source/nsswitch/wbinfo.c | 2 +- source/nsswitch/winbindd.h | 8 +- source/nsswitch/winbindd_async.c | 30 +- source/nsswitch/winbindd_cache.c | 28 +- source/nsswitch/winbindd_creds.c | 2 +- source/nsswitch/winbindd_group.c | 16 +- source/nsswitch/winbindd_pam.c | 2 +- source/nsswitch/winbindd_passdb.c | 8 +- source/nsswitch/winbindd_reconnect.c | 6 +- source/nsswitch/winbindd_rpc.c | 12 +- source/nsswitch/winbindd_sid.c | 20 +- source/nsswitch/winbindd_user.c | 4 +- source/nsswitch/winbindd_util.c | 4 +- source/passdb/lookup_sid.c | 28 +- source/passdb/passdb.c | 2 +- source/passdb/pdb_get_set.c | 2 +- source/passdb/pdb_interface.c | 14 +- source/passdb/pdb_ldap.c | 16 +- source/passdb/secrets.c | 16 +- source/printing/nt_printing.c | 14 +- source/rpc_client/cli_lsarpc.c | 6 +- source/rpc_client/cli_netlogon.c | 6 +- source/rpc_parse/parse_dfs.c | 2 +- source/rpc_parse/parse_misc.c | 22 +- source/rpc_parse/parse_net.c | 10 +- source/rpc_parse/parse_samr.c | 2 +- source/rpc_server/srv_lsa_hnd.c | 18 +- source/rpc_server/srv_lsa_nt.c | 10 +- source/rpc_server/srv_pipe.c | 4 +- source/rpc_server/srv_reg_nt.c | 3 - source/rpc_server/srv_samr_nt.c | 12 +- source/rpc_server/srv_spoolss_nt.c | 6 +- source/smbd/lanman.c | 2 +- source/smbd/service.c | 2 +- source/smbd/share_access.c | 2 +- source/utils/net_groupmap.c | 4 +- source/utils/net_lookup.c | 4 +- source/utils/net_rpc.c | 12 +- source/utils/net_sam.c | 18 +- source/utils/net_util.c | 2 +- 70 files changed, 304 insertions(+), 936 deletions(-) diff --git a/source/auth/auth_util.c b/source/auth/auth_util.c index 704f0989e3a..0fbf672026f 100644 --- a/source/auth/auth_util.c +++ b/source/auth/auth_util.c @@ -776,7 +776,7 @@ static NTSTATUS create_builtin_administrators( void ) NTSTATUS status; DOM_SID dom_admins, root_sid; fstring root_name; - enum SID_NAME_USE type; + enum lsa_SidType type; TALLOC_CTX *ctx; BOOL ret; @@ -1063,7 +1063,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, NTSTATUS result = NT_STATUS_NO_SUCH_USER; TALLOC_CTX *tmp_ctx; DOM_SID user_sid; - enum SID_NAME_USE type; + enum lsa_SidType type; gid_t *gids; DOM_SID primary_group_sid; DOM_SID *group_sids; diff --git a/source/groupdb/mapping.c b/source/groupdb/mapping.c index 902068204ac..ba1a7d1dee5 100644 --- a/source/groupdb/mapping.c +++ b/source/groupdb/mapping.c @@ -22,121 +22,12 @@ */ #include "includes.h" - -static TDB_CONTEXT *tdb; /* used for driver files */ - -#define DATABASE_VERSION_V1 1 /* native byte format. */ -#define DATABASE_VERSION_V2 2 /* le format. */ - -#define GROUP_PREFIX "UNIXGROUP/" - -/* Alias memberships are stored reverse, as memberships. The performance - * critical operation is to determine the aliases a SID is member of, not - * listing alias members. So we store a list of alias SIDs a SID is member of - * hanging of the member as key. - */ -#define MEMBEROF_PREFIX "MEMBEROF/" - - -static BOOL enum_group_mapping(const DOM_SID *sid, enum SID_NAME_USE sid_name_use, GROUP_MAP **pp_rmap, - size_t *p_num_entries, BOOL unix_only); -static BOOL group_map_remove(const DOM_SID *sid); - -/**************************************************************************** - Open the group mapping tdb. -****************************************************************************/ - -static BOOL init_group_mapping(void) -{ - const char *vstring = "INFO/version"; - int32 vers_id; - GROUP_MAP *map_table = NULL; - size_t num_entries = 0; - - if (tdb) - return True; - - tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); - if (!tdb) { - DEBUG(0,("Failed to open group mapping database\n")); - return False; - } - - /* handle a Samba upgrade */ - tdb_lock_bystring(tdb, vstring); - - /* Cope with byte-reversed older versions of the db. */ - vers_id = tdb_fetch_int32(tdb, vstring); - if ((vers_id == DATABASE_VERSION_V1) || (IREV(vers_id) == DATABASE_VERSION_V1)) { - /* Written on a bigendian machine with old fetch_int code. Save as le. */ - tdb_store_int32(tdb, vstring, DATABASE_VERSION_V2); - vers_id = DATABASE_VERSION_V2; - } - - /* if its an unknown version we remove everthing in the db */ - - if (vers_id != DATABASE_VERSION_V2) { - tdb_traverse(tdb, tdb_traverse_delete_fn, NULL); - tdb_store_int32(tdb, vstring, DATABASE_VERSION_V2); - } - - tdb_unlock_bystring(tdb, vstring); - - /* cleanup any map entries with a gid == -1 */ - - if ( enum_group_mapping( NULL, SID_NAME_UNKNOWN, &map_table, &num_entries, False ) ) { - int i; - - for ( i=0; isid); - - len = tdb_pack(buf, sizeof(buf), "ddff", - map->gid, map->sid_name_use, map->nt_name, map->comment); - - if (len > sizeof(buf)) - return False; - - slprintf(key, sizeof(key), "%s%s", GROUP_PREFIX, string_sid); - - kbuf.dsize = strlen(key)+1; - kbuf.dptr = key; - dbuf.dsize = len; - dbuf.dptr = buf; - if (tdb_store(tdb, kbuf, dbuf, flag) != 0) return False; - - return True; -} +#include "groupdb/mapping.h" /**************************************************************************** initialise first time the mapping list ****************************************************************************/ -NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum SID_NAME_USE sid_name_use, const char *nt_name, const char *comment) +NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment) { GROUP_MAP map; @@ -216,327 +107,11 @@ NTSTATUS map_unix_group(const struct group *grp, GROUP_MAP *pmap) return status; } -/**************************************************************************** - Return the sid and the type of the unix group. -****************************************************************************/ - -static BOOL get_group_map_from_sid(DOM_SID sid, GROUP_MAP *map) -{ - TDB_DATA kbuf, dbuf; - pstring key; - fstring string_sid; - int ret = 0; - - if(!init_group_mapping()) { - DEBUG(0,("failed to initialize group mapping\n")); - return(False); - } - - /* the key is the SID, retrieving is direct */ - - sid_to_string(string_sid, &sid); - slprintf(key, sizeof(key), "%s%s", GROUP_PREFIX, string_sid); - - kbuf.dptr = key; - kbuf.dsize = strlen(key)+1; - - dbuf = tdb_fetch(tdb, kbuf); - if (!dbuf.dptr) - return False; - - ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddff", - &map->gid, &map->sid_name_use, &map->nt_name, &map->comment); - - SAFE_FREE(dbuf.dptr); - - if ( ret == -1 ) { - DEBUG(3,("get_group_map_from_sid: tdb_unpack failure\n")); - return False; - } - - sid_copy(&map->sid, &sid); - - return True; -} - -/**************************************************************************** - Return the sid and the type of the unix group. -****************************************************************************/ - -static BOOL get_group_map_from_gid(gid_t gid, GROUP_MAP *map) -{ - TDB_DATA kbuf, dbuf, newkey; - fstring string_sid; - int ret; - - if(!init_group_mapping()) { - DEBUG(0,("failed to initialize group mapping\n")); - return(False); - } - - /* we need to enumerate the TDB to find the GID */ - - for (kbuf = tdb_firstkey(tdb); - kbuf.dptr; - newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { - - if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue; - - dbuf = tdb_fetch(tdb, kbuf); - if (!dbuf.dptr) - continue; - - fstrcpy(string_sid, kbuf.dptr+strlen(GROUP_PREFIX)); - - string_to_sid(&map->sid, string_sid); - - ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddff", - &map->gid, &map->sid_name_use, &map->nt_name, &map->comment); - - SAFE_FREE(dbuf.dptr); - - if ( ret == -1 ) { - DEBUG(3,("get_group_map_from_gid: tdb_unpack failure\n")); - return False; - } - - if (gid==map->gid) { - SAFE_FREE(kbuf.dptr); - return True; - } - } - - return False; -} - -/**************************************************************************** - Return the sid and the type of the unix group. -****************************************************************************/ - -static BOOL get_group_map_from_ntname(const char *name, GROUP_MAP *map) -{ - TDB_DATA kbuf, dbuf, newkey; - fstring string_sid; - int ret; - - if(!init_group_mapping()) { - DEBUG(0,("get_group_map_from_ntname:failed to initialize group mapping\n")); - return(False); - } - - /* we need to enumerate the TDB to find the name */ - for (kbuf = tdb_firstkey(tdb); - kbuf.dptr; - newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { - if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue; - - dbuf = tdb_fetch(tdb, kbuf); - if (!dbuf.dptr) - continue; - fstrcpy(string_sid, kbuf.dptr+strlen(GROUP_PREFIX)); - string_to_sid(&map->sid, string_sid); - - ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddff", - &map->gid, &map->sid_name_use, &map->nt_name, &map->comment); - SAFE_FREE(dbuf.dptr); - - if ( ret == -1 ) { - DEBUG(3,("get_group_map_from_ntname: tdb_unpack failure\n")); - return False; - } - - if ( strequal(name, map->nt_name) ) { - SAFE_FREE(kbuf.dptr); - return True; - } - } - - return False; -} - -/**************************************************************************** - Remove a group mapping entry. -****************************************************************************/ - -static BOOL group_map_remove(const DOM_SID *sid) -{ - TDB_DATA kbuf, dbuf; - pstring key; - fstring string_sid; - - if(!init_group_mapping()) { - DEBUG(0,("failed to initialize group mapping\n")); - return(False); - } - - /* the key is the SID, retrieving is direct */ - - sid_to_string(string_sid, sid); - slprintf(key, sizeof(key), "%s%s", GROUP_PREFIX, string_sid); - - kbuf.dptr = key; - kbuf.dsize = strlen(key)+1; - - dbuf = tdb_fetch(tdb, kbuf); - if (!dbuf.dptr) - return False; - - SAFE_FREE(dbuf.dptr); - - if(tdb_delete(tdb, kbuf) != TDB_SUCCESS) - return False; - - return True; -} - -/**************************************************************************** - Enumerate the group mapping. -****************************************************************************/ - -static BOOL enum_group_mapping(const DOM_SID *domsid, enum SID_NAME_USE sid_name_use, GROUP_MAP **pp_rmap, - size_t *p_num_entries, BOOL unix_only) -{ - TDB_DATA kbuf, dbuf, newkey; - fstring string_sid; - GROUP_MAP map; - GROUP_MAP *mapt; - int ret; - size_t entries=0; - DOM_SID grpsid; - uint32 rid; - - if(!init_group_mapping()) { - DEBUG(0,("failed to initialize group mapping\n")); - return(False); - } - - *p_num_entries=0; - *pp_rmap=NULL; - - for (kbuf = tdb_firstkey(tdb); - kbuf.dptr; - newkey = tdb_nextkey(tdb, kbuf), safe_free(kbuf.dptr), kbuf=newkey) { - - if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) - continue; - - dbuf = tdb_fetch(tdb, kbuf); - if (!dbuf.dptr) - continue; - - fstrcpy(string_sid, kbuf.dptr+strlen(GROUP_PREFIX)); - - ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddff", - &map.gid, &map.sid_name_use, &map.nt_name, &map.comment); - - SAFE_FREE(dbuf.dptr); - - if ( ret == -1 ) { - DEBUG(3,("enum_group_mapping: tdb_unpack failure\n")); - continue; - } - - /* list only the type or everything if UNKNOWN */ - if (sid_name_use!=SID_NAME_UNKNOWN && sid_name_use!=map.sid_name_use) { - DEBUG(11,("enum_group_mapping: group %s is not of the requested type\n", map.nt_name)); - continue; - } - - if (unix_only==ENUM_ONLY_MAPPED && map.gid==-1) { - DEBUG(11,("enum_group_mapping: group %s is non mapped\n", map.nt_name)); - continue; - } - - string_to_sid(&grpsid, string_sid); - sid_copy( &map.sid, &grpsid ); - - sid_split_rid( &grpsid, &rid ); - - /* Only check the domain if we were given one */ - - if ( domsid && !sid_equal( domsid, &grpsid ) ) { - DEBUG(11,("enum_group_mapping: group %s is not in domain %s\n", - string_sid, sid_string_static(domsid))); - continue; - } - - DEBUG(11,("enum_group_mapping: returning group %s of " - "type %s\n", map.nt_name, - sid_type_lookup(map.sid_name_use))); - - (*pp_rmap) = SMB_REALLOC_ARRAY((*pp_rmap), GROUP_MAP, entries+1); - if (!(*pp_rmap)) { - DEBUG(0,("enum_group_mapping: Unable to enlarge group map!\n")); - return False; - } - - mapt = (*pp_rmap); - - mapt[entries].gid = map.gid; - sid_copy( &mapt[entries].sid, &map.sid); - mapt[entries].sid_name_use = map.sid_name_use; - fstrcpy(mapt[entries].nt_name, map.nt_name); - fstrcpy(mapt[entries].comment, map.comment); - - entries++; - - } - - *p_num_entries=entries; - - return True; -} - -/* This operation happens on session setup, so it should better be fast. We - * store a list of aliases a SID is member of hanging off MEMBEROF/SID. */ - -static NTSTATUS one_alias_membership(const DOM_SID *member, - DOM_SID **sids, size_t *num) -{ - fstring key, string_sid; - TDB_DATA kbuf, dbuf; - const char *p; - - if (!init_group_mapping()) { - DEBUG(0,("failed to initialize group mapping\n")); - return NT_STATUS_ACCESS_DENIED; - } - - sid_to_string(string_sid, member); - slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX, string_sid); - - kbuf.dsize = strlen(key)+1; - kbuf.dptr = key; - - dbuf = tdb_fetch(tdb, kbuf); - - if (dbuf.dptr == NULL) { - return NT_STATUS_OK; - } - - p = dbuf.dptr; - - while (next_token(&p, string_sid, " ", sizeof(string_sid))) { - - DOM_SID alias; - - if (!string_to_sid(&alias, string_sid)) - continue; - - add_sid_to_array_unique(NULL, &alias, sids, num); - - if (sids == NULL) - return NT_STATUS_NO_MEMORY; - } - - SAFE_FREE(dbuf.dptr); - return NT_STATUS_OK; -} static NTSTATUS alias_memberships(const DOM_SID *members, size_t num_members, DOM_SID **sids, size_t *num) @@ -554,235 +129,13 @@ static NTSTATUS alias_memberships(const DOM_SID *members, size_t num_members, return NT_STATUS_OK; } -static BOOL is_aliasmem(const DOM_SID *alias, const DOM_SID *member) -{ - DOM_SID *sids; - size_t i, num; - - /* This feels the wrong way round, but the on-disk data structure - * dictates it this way. */ - if (!NT_STATUS_IS_OK(alias_memberships(member, 1, &sids, &num))) - return False; - - for (i=0; ialias, &alias) != 0) - continue; - - /* Ok, we found the alias we're looking for in the membership - * list currently scanned. The key represents the alias - * member. Add that. */ - - member_string = strchr(key.dptr, '/'); - - /* Above we tested for MEMBEROF_PREFIX which includes the - * slash. */ - - SMB_ASSERT(member_string != NULL); - member_string += 1; - - if (!string_to_sid(&member, member_string)) - continue; - - add_sid_to_array(NULL, &member, closure->sids, closure->num); - } - - return 0; -} - -static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num) -{ - GROUP_MAP map; - struct aliasmem_closure closure; - - if(!init_group_mapping()) { - DEBUG(0,("failed to initialize group mapping\n")); - return NT_STATUS_ACCESS_DENIED; - } - - if (!get_group_map_from_sid(*alias, &map)) - return NT_STATUS_NO_SUCH_ALIAS; - - if ( (map.sid_name_use != SID_NAME_ALIAS) && - (map.sid_name_use != SID_NAME_WKN_GRP) ) - return NT_STATUS_NO_SUCH_ALIAS; - - *sids = NULL; - *num = 0; - - closure.alias = alias; - closure.sids = sids; - closure.num = num; - - tdb_traverse(tdb, collect_aliasmem, &closure); - return NT_STATUS_OK; -} - -static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member) -{ - NTSTATUS result; - DOM_SID *sids; - size_t i, num; - BOOL found = False; - char *member_string; - TDB_DATA kbuf, dbuf; - pstring key; - fstring sid_string; - - result = alias_memberships(member, 1, &sids, &num); - - if (!NT_STATUS_IS_OK(result)) - return result; - - for (i=0; isid, sidstr) || map->gid == (gid_t)-1 || - map->sid_name_use == (enum SID_NAME_USE)-1) { + map->sid_name_use == (enum lsa_SidType)-1) { DEBUG(0,("Unable to unpack group mapping\n")); return False; } @@ -320,7 +320,7 @@ failed: /* Enumerate the group mappings for a domain */ - BOOL enum_group_mapping(const DOM_SID *domsid, enum SID_NAME_USE sid_name_use, + BOOL enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, size_t *p_num_entries, BOOL unix_only) { diff --git a/source/groupdb/mapping_tdb.c b/source/groupdb/mapping_tdb.c index 0d179001330..12b7c682fb7 100644 --- a/source/groupdb/mapping_tdb.c +++ b/source/groupdb/mapping_tdb.c @@ -299,7 +299,7 @@ BOOL group_map_remove(const DOM_SID *sid) Enumerate the group mapping. ****************************************************************************/ -BOOL enum_group_mapping(const DOM_SID *domsid, enum SID_NAME_USE sid_name_use, GROUP_MAP **pp_rmap, +BOOL enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, size_t *p_num_entries, BOOL unix_only) { TDB_DATA kbuf, dbuf, newkey; diff --git a/source/include/client.h b/source/include/client.h index c6d7b162fcd..5ec98606f8d 100644 --- a/source/include/client.h +++ b/source/include/client.h @@ -179,6 +179,6 @@ struct cli_state { #define CLI_FULL_CONNECTION_DONT_SPNEGO 0x0001 #define CLI_FULL_CONNECTION_USE_KERBEROS 0x0002 -#define CLI_FULL_CONNECTION_ANNONYMOUS_FALLBACK 0x0004 +#define CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK 0x0004 #endif /* _CLIENT_H */ diff --git a/source/include/idmap.h b/source/include/idmap.h index 3907239f506..ee248ef26f2 100644 --- a/source/include/idmap.h +++ b/source/include/idmap.h @@ -29,9 +29,10 @@ #define IDMAP_VERSION 2 -#define SMB_IDMAP_INTERFACE_VERSION 2 - +/* The interface version specifier. + Updated to 3 for enum types by JRA. */ +#define SMB_IDMAP_INTERFACE_VERSION 3 enum idmap_type { ID_USERID, ID_GROUPID }; diff --git a/source/include/libmsrpc.h b/source/include/libmsrpc.h index 36bae441775..7b28d313336 100644 --- a/source/include/libmsrpc.h +++ b/source/include/libmsrpc.h @@ -704,7 +704,7 @@ struct LsaQueryInfoPolicy { char *forest_name; /**remote server's domain guid*/ - struct uuid *domain_guid; + struct GUID *domain_guid; /**remote server's domain SID*/ DOM_SID *domain_sid; diff --git a/source/include/mapping.h b/source/include/mapping.h index fdaa2b04532..8ba784e98c8 100644 --- a/source/include/mapping.h +++ b/source/include/mapping.h @@ -26,7 +26,7 @@ typedef struct _GROUP_MAP { struct pdb_methods *methods; gid_t gid; DOM_SID sid; - enum SID_NAME_USE sid_name_use; + enum lsa_SidType sid_name_use; fstring nt_name; fstring comment; } GROUP_MAP; diff --git a/source/include/nt_status.h b/source/include/nt_status.h index 14c83eba4b3..f57ddf6b3dc 100644 --- a/source/include/nt_status.h +++ b/source/include/nt_status.h @@ -45,9 +45,9 @@ typedef uint32 NTSTATUS; #endif #if defined(HAVE_IMMEDIATE_STRUCTURES) -typedef struct {uint32 v;} WERROR; +typedef struct {uint32 w;} WERROR; #define W_ERROR(x) ((WERROR) { x }) -#define W_ERROR_V(x) ((x).v) +#define W_ERROR_V(x) ((x).w) #else typedef uint32 WERROR; #define W_ERROR(x) (x) @@ -67,4 +67,34 @@ typedef uint32 WERROR; }\ } while (0) + +/* The top byte in an NTSTATUS code is used as a type field. + * Windows only uses value 0xC0 as an indicator for an NT error + * and 0x00 for success. + * So we can use the type field to store other types of error codes + * inside the three lower bytes. + * NB: The system error codes (errno) are not integrated via a type of + * their own but are mapped to genuine NT error codes via + * map_nt_error_from_unix() */ + +#define NT_STATUS_TYPE(status) ((NT_STATUS_V(status) & 0xFF000000) >> 24) + +#define NT_STATUS_TYPE_DOS 0xF1 +#define NT_STATUS_TYPE_LDAP 0xF2 + +/* this defines special NTSTATUS codes to represent DOS errors. I + have chosen this macro to produce status codes in the invalid + NTSTATUS range */ +#define NT_STATUS_DOS_MASK (NT_STATUS_TYPE_DOS << 24) +#define NT_STATUS_DOS(class, code) NT_STATUS(NT_STATUS_DOS_MASK | ((class)<<16) | code) +#define NT_STATUS_IS_DOS(status) ((NT_STATUS_V(status) & 0xFF000000) == NT_STATUS_DOS_MASK) +#define NT_STATUS_DOS_CLASS(status) ((NT_STATUS_V(status) >> 16) & 0xFF) +#define NT_STATUS_DOS_CODE(status) (NT_STATUS_V(status) & 0xFFFF) + +/* define ldap error codes as NTSTATUS codes */ +#define NT_STATUS_LDAP_MASK (NT_STATUS_TYPE_LDAP << 24) +#define NT_STATUS_LDAP(code) NT_STATUS(NT_STATUS_LDAP_MASK | code) +#define NT_STATUS_IS_LDAP(status) ((NT_STATUS_V(status) & 0xFF000000) == NT_STATUS_LDAP_MASK) +#define NT_STATUS_LDAP_CODE(status) (NT_STATUS_V(status) & ~0xFF000000) + #endif diff --git a/source/include/passdb.h b/source/include/passdb.h index 53e97e674c0..9dc6d60eb01 100644 --- a/source/include/passdb.h +++ b/source/include/passdb.h @@ -240,9 +240,11 @@ struct pdb_search { * There's no point in allocating arrays in * samr_lookup_rids twice. It was done in the srv_samr_nt.c code as well as in * the pdb module. Remove the latter, this might happen more often. VL. + * changed to version 14 to move lookup_rids and lookup_names to return + * enum lsa_SidType rather than uint32. */ -#define PASSDB_INTERFACE_VERSION 13 +#define PASSDB_INTERFACE_VERSION 14 struct pdb_methods { @@ -298,7 +300,7 @@ struct pdb_methods DOM_SID sid); NTSTATUS (*enum_group_mapping)(struct pdb_methods *methods, - const DOM_SID *sid, enum SID_NAME_USE sid_name_use, + const DOM_SID *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, size_t *p_num_entries, BOOL unix_only); @@ -363,14 +365,14 @@ struct pdb_methods int num_rids, uint32 *rids, const char **pp_names, - uint32 *attrs); + enum lsa_SidType *attrs); NTSTATUS (*lookup_names)(struct pdb_methods *methods, const DOM_SID *domain_sid, int num_names, const char **pp_names, uint32 *rids, - uint32 *attrs); + enum lsa_SidType *attrs); NTSTATUS (*get_account_policy)(struct pdb_methods *methods, int policy_index, uint32 *value); @@ -394,7 +396,7 @@ struct pdb_methods BOOL (*gid_to_sid)(struct pdb_methods *methods, gid_t gid, DOM_SID *sid); BOOL (*sid_to_id)(struct pdb_methods *methods, const DOM_SID *sid, - union unid_t *id, enum SID_NAME_USE *type); + union unid_t *id, enum lsa_SidType *type); BOOL (*rid_algorithm)(struct pdb_methods *methods); BOOL (*new_rid)(struct pdb_methods *methods, uint32 *rid); diff --git a/source/include/rpc_dce.h b/source/include/rpc_dce.h index b4d350ee6fa..09e5f25da8c 100644 --- a/source/include/rpc_dce.h +++ b/source/include/rpc_dce.h @@ -126,7 +126,7 @@ enum schannel_direction { /* RPC_IFACE */ typedef struct rpc_iface_info { - struct uuid uuid; /* 16 bytes of rpc interface identification */ + struct GUID uuid; /* 16 bytes of rpc interface identification */ uint32 version; /* the interface version number */ } RPC_IFACE; diff --git a/source/include/rpc_dfs.h b/source/include/rpc_dfs.h index 9aba123deed..601d3d3b017 100644 --- a/source/include/rpc_dfs.h +++ b/source/include/rpc_dfs.h @@ -76,7 +76,7 @@ typedef struct netdfs_dfs_Info4 { UNISTR2 comment; uint32 state; uint32 timeout; - struct uuid guid; + struct GUID guid; uint32 num_stores; uint32 ptr0_stores; uint32 size_stores; diff --git a/source/include/rpc_ds.h b/source/include/rpc_ds.h index 424e6c0494a..3c64745df19 100644 --- a/source/include/rpc_ds.h +++ b/source/include/rpc_ds.h @@ -68,7 +68,7 @@ typedef struct uint32 dnsname_ptr; uint32 forestname_ptr; - struct uuid domain_guid; + struct GUID domain_guid; UNISTR2 netbios_domain; @@ -114,7 +114,7 @@ typedef struct { uint32 trust_type; uint32 trust_attributes; uint32 sid_ptr; - struct uuid guid; + struct GUID guid; UNISTR2 netbios_domain; UNISTR2 dns_domain; @@ -128,7 +128,7 @@ struct ds_domain_trust { uint32 parent_index; uint32 trust_type; uint32 trust_attributes; - struct uuid guid; + struct GUID guid; DOM_SID sid; char *netbios_domain; diff --git a/source/include/rpc_lsa.h b/source/include/rpc_lsa.h index c4ce9e021d1..28dea219777 100644 --- a/source/include/rpc_lsa.h +++ b/source/include/rpc_lsa.h @@ -174,7 +174,7 @@ typedef struct lsa_dns_dom_info UNIHDR hdr_dns_dom_name; UNIHDR hdr_forest_name; - struct uuid dom_guid; /* domain GUID */ + struct GUID dom_guid; /* domain GUID */ UNISTR2 uni_nb_dom_name; UNISTR2 uni_dns_dom_name; diff --git a/source/include/rpc_misc.h b/source/include/rpc_misc.h index 661d436859a..0ee63ae7e18 100644 --- a/source/include/rpc_misc.h +++ b/source/include/rpc_misc.h @@ -92,34 +92,16 @@ enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_ * RPC policy handle used pretty much everywhere **********************************************************************/ +typedef struct policy_handle POLICY_HND; typedef struct { uint32 ptr_hnd; /* pointer to enumeration handle */ uint32 handle; /* enumeration handle */ } ENUM_HND; - - -/********************************************************************** - * RPC policy handle used pretty much everywhere - **********************************************************************/ - -typedef struct { - uint32 data1; - uint32 data2; - uint16 data3; - uint16 data4; - uint8 data5[8]; -#ifdef __INSURE__ - - /* To prevent the leakage of policy handles mallocate a bit of - memory when a policy handle is created and free it when the - handle is closed. This should cause Insure to flag an error - when policy handles are overwritten or fall out of scope without - being freed. */ - - char *marker; -#endif -} POLICY_HND; +#define OUR_HANDLE(hnd) (((hnd)==NULL) ? "NULL" :\ + ( IVAL((hnd)->uuid.node,2) == (uint32)sys_getpid() ? "OURS" : \ + "OTHER")), ((unsigned int)IVAL((hnd)->uuid.node,2)),\ + ((unsigned int)sys_getpid() ) /********************************************************************** diff --git a/source/include/rpc_netlogon.h b/source/include/rpc_netlogon.h index 01b6b99cbf6..327da45c2bb 100644 --- a/source/include/rpc_netlogon.h +++ b/source/include/rpc_netlogon.h @@ -1041,9 +1041,9 @@ typedef struct net_q_dsr_getdcname { uint32 ptr_domain_name; UNISTR2 uni_domain_name; uint32 ptr_domain_guid; - struct uuid *domain_guid; + struct GUID *domain_guid; uint32 ptr_site_guid; - struct uuid *site_guid; + struct GUID *site_guid; uint32 flags; } NET_Q_DSR_GETDCNAME; @@ -1054,7 +1054,7 @@ typedef struct net_r_dsr_getdcname { uint32 ptr_dc_address; UNISTR2 uni_dc_address; int32 dc_address_type; - struct uuid domain_guid; + struct GUID domain_guid; uint32 ptr_domain_name; UNISTR2 uni_domain_name; uint32 ptr_forest_name; diff --git a/source/include/rpc_secdes.h b/source/include/rpc_secdes.h index c385e41fd30..463c9634302 100644 --- a/source/include/rpc_secdes.h +++ b/source/include/rpc_secdes.h @@ -121,8 +121,8 @@ typedef struct security_ace_info /* this stuff may be present when type is XXXX_TYPE_XXXX_OBJECT */ uint32 obj_flags; /* xxxx_ACE_OBJECT_xxxx e.g present/inherited present etc */ - struct uuid obj_guid; /* object GUID */ - struct uuid inh_guid; /* inherited object GUID */ + struct GUID obj_guid; /* object GUID */ + struct GUID inh_guid; /* inherited object GUID */ /* eof object stuff */ DOM_SID trustee; diff --git a/source/include/smb.h b/source/include/smb.h index d7d195b0143..486a027c7e5 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -254,7 +254,7 @@ typedef struct nttime_info { #define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4))) /* SID Types */ -enum SID_NAME_USE { +enum lsa_SidType { SID_NAME_USE_NONE = 0, SID_NAME_USER = 1, /* user */ SID_NAME_DOM_GRP, /* domain group */ @@ -302,7 +302,7 @@ struct lsa_dom_info { struct lsa_name_info { uint32 rid; - enum SID_NAME_USE type; + enum lsa_SidType type; const char *name; int dom_idx; }; @@ -1844,14 +1844,19 @@ struct ea_list { /* EA to use for DOS attributes */ #define SAMBA_XATTR_DOS_ATTRIB "user.DOSATTRIB" -struct uuid { - uint32 time_low; - uint16 time_mid; - uint16 time_hi_and_version; - uint8 clock_seq[2]; - uint8 node[6]; -}; #define UUID_SIZE 16 +struct GUID { + uint32_t time_low; + uint16_t time_mid; + uint16_t time_hi_and_version; + uint8_t clock_seq[2]; + uint8_t node[6]; +}/* [noprint,gensize,public,noejs] */; + +struct policy_handle { + uint32_t handle_type; + struct GUID uuid; +}/* [public] */; #define UUID_FLAT_SIZE 16 typedef struct uuid_flat { diff --git a/source/lib/secace.c b/source/lib/secace.c index f1d4d99cc16..eb2fdd5c2bd 100644 --- a/source/lib/secace.c +++ b/source/lib/secace.c @@ -48,8 +48,8 @@ void sec_ace_copy(SEC_ACE *ace_dest, SEC_ACE *ace_src) ace_dest->size = ace_src->size; ace_dest->info.mask = ace_src->info.mask; ace_dest->obj_flags = ace_src->obj_flags; - memcpy(&ace_dest->obj_guid, &ace_src->obj_guid, sizeof(struct uuid)); - memcpy(&ace_dest->inh_guid, &ace_src->inh_guid, sizeof(struct uuid)); + memcpy(&ace_dest->obj_guid, &ace_src->obj_guid, sizeof(struct GUID)); + memcpy(&ace_dest->inh_guid, &ace_src->inh_guid, sizeof(struct GUID)); sid_copy(&ace_dest->trustee, &ace_src->trustee); } diff --git a/source/lib/util_sid.c b/source/lib/util_sid.c index 09fe30f81bb..e5a55d9e2b4 100644 --- a/source/lib/util_sid.c +++ b/source/lib/util_sid.c @@ -110,7 +110,7 @@ NT_USER_TOKEN system_token = { 1, system_sid_array, SE_ALL_PRIVS }; ****************************************************************************/ static const struct { - enum SID_NAME_USE sid_type; + enum lsa_SidType sid_type; const char *string; } sid_name_type[] = { {SID_NAME_USER, "User"}, @@ -123,7 +123,7 @@ static const struct { {SID_NAME_UNKNOWN, "UNKNOWN"}, {SID_NAME_COMPUTER, "Computer"}, - {(enum SID_NAME_USE)0, NULL} + {(enum lsa_SidType)0, NULL} }; const char *sid_type_lookup(uint32 sid_type) diff --git a/source/lib/util_uuid.c b/source/lib/util_uuid.c index df70740b33c..6374c2d8a94 100644 --- a/source/lib/util_uuid.c +++ b/source/lib/util_uuid.c @@ -27,7 +27,7 @@ #define TIME_OFFSET_HIGH 0x01B21DD2 #define TIME_OFFSET_LOW 0x13814000 -void smb_uuid_pack(const struct uuid uu, UUID_FLAT *ptr) +void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr) { SIVAL(ptr->info, 0, uu.time_low); SSVAL(ptr->info, 4, uu.time_mid); @@ -36,7 +36,7 @@ void smb_uuid_pack(const struct uuid uu, UUID_FLAT *ptr) memcpy(ptr->info+10, uu.node, 6); } -void smb_uuid_unpack(const UUID_FLAT in, struct uuid *uu) +void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu) { uu->time_low = IVAL(in.info, 0); uu->time_mid = SVAL(in.info, 4); @@ -45,15 +45,15 @@ void smb_uuid_unpack(const UUID_FLAT in, struct uuid *uu) memcpy(uu->node, in.info+10, 6); } -struct uuid smb_uuid_unpack_static(const UUID_FLAT in) +struct GUID smb_uuid_unpack_static(const UUID_FLAT in) { - static struct uuid uu; + static struct GUID uu; smb_uuid_unpack(in, &uu); return uu; } -void smb_uuid_generate_random(struct uuid *uu) +void smb_uuid_generate_random(struct GUID *uu) { UUID_FLAT tmp; @@ -64,7 +64,7 @@ void smb_uuid_generate_random(struct uuid *uu) uu->time_hi_and_version = (uu->time_hi_and_version & 0x0FFF) | 0x4000; } -char *smb_uuid_to_string(const struct uuid uu) +char *smb_uuid_to_string(const struct GUID uu) { char *out; @@ -77,7 +77,7 @@ char *smb_uuid_to_string(const struct uuid uu) return out; } -const char *smb_uuid_string_static(const struct uuid uu) +const char *smb_uuid_string_static(const struct GUID uu) { static char out[37]; @@ -90,7 +90,7 @@ const char *smb_uuid_string_static(const struct uuid uu) return out; } -BOOL smb_string_to_uuid(const char *in, struct uuid* uu) +BOOL smb_string_to_uuid(const char *in, struct GUID* uu) { BOOL ret = False; const char *ptr = in; diff --git a/source/libads/ads_utils.c b/source/libads/ads_utils.c index 0cbf235989e..5b450e02dda 100644 --- a/source/libads/ads_utils.c +++ b/source/libads/ads_utils.c @@ -135,7 +135,7 @@ uint32 ads_gtype2atype(uint32 gtype) } /* turn a sAMAccountType into a SID_NAME_USE */ -enum SID_NAME_USE ads_atype_map(uint32 atype) +enum lsa_SidType ads_atype_map(uint32 atype) { switch (atype & 0xF0000000) { case ATYPE_GLOBAL_GROUP: diff --git a/source/libads/ldap.c b/source/libads/ldap.c index ae4f55e1317..79b82a06c37 100644 --- a/source/libads/ldap.c +++ b/source/libads/ldap.c @@ -2134,7 +2134,7 @@ BOOL ads_pull_uint32(ADS_STRUCT *ads, * @return boolean indicating success **/ BOOL ads_pull_guid(ADS_STRUCT *ads, - void *msg, struct uuid *guid) + void *msg, struct GUID *guid) { char **values; UUID_FLAT flat_guid; diff --git a/source/libmsrpc/cac_lsarpc.c b/source/libmsrpc/cac_lsarpc.c index 72f22de5f22..eb1a9613734 100644 --- a/source/libmsrpc/cac_lsarpc.c +++ b/source/libmsrpc/cac_lsarpc.c @@ -470,7 +470,7 @@ int cac_LsaQueryInfoPolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct Lsa char *domain_name = NULL; char *dns_name = NULL; char *forest_name = NULL; - struct uuid *domain_guid = NULL; + struct GUID *domain_guid = NULL; DOM_SID *domain_sid = NULL; if(!hnd) diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c index c51da644a11..366106bce9c 100644 --- a/source/libsmb/cliconnect.c +++ b/source/libsmb/cliconnect.c @@ -1516,7 +1516,7 @@ NTSTATUS cli_full_connection(struct cli_state **output_cli, } if (!cli_session_setup(cli, user, password, pw_len, password, pw_len, domain)) { - if ((flags & CLI_FULL_CONNECTION_ANNONYMOUS_FALLBACK) + if ((flags & CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK) && cli_session_setup(cli, "", "", 0, "", 0, domain)) { } else { nt_status = cli_nt_error(cli); @@ -1669,7 +1669,7 @@ struct cli_state *get_ipc_connect(char *server, struct in_addr *server_ip, nt_status = cli_full_connection(&cli, myname, server, server_ip, 0, "IPC$", "IPC", user_info->username, lp_workgroup(), user_info->password, - CLI_FULL_CONNECTION_ANNONYMOUS_FALLBACK, Undefined, NULL); + CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK, Undefined, NULL); if (NT_STATUS_IS_OK(nt_status)) { return cli; diff --git a/source/modules/nfs4_acls.c b/source/modules/nfs4_acls.c index 6e543b719c3..91ebba1f588 100644 --- a/source/modules/nfs4_acls.c +++ b/source/modules/nfs4_acls.c @@ -436,7 +436,7 @@ static int smbacl4_fill_ace4( ) { const char *dom, *name; - enum SID_NAME_USE type; + enum lsa_SidType type; uid_t uid; gid_t gid; diff --git a/source/modules/vfs_afsacl.c b/source/modules/vfs_afsacl.c index 2ace4aed318..e485b3c526b 100644 --- a/source/modules/vfs_afsacl.c +++ b/source/modules/vfs_afsacl.c @@ -48,7 +48,7 @@ struct afs_ace { BOOL positive; char *name; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; uint32 rights; struct afs_ace *next; }; @@ -110,7 +110,7 @@ static struct afs_ace *new_afs_ace(TALLOC_CTX *mem_ctx, const char *name, uint32 rights) { DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; struct afs_ace *result; if (strcmp(name, "system:administrators") == 0) { @@ -713,7 +713,7 @@ static BOOL nt_to_afs_acl(const char *filename, for (i = 0; i < dacl->num_aces; i++) { SEC_ACE *ace = &(dacl->ace[i]); const char *dom_name, *name; - enum SID_NAME_USE name_type; + enum lsa_SidType name_type; char *p; if (ace->type != SEC_ACE_TYPE_ACCESS_ALLOWED) { diff --git a/source/nmbd/nmbd_processlogon.c b/source/nmbd/nmbd_processlogon.c index 5c0fc2c521c..4a8d1db51db 100644 --- a/source/nmbd/nmbd_processlogon.c +++ b/source/nmbd/nmbd_processlogon.c @@ -382,7 +382,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", } #ifdef HAVE_ADS else { - struct uuid domain_guid; + struct GUID domain_guid; UUID_FLAT flat_guid; pstring domain; pstring hostname; diff --git a/source/nsswitch/wb_client.c b/source/nsswitch/wb_client.c index 2f0a694d682..77e2645b743 100644 --- a/source/nsswitch/wb_client.c +++ b/source/nsswitch/wb_client.c @@ -35,7 +35,7 @@ NSS_STATUS winbindd_request_response(int req_type, /* Call winbindd to convert a name to a sid */ BOOL winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *name_type) + enum lsa_SidType *name_type) { struct winbindd_request request; struct winbindd_response response; @@ -56,7 +56,7 @@ BOOL winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, &response)) == NSS_STATUS_SUCCESS) { if (!string_to_sid(sid, response.data.sid.sid)) return False; - *name_type = (enum SID_NAME_USE)response.data.sid.type; + *name_type = (enum lsa_SidType)response.data.sid.type; } return result == NSS_STATUS_SUCCESS; @@ -66,7 +66,7 @@ BOOL winbind_lookup_name(const char *dom_name, const char *name, DOM_SID *sid, BOOL winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, const char **domain, const char **name, - enum SID_NAME_USE *name_type) + enum lsa_SidType *name_type) { struct winbindd_request request; struct winbindd_response response; @@ -105,7 +105,7 @@ BOOL winbind_lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, } } - *name_type = (enum SID_NAME_USE)response.data.name.type; + *name_type = (enum lsa_SidType)response.data.name.type; DEBUG(10, ("winbind_lookup_sid: SUCCESS: SID %s -> %s %s\n", sid_string_static(sid), response.data.name.dom_name, @@ -117,7 +117,7 @@ BOOL winbind_lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, int num_rids, uint32 *rids, const char **domain_name, - const char ***names, enum SID_NAME_USE **types) + const char ***names, enum lsa_SidType **types) { size_t i, buflen; ssize_t len; @@ -166,7 +166,7 @@ BOOL winbind_lookup_rids(TALLOC_CTX *mem_ctx, *domain_name = talloc_strdup(mem_ctx, response.data.domain_name); *names = TALLOC_ARRAY(mem_ctx, const char *, num_rids); - *types = TALLOC_ARRAY(mem_ctx, enum SID_NAME_USE, num_rids); + *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); if ((*names == NULL) || (*types == NULL)) { goto fail; @@ -183,7 +183,7 @@ BOOL winbind_lookup_rids(TALLOC_CTX *mem_ctx, goto fail; } - (*types)[i] = (enum SID_NAME_USE)strtoul(p, &q, 10); + (*types)[i] = (enum lsa_SidType)strtoul(p, &q, 10); if (*q != ' ') { DEBUG(10, ("Got invalid reply: %s\n", diff --git a/source/nsswitch/wbinfo.c b/source/nsswitch/wbinfo.c index a393855f026..ffca4121fac 100644 --- a/source/nsswitch/wbinfo.c +++ b/source/nsswitch/wbinfo.c @@ -647,7 +647,7 @@ static BOOL wbinfo_lookuprids(char *domain_sid, char *arg) const char *p; char ridstr[32]; const char **names; - enum SID_NAME_USE *types; + enum lsa_SidType *types; const char *domain_name; TALLOC_CTX *mem_ctx; diff --git a/source/nsswitch/winbindd.h b/source/nsswitch/winbindd.h index 25fb4070dbe..c18848ac52b 100644 --- a/source/nsswitch/winbindd.h +++ b/source/nsswitch/winbindd.h @@ -60,7 +60,7 @@ struct sid_ctr { BOOL finished; const char *domain; const char *name; - enum SID_NAME_USE type; + enum lsa_SidType type; }; struct winbindd_cli_state { @@ -241,7 +241,7 @@ struct winbindd_methods { const char *domain_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type); + enum lsa_SidType *type); /* convert a sid to a user or group name */ NTSTATUS (*sid_to_name)(struct winbindd_domain *domain, @@ -249,7 +249,7 @@ struct winbindd_methods { const DOM_SID *sid, char **domain_name, char **name, - enum SID_NAME_USE *type); + enum lsa_SidType *type); NTSTATUS (*rids_to_names)(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx, @@ -258,7 +258,7 @@ struct winbindd_methods { size_t num_rids, char **domain_name, char ***names, - enum SID_NAME_USE **types); + enum lsa_SidType **types); /* lookup user info for a given SID */ NTSTATUS (*query_user)(struct winbindd_domain *domain, diff --git a/source/nsswitch/winbindd_async.c b/source/nsswitch/winbindd_async.c index b2f234c4740..40211065163 100644 --- a/source/nsswitch/winbindd_async.c +++ b/source/nsswitch/winbindd_async.c @@ -551,9 +551,9 @@ static void lookupsid_recv(TALLOC_CTX *mem_ctx, BOOL success, void *c, void *private_data) { void (*cont)(void *priv, BOOL succ, const char *dom_name, - const char *name, enum SID_NAME_USE type) = + const char *name, enum lsa_SidType type) = (void (*)(void *, BOOL, const char *, const char *, - enum SID_NAME_USE))c; + enum lsa_SidType))c; if (!success) { DEBUG(5, ("Could not trigger lookupsid\n")); @@ -569,14 +569,14 @@ static void lookupsid_recv(TALLOC_CTX *mem_ctx, BOOL success, cont(private_data, True, response->data.name.dom_name, response->data.name.name, - (enum SID_NAME_USE)response->data.name.type); + (enum lsa_SidType)response->data.name.type); } void winbindd_lookupsid_async(TALLOC_CTX *mem_ctx, const DOM_SID *sid, void (*cont)(void *private_data, BOOL success, const char *dom_name, const char *name, - enum SID_NAME_USE type), + enum lsa_SidType type), void *private_data) { struct winbindd_domain *domain; @@ -601,7 +601,7 @@ void winbindd_lookupsid_async(TALLOC_CTX *mem_ctx, const DOM_SID *sid, enum winbindd_result winbindd_dual_lookupsid(struct winbindd_domain *domain, struct winbindd_cli_state *state) { - enum SID_NAME_USE type; + enum lsa_SidType type; DOM_SID sid; fstring name; fstring dom_name; @@ -638,8 +638,8 @@ static void lookupname_recv(TALLOC_CTX *mem_ctx, BOOL success, void *c, void *private_data) { void (*cont)(void *priv, BOOL succ, const DOM_SID *sid, - enum SID_NAME_USE type) = - (void (*)(void *, BOOL, const DOM_SID *, enum SID_NAME_USE))c; + enum lsa_SidType type) = + (void (*)(void *, BOOL, const DOM_SID *, enum lsa_SidType))c; DOM_SID sid; if (!success) { @@ -662,14 +662,14 @@ static void lookupname_recv(TALLOC_CTX *mem_ctx, BOOL success, } cont(private_data, True, &sid, - (enum SID_NAME_USE)response->data.sid.type); + (enum lsa_SidType)response->data.sid.type); } void winbindd_lookupname_async(TALLOC_CTX *mem_ctx, const char *dom_name, const char *name, void (*cont)(void *private_data, BOOL success, const DOM_SID *sid, - enum SID_NAME_USE type), + enum lsa_SidType type), void *private_data) { struct winbindd_request request; @@ -695,7 +695,7 @@ void winbindd_lookupname_async(TALLOC_CTX *mem_ctx, const char *dom_name, enum winbindd_result winbindd_dual_lookupname(struct winbindd_domain *domain, struct winbindd_cli_state *state) { - enum SID_NAME_USE type; + enum lsa_SidType type; char *name_domain, *name_user; DOM_SID sid; char *p; @@ -812,7 +812,7 @@ enum winbindd_result winbindd_dual_lookuprids(struct winbindd_domain *domain, DOM_SID domain_sid; char *domain_name; char **names; - enum SID_NAME_USE *types; + enum lsa_SidType *types; NTSTATUS status; char *result; @@ -1171,7 +1171,7 @@ struct sid2uid_state { static void sid2uid_lookup_sid_recv(void *private_data, BOOL success, const char *dom_name, const char *name, - enum SID_NAME_USE type); + enum lsa_SidType type); static void sid2uid_noalloc_recv(void *private_data, BOOL success, uid_t uid); static void sid2uid_alloc_recv(void *private_data, BOOL success, uid_t uid); static void sid2uid_name2uid_recv(void *private_data, BOOL success, uid_t uid); @@ -1220,7 +1220,7 @@ void winbindd_sid2uid_async(TALLOC_CTX *mem_ctx, const DOM_SID *sid, static void sid2uid_lookup_sid_recv(void *private_data, BOOL success, const char *dom_name, const char *name, - enum SID_NAME_USE type) + enum lsa_SidType type) { struct sid2uid_state *state = talloc_get_type_abort(private_data, struct sid2uid_state); @@ -1333,7 +1333,7 @@ struct sid2gid_state { static void sid2gid_lookup_sid_recv(void *private_data, BOOL success, const char *dom_name, const char *name, - enum SID_NAME_USE type); + enum lsa_SidType type); static void sid2gid_noalloc_recv(void *private_data, BOOL success, gid_t gid); static void sid2gid_alloc_recv(void *private_data, BOOL success, gid_t gid); static void sid2gid_name2gid_recv(void *private_data, BOOL success, gid_t gid); @@ -1382,7 +1382,7 @@ void winbindd_sid2gid_async(TALLOC_CTX *mem_ctx, const DOM_SID *sid, static void sid2gid_lookup_sid_recv(void *private_data, BOOL success, const char *dom_name, const char *name, - enum SID_NAME_USE type) + enum lsa_SidType type) { struct sid2gid_state *state = talloc_get_type_abort(private_data, struct sid2gid_state); diff --git a/source/nsswitch/winbindd_cache.c b/source/nsswitch/winbindd_cache.c index 31ea88fbe7c..aa519c35a94 100644 --- a/source/nsswitch/winbindd_cache.c +++ b/source/nsswitch/winbindd_cache.c @@ -769,7 +769,7 @@ static void centry_end(struct cache_entry *centry, const char *format, ...) static void wcache_save_name_to_sid(struct winbindd_domain *domain, NTSTATUS status, const char *domain_name, const char *name, const DOM_SID *sid, - enum SID_NAME_USE type) + enum lsa_SidType type) { struct cache_entry *centry; fstring uname; @@ -788,7 +788,7 @@ static void wcache_save_name_to_sid(struct winbindd_domain *domain, } static void wcache_save_sid_to_name(struct winbindd_domain *domain, NTSTATUS status, - const DOM_SID *sid, const char *domain_name, const char *name, enum SID_NAME_USE type) + const DOM_SID *sid, const char *domain_name, const char *name, enum lsa_SidType type) { struct cache_entry *centry; fstring sid_string; @@ -1308,7 +1308,7 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, const char *domain_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { struct winbind_cache *cache = get_cache(domain); struct cache_entry *centry = NULL; @@ -1323,7 +1323,7 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, centry = wcache_fetch(cache, domain, "NS/%s/%s", domain_name, uname); if (!centry) goto do_query; - *type = (enum SID_NAME_USE)centry_uint32(centry); + *type = (enum lsa_SidType)centry_uint32(centry); status = centry->status; if (NT_STATUS_IS_OK(status)) { centry_sid(centry, mem_ctx, sid); @@ -1377,7 +1377,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain, const DOM_SID *sid, char **domain_name, char **name, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { struct winbind_cache *cache = get_cache(domain); struct cache_entry *centry = NULL; @@ -1391,7 +1391,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain, if (!centry) goto do_query; if (NT_STATUS_IS_OK(centry->status)) { - *type = (enum SID_NAME_USE)centry_uint32(centry); + *type = (enum lsa_SidType)centry_uint32(centry); *domain_name = centry_string(centry, mem_ctx); *name = centry_string(centry, mem_ctx); } @@ -1440,7 +1440,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, size_t num_rids, char **domain_name, char ***names, - enum SID_NAME_USE **types) + enum lsa_SidType **types) { struct winbind_cache *cache = get_cache(domain); size_t i; @@ -1461,7 +1461,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, } *names = TALLOC_ARRAY(mem_ctx, char *, num_rids); - *types = TALLOC_ARRAY(mem_ctx, enum SID_NAME_USE, num_rids); + *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); if ((*names == NULL) || (*types == NULL)) { result = NT_STATUS_NO_MEMORY; @@ -1491,7 +1491,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, if (NT_STATUS_IS_OK(centry->status)) { char *dom; have_mapped = True; - (*types)[i] = (enum SID_NAME_USE)centry_uint32(centry); + (*types)[i] = (enum lsa_SidType)centry_uint32(centry); dom = centry_string(centry, mem_ctx); if (*domain_name == NULL) { *domain_name = dom; @@ -2252,7 +2252,7 @@ void cache_cleanup_response(pid_t pid) BOOL lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, const char **domain_name, const char **name, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { struct winbindd_domain *domain; struct winbind_cache *cache; @@ -2276,7 +2276,7 @@ BOOL lookup_cached_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, } if (NT_STATUS_IS_OK(centry->status)) { - *type = (enum SID_NAME_USE)centry_uint32(centry); + *type = (enum lsa_SidType)centry_uint32(centry); *domain_name = centry_string(centry, mem_ctx); *name = centry_string(centry, mem_ctx); } @@ -2290,7 +2290,7 @@ BOOL lookup_cached_name(TALLOC_CTX *mem_ctx, const char *domain_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { struct winbindd_domain *domain; struct winbind_cache *cache; @@ -2318,7 +2318,7 @@ BOOL lookup_cached_name(TALLOC_CTX *mem_ctx, } if (NT_STATUS_IS_OK(centry->status)) { - *type = (enum SID_NAME_USE)centry_uint32(centry); + *type = (enum lsa_SidType)centry_uint32(centry); centry_sid(centry, mem_ctx, sid); } @@ -2330,7 +2330,7 @@ BOOL lookup_cached_name(TALLOC_CTX *mem_ctx, void cache_name2sid(struct winbindd_domain *domain, const char *domain_name, const char *name, - enum SID_NAME_USE type, const DOM_SID *sid) + enum lsa_SidType type, const DOM_SID *sid) { refresh_sequence_number(domain, False); wcache_save_name_to_sid(domain, NT_STATUS_OK, domain_name, name, diff --git a/source/nsswitch/winbindd_creds.c b/source/nsswitch/winbindd_creds.c index 75d21353fd1..f11b80909bf 100644 --- a/source/nsswitch/winbindd_creds.c +++ b/source/nsswitch/winbindd_creds.c @@ -80,7 +80,7 @@ NTSTATUS winbindd_store_creds(struct winbindd_domain *domain, /* do lookup ourself */ - enum SID_NAME_USE type; + enum lsa_SidType type; if (!lookup_cached_name(mem_ctx, domain->name, diff --git a/source/nsswitch/winbindd_group.c b/source/nsswitch/winbindd_group.c index 87593b59f9a..7feaadbf979 100644 --- a/source/nsswitch/winbindd_group.c +++ b/source/nsswitch/winbindd_group.c @@ -59,7 +59,7 @@ static BOOL fill_grent(struct winbindd_gr *gr, const char *dom_name, static BOOL fill_grent_mem(struct winbindd_domain *domain, struct winbindd_cli_state *state, DOM_SID *group_sid, - enum SID_NAME_USE group_name_type, + enum lsa_SidType group_name_type, size_t *num_gr_mem, char **gr_mem, size_t *gr_mem_len) { DOM_SID *sid_mem = NULL; @@ -172,7 +172,7 @@ static BOOL fill_grent_mem(struct winbindd_domain *domain, char *domainname = NULL; char *username = NULL; fstring name; - enum SID_NAME_USE type; + enum lsa_SidType type; DEBUG(10,("fill_grent_mem: sid %s in 'Domain Users' in domain %s\n", sid_to_string(sid_string, pquerying_user_sid), domain->name )); @@ -315,7 +315,7 @@ void winbindd_getgrnam(struct winbindd_cli_state *state) DOM_SID group_sid, tmp_sid; uint32 grp_rid; struct winbindd_domain *domain; - enum SID_NAME_USE name_type; + enum lsa_SidType name_type; fstring name_domain, name_group; char *tmp, *gr_mem; size_t gr_mem_len; @@ -443,7 +443,7 @@ void winbindd_getgrnam(struct winbindd_cli_state *state) static void getgrgid_got_sid(struct winbindd_cli_state *state, DOM_SID group_sid) { struct winbindd_domain *domain; - enum SID_NAME_USE name_type; + enum lsa_SidType name_type; fstring dom_name; fstring group_name; size_t gr_mem_len; @@ -503,7 +503,7 @@ static void getgrgid_got_sid(struct winbindd_cli_state *state, DOM_SID group_sid static void getgrgid_recv(void *private_data, BOOL success, const char *sid) { struct winbindd_cli_state *state = talloc_get_type_abort(private_data, struct winbindd_cli_state); - enum SID_NAME_USE name_type; + enum lsa_SidType name_type; DOM_SID group_sid; if (success) { @@ -858,7 +858,7 @@ void winbindd_getgrent(struct winbindd_cli_state *state) if (!NT_STATUS_IS_OK(idmap_sid_to_gid(&group_sid, &group_gid, 0))) { union unid_t id; - enum SID_NAME_USE type; + enum lsa_SidType type; DEBUG(10, ("SID %s not in idmap\n", sid_string_static(&group_sid))); @@ -1114,7 +1114,7 @@ struct getgroups_state { }; static void getgroups_usersid_recv(void *private_data, BOOL success, - const DOM_SID *sid, enum SID_NAME_USE type); + const DOM_SID *sid, enum lsa_SidType type); static void getgroups_tokensids_recv(void *private_data, BOOL success, DOM_SID *token_sids, size_t num_token_sids); static void getgroups_sid2gid_recv(void *private_data, BOOL success, gid_t gid); @@ -1184,7 +1184,7 @@ void winbindd_getgroups(struct winbindd_cli_state *state) } static void getgroups_usersid_recv(void *private_data, BOOL success, - const DOM_SID *sid, enum SID_NAME_USE type) + const DOM_SID *sid, enum lsa_SidType type) { struct getgroups_state *s = (struct getgroups_state *)private_data; diff --git a/source/nsswitch/winbindd_pam.c b/source/nsswitch/winbindd_pam.c index c57de658435..4e063265fc4 100644 --- a/source/nsswitch/winbindd_pam.c +++ b/source/nsswitch/winbindd_pam.c @@ -713,7 +713,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain, uint16 max_allowed_bad_attempts; fstring name_domain, name_user; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; uchar new_nt_pass[NT_HASH_LEN]; const uint8 *cached_nt_pass; const uint8 *cached_salt; diff --git a/source/nsswitch/winbindd_passdb.c b/source/nsswitch/winbindd_passdb.c index d73917ef830..70590579cc4 100644 --- a/source/nsswitch/winbindd_passdb.c +++ b/source/nsswitch/winbindd_passdb.c @@ -52,7 +52,7 @@ static void add_expanded_sid(const DOM_SID *sid, char **pp_members, size_t *p_nu char *domain_name = NULL; char *name = NULL; - enum SID_NAME_USE type; + enum lsa_SidType type; uint32 num_names; DOM_SID *sid_mem; @@ -241,7 +241,7 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, const char *domain_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { DEBUG(10, ("Finding name %s\n", name)); @@ -262,7 +262,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain, const DOM_SID *sid, char **domain_name, char **name, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { const char *dom, *nam; @@ -293,7 +293,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, size_t num_rids, char **domain_name, char ***names, - enum SID_NAME_USE **types) + enum lsa_SidType **types) { return NT_STATUS_UNSUCCESSFUL; } diff --git a/source/nsswitch/winbindd_reconnect.c b/source/nsswitch/winbindd_reconnect.c index 8c5d59f9af0..6b484bdd062 100644 --- a/source/nsswitch/winbindd_reconnect.c +++ b/source/nsswitch/winbindd_reconnect.c @@ -87,7 +87,7 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, const char *domain_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { NTSTATUS result; @@ -111,7 +111,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain, const DOM_SID *sid, char **domain_name, char **name, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { NTSTATUS result; @@ -132,7 +132,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, size_t num_rids, char **domain_name, char ***names, - enum SID_NAME_USE **types) + enum lsa_SidType **types) { NTSTATUS result; diff --git a/source/nsswitch/winbindd_rpc.c b/source/nsswitch/winbindd_rpc.c index 3e96d110859..61ed71f83cf 100644 --- a/source/nsswitch/winbindd_rpc.c +++ b/source/nsswitch/winbindd_rpc.c @@ -241,11 +241,11 @@ NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain, const char *domain_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { NTSTATUS result; DOM_SID *sids = NULL; - enum SID_NAME_USE *types = NULL; + enum lsa_SidType *types = NULL; const char *full_name; struct rpc_pipe_client *cli; POLICY_HND lsa_policy; @@ -290,11 +290,11 @@ NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain, const DOM_SID *sid, char **domain_name, char **name, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { char **domains; char **names; - enum SID_NAME_USE *types; + enum lsa_SidType *types; NTSTATUS result; struct rpc_pipe_client *cli; POLICY_HND lsa_policy; @@ -311,7 +311,7 @@ NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain, if (!NT_STATUS_IS_OK(result)) return result; - *type = (enum SID_NAME_USE)types[0]; + *type = (enum lsa_SidType)types[0]; *domain_name = domains[0]; *name = names[0]; DEBUG(5,("Mapped sid to [%s]\\[%s]\n", domains[0], *name)); @@ -325,7 +325,7 @@ NTSTATUS msrpc_rids_to_names(struct winbindd_domain *domain, size_t num_rids, char **domain_name, char ***names, - enum SID_NAME_USE **types) + enum lsa_SidType **types) { char **domains; NTSTATUS result; diff --git a/source/nsswitch/winbindd_sid.c b/source/nsswitch/winbindd_sid.c index 194104915ae..b572771a25f 100644 --- a/source/nsswitch/winbindd_sid.c +++ b/source/nsswitch/winbindd_sid.c @@ -30,7 +30,7 @@ static void lookupsid_recv(void *private_data, BOOL success, const char *dom_name, const char *name, - enum SID_NAME_USE type); + enum lsa_SidType type); void winbindd_lookupsid(struct winbindd_cli_state *state) { @@ -53,7 +53,7 @@ void winbindd_lookupsid(struct winbindd_cli_state *state) static void lookupsid_recv(void *private_data, BOOL success, const char *dom_name, const char *name, - enum SID_NAME_USE type) + enum lsa_SidType type) { struct winbindd_cli_state *state = talloc_get_type_abort(private_data, struct winbindd_cli_state); @@ -75,7 +75,7 @@ static void lookupsid_recv(void *private_data, BOOL success, **/ static void lookupname_recv(void *private_data, BOOL success, - const DOM_SID *sid, enum SID_NAME_USE type); + const DOM_SID *sid, enum lsa_SidType type); void winbindd_lookupname(struct winbindd_cli_state *state) { @@ -107,7 +107,7 @@ void winbindd_lookupname(struct winbindd_cli_state *state) } static void lookupname_recv(void *private_data, BOOL success, - const DOM_SID *sid, enum SID_NAME_USE type) + const DOM_SID *sid, enum lsa_SidType type) { struct winbindd_cli_state *state = talloc_get_type_abort(private_data, struct winbindd_cli_state); @@ -287,14 +287,14 @@ struct uid2sid_state { uid_t uid; fstring name; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; }; static void uid2sid_uid2name_recv(void *private_data, BOOL success, const char *username); static void uid2sid_lookupname_recv(void *private_data, BOOL success, const DOM_SID *sid, - enum SID_NAME_USE type); + enum lsa_SidType type); static void uid2sid_idmap_set_mapping_recv(void *private_data, BOOL success); static void uid2sid_recv(void *private_data, BOOL success, const char *sid); @@ -394,7 +394,7 @@ static void uid2sid_uid2name_recv(void *private_data, BOOL success, } static void uid2sid_lookupname_recv(void *private_data, BOOL success, - const DOM_SID *sid, enum SID_NAME_USE type) + const DOM_SID *sid, enum lsa_SidType type) { struct uid2sid_state *state = talloc_get_type_abort(private_data, struct uid2sid_state); @@ -432,14 +432,14 @@ struct gid2sid_state { gid_t gid; fstring name; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; }; static void gid2sid_gid2name_recv(void *private_data, BOOL success, const char *groupname); static void gid2sid_lookupname_recv(void *private_data, BOOL success, const DOM_SID *sid, - enum SID_NAME_USE type); + enum lsa_SidType type); static void gid2sid_idmap_set_mapping_recv(void *private_data, BOOL success); static void gid2sid_recv(void *private_data, BOOL success, const char *sid); @@ -542,7 +542,7 @@ static void gid2sid_gid2name_recv(void *private_data, BOOL success, } static void gid2sid_lookupname_recv(void *private_data, BOOL success, - const DOM_SID *sid, enum SID_NAME_USE type) + const DOM_SID *sid, enum lsa_SidType type) { struct gid2sid_state *state = talloc_get_type_abort(private_data, struct gid2sid_state); diff --git a/source/nsswitch/winbindd_user.c b/source/nsswitch/winbindd_user.c index 9c60c73fc4d..8b19859940d 100644 --- a/source/nsswitch/winbindd_user.c +++ b/source/nsswitch/winbindd_user.c @@ -314,7 +314,7 @@ static void getpwsid_sid2gid_recv(void *private_data, BOOL success, gid_t gid) /* Return a password structure from a username. */ static void getpwnam_name2sid_recv(void *private_data, BOOL success, - const DOM_SID *sid, enum SID_NAME_USE type); + const DOM_SID *sid, enum lsa_SidType type); void winbindd_getpwnam(struct winbindd_cli_state *state) { @@ -360,7 +360,7 @@ void winbindd_getpwnam(struct winbindd_cli_state *state) } static void getpwnam_name2sid_recv(void *private_data, BOOL success, - const DOM_SID *sid, enum SID_NAME_USE type) + const DOM_SID *sid, enum lsa_SidType type) { struct winbindd_cli_state *state = (struct winbindd_cli_state *)private_data; diff --git a/source/nsswitch/winbindd_util.c b/source/nsswitch/winbindd_util.c index d94202666c3..cdffc280873 100644 --- a/source/nsswitch/winbindd_util.c +++ b/source/nsswitch/winbindd_util.c @@ -690,7 +690,7 @@ BOOL winbindd_lookup_sid_by_name(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain, const char *domain_name, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { NTSTATUS result; @@ -720,7 +720,7 @@ BOOL winbindd_lookup_name_by_sid(TALLOC_CTX *mem_ctx, DOM_SID *sid, fstring dom_name, fstring name, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { char *names; char *dom_names; diff --git a/source/passdb/lookup_sid.c b/source/passdb/lookup_sid.c index d41a7f0aced..da5e3f82824 100644 --- a/source/passdb/lookup_sid.c +++ b/source/passdb/lookup_sid.c @@ -33,7 +33,7 @@ BOOL lookup_name(TALLOC_CTX *mem_ctx, const char *full_name, int flags, const char **ret_domain, const char **ret_name, - DOM_SID *ret_sid, enum SID_NAME_USE *ret_type) + DOM_SID *ret_sid, enum lsa_SidType *ret_type) { char *p; const char *tmp; @@ -41,7 +41,7 @@ BOOL lookup_name(TALLOC_CTX *mem_ctx, const char *name = NULL; uint32 rid; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); if (tmp_ctx == NULL) { @@ -232,7 +232,7 @@ BOOL lookup_name(TALLOC_CTX *mem_ctx, if (IS_DC && winbind_lookup_name("", name, &sid, &type)) { DOM_SID dom_sid; uint32 tmp_rid; - enum SID_NAME_USE domain_type; + enum lsa_SidType domain_type; if (type == SID_NAME_DOMAIN) { /* Swap name and type */ @@ -332,7 +332,7 @@ BOOL lookup_name(TALLOC_CTX *mem_ctx, BOOL lookup_name_smbconf(TALLOC_CTX *mem_ctx, const char *full_name, int flags, const char **ret_domain, const char **ret_name, - DOM_SID *ret_sid, enum SID_NAME_USE *ret_type) + DOM_SID *ret_sid, enum lsa_SidType *ret_type) { char *qualified_name; const char *p; @@ -397,7 +397,7 @@ static BOOL wb_lookup_rids(TALLOC_CTX *mem_ctx, { int i; const char **my_names; - enum SID_NAME_USE *my_types; + enum lsa_SidType *my_types; TALLOC_CTX *tmp_ctx; if (!(tmp_ctx = talloc_init("wb_lookup_rids"))) { @@ -435,12 +435,12 @@ static BOOL wb_lookup_rids(TALLOC_CTX *mem_ctx, static BOOL lookup_rids(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, int num_rids, uint32_t *rids, const char **domain_name, - const char ***names, enum SID_NAME_USE **types) + const char ***names, enum lsa_SidType **types) { int i; *names = TALLOC_ARRAY(mem_ctx, const char *, num_rids); - *types = TALLOC_ARRAY(mem_ctx, enum SID_NAME_USE, num_rids); + *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); if ((*names == NULL) || (*types == NULL)) { return False; @@ -549,7 +549,7 @@ static BOOL lookup_as_domain(const DOM_SID *sid, TALLOC_CTX *mem_ctx, const char **name) { const char *tmp; - enum SID_NAME_USE type; + enum lsa_SidType type; if (sid_check_is_domain(sid)) { *name = talloc_strdup(mem_ctx, get_global_sam_name()); @@ -809,7 +809,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids, uint32_t *rids; const char *domain_name = NULL; const char **names; - enum SID_NAME_USE *types; + enum lsa_SidType *types; struct lsa_dom_info *dom = &dom_infos[i]; if (!dom->valid) { @@ -871,7 +871,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids, BOOL lookup_sid(TALLOC_CTX *mem_ctx, const DOM_SID *sid, const char **ret_domain, const char **ret_name, - enum SID_NAME_USE *ret_type) + enum lsa_SidType *ret_type) { struct lsa_dom_info *domain; struct lsa_name_info *name; @@ -941,14 +941,14 @@ static struct uid_sid_cache { struct uid_sid_cache *next, *prev; uid_t uid; DOM_SID sid; - enum SID_NAME_USE sidtype; + enum lsa_SidType sidtype; } *uid_sid_cache_head; static struct gid_sid_cache { struct gid_sid_cache *next, *prev; gid_t gid; DOM_SID sid; - enum SID_NAME_USE sidtype; + enum lsa_SidType sidtype; } *gid_sid_cache_head; /***************************************************************** @@ -1206,7 +1206,7 @@ void gid_to_sid(DOM_SID *psid, gid_t gid) BOOL sid_to_uid(const DOM_SID *psid, uid_t *puid) { - enum SID_NAME_USE type; + enum lsa_SidType type; uint32 rid; gid_t gid; @@ -1288,7 +1288,7 @@ BOOL sid_to_gid(const DOM_SID *psid, gid_t *pgid) uint32 rid; GROUP_MAP map; union unid_t id; - enum SID_NAME_USE type; + enum lsa_SidType type; uid_t uid; if (fetch_gid_from_cache(pgid, psid)) diff --git a/source/passdb/passdb.c b/source/passdb/passdb.c index 8229139093a..444262a59d7 100644 --- a/source/passdb/passdb.c +++ b/source/passdb/passdb.c @@ -551,7 +551,7 @@ BOOL algorithmic_pdb_rid_is_user(uint32 rid) ********************************************************************/ BOOL lookup_global_sam_name(const char *user, int flags, uint32_t *rid, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { GROUP_MAP map; BOOL ret; diff --git a/source/passdb/pdb_get_set.c b/source/passdb/pdb_get_set.c index 0b58fe09efa..7264faa06c8 100644 --- a/source/passdb/pdb_get_set.c +++ b/source/passdb/pdb_get_set.c @@ -213,7 +213,7 @@ const DOM_SID *pdb_get_group_sid(struct samu *sampass) } if ( pdb_gid_to_sid(pwd->pw_gid, gsid) ) { - enum SID_NAME_USE type = SID_NAME_UNKNOWN; + enum lsa_SidType type = SID_NAME_UNKNOWN; TALLOC_CTX *mem_ctx = talloc_init("pdb_get_group_sid"); BOOL lookup_ret; diff --git a/source/passdb/pdb_interface.c b/source/passdb/pdb_interface.c index ffe4713866f..4fe26636775 100644 --- a/source/passdb/pdb_interface.c +++ b/source/passdb/pdb_interface.c @@ -46,7 +46,7 @@ static void lazy_initialize_passdb(void) static BOOL lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name, - enum SID_NAME_USE *psid_name_use, + enum lsa_SidType *psid_name_use, union unid_t *unix_id); NTSTATUS smb_register_passdb(int version, const char *name, pdb_init_function init) @@ -663,7 +663,7 @@ NTSTATUS pdb_delete_group_mapping_entry(DOM_SID sid) return pdb->delete_group_mapping_entry(pdb, sid); } -BOOL pdb_enum_group_mapping(const DOM_SID *sid, enum SID_NAME_USE sid_name_use, GROUP_MAP **pp_rmap, +BOOL pdb_enum_group_mapping(const DOM_SID *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, size_t *p_num_entries, BOOL unix_only) { struct pdb_methods *pdb = pdb_get_methods(); @@ -1002,7 +1002,7 @@ BOOL pdb_gid_to_sid(gid_t gid, DOM_SID *sid) } BOOL pdb_sid_to_id(const DOM_SID *sid, union unid_t *id, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { struct pdb_methods *pdb = pdb_get_methods(); return pdb->sid_to_id(pdb, sid, id, type); @@ -1025,7 +1025,7 @@ BOOL pdb_new_rid(uint32 *rid) { struct pdb_methods *pdb = pdb_get_methods(); const char *name = NULL; - enum SID_NAME_USE type; + enum lsa_SidType type; uint32 allocated_rid = 0; int i; TALLOC_CTX *ctx; @@ -1220,7 +1220,7 @@ static BOOL pdb_default_gid_to_sid(struct pdb_methods *methods, gid_t gid, static BOOL pdb_default_sid_to_id(struct pdb_methods *methods, const DOM_SID *sid, - union unid_t *id, enum SID_NAME_USE *type) + union unid_t *id, enum lsa_SidType *type) { TALLOC_CTX *mem_ctx; BOOL ret = False; @@ -1434,7 +1434,7 @@ NTSTATUS pdb_default_enum_group_memberships(struct pdb_methods *methods, static BOOL lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32 rid, const char **name, - enum SID_NAME_USE *psid_name_use, + enum lsa_SidType *psid_name_use, union unid_t *unix_id) { struct samu *sam_account = NULL; @@ -1805,7 +1805,7 @@ static void search_end_groups(struct pdb_search *search) } static BOOL pdb_search_grouptype(struct pdb_search *search, - const DOM_SID *sid, enum SID_NAME_USE type) + const DOM_SID *sid, enum lsa_SidType type) { struct group_search *state; diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c index 54c250033dd..ebb4af66337 100644 --- a/source/passdb/pdb_ldap.c +++ b/source/passdb/pdb_ldap.c @@ -2159,7 +2159,7 @@ static BOOL init_group_from_ldap(struct ldapsam_privates *ldap_state, get_attr_key2string( groupmap_attr_list, LDAP_ATTR_GROUP_TYPE))); return False; } - map->sid_name_use = (enum SID_NAME_USE)atol(temp); + map->sid_name_use = (enum lsa_SidType)atol(temp); if ((map->sid_name_use < SID_NAME_USER) || (map->sid_name_use > SID_NAME_UNKNOWN)) { @@ -3107,7 +3107,7 @@ static NTSTATUS ldapsam_getsamgrent(struct pdb_methods *my_methods, *********************************************************************/ static NTSTATUS ldapsam_enum_group_mapping(struct pdb_methods *methods, - const DOM_SID *domsid, enum SID_NAME_USE sid_name_use, + const DOM_SID *domsid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, size_t *p_num_entries, BOOL unix_only) @@ -3169,7 +3169,7 @@ static NTSTATUS ldapsam_modify_aliasmem(struct pdb_methods *methods, int count; LDAPMod **mods = NULL; int rc; - enum SID_NAME_USE type = SID_NAME_USE_NONE; + enum lsa_SidType type = SID_NAME_USE_NONE; pstring filter; @@ -3281,7 +3281,7 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods, int i; pstring filter; size_t num_members = 0; - enum SID_NAME_USE type = SID_NAME_USE_NONE; + enum lsa_SidType type = SID_NAME_USE_NONE; *pp_members = NULL; *p_num_members = 0; @@ -3380,7 +3380,7 @@ static NTSTATUS ldapsam_alias_memberships(struct pdb_methods *methods, int i; int rc; char *filter; - enum SID_NAME_USE type = SID_NAME_USE_NONE; + enum lsa_SidType type = SID_NAME_USE_NONE; if (sid_check_is_builtin(domain_sid)) { type = SID_NAME_ALIAS; @@ -3802,7 +3802,7 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods, uint32 rid; int rid_index; const char *attr; - enum SID_NAME_USE type; + enum lsa_SidType type; const char *dn = smbldap_talloc_dn(mem_ctx, ld, entry); attr = smbldap_talloc_single_attribute(ld, entry, "sambaGroupType", @@ -4329,7 +4329,7 @@ static BOOL ldapgroup2displayentry(struct ldap_search_state *state, static BOOL ldapsam_search_grouptype(struct pdb_methods *methods, struct pdb_search *search, const DOM_SID *sid, - enum SID_NAME_USE type) + enum lsa_SidType type) { struct ldapsam_privates *ldap_state = methods->private_data; struct ldap_search_state *state; @@ -4515,7 +4515,7 @@ static BOOL ldapsam_new_rid(struct pdb_methods *methods, uint32 *rid) static BOOL ldapsam_sid_to_id(struct pdb_methods *methods, const DOM_SID *sid, - union unid_t *id, enum SID_NAME_USE *type) + union unid_t *id, enum lsa_SidType *type) { struct ldapsam_privates *priv = methods->private_data; char *filter; diff --git a/source/passdb/secrets.c b/source/passdb/secrets.c index 0a147c30dcc..c9f3217225e 100644 --- a/source/passdb/secrets.c +++ b/source/passdb/secrets.c @@ -158,39 +158,39 @@ BOOL secrets_fetch_domain_sid(const char *domain, DOM_SID *sid) return True; } -BOOL secrets_store_domain_guid(const char *domain, struct uuid *guid) +BOOL secrets_store_domain_guid(const char *domain, struct GUID *guid) { fstring key; slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_GUID, domain); strupper_m(key); - return secrets_store(key, guid, sizeof(struct uuid)); + return secrets_store(key, guid, sizeof(struct GUID)); } -BOOL secrets_fetch_domain_guid(const char *domain, struct uuid *guid) +BOOL secrets_fetch_domain_guid(const char *domain, struct GUID *guid) { - struct uuid *dyn_guid; + struct GUID *dyn_guid; fstring key; size_t size = 0; - struct uuid new_guid; + struct GUID new_guid; slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_GUID, domain); strupper_m(key); - dyn_guid = (struct uuid *)secrets_fetch(key, &size); + dyn_guid = (struct GUID *)secrets_fetch(key, &size); if (!dyn_guid) { if (lp_server_role() == ROLE_DOMAIN_PDC) { smb_uuid_generate_random(&new_guid); if (!secrets_store_domain_guid(domain, &new_guid)) return False; - dyn_guid = (struct uuid *)secrets_fetch(key, &size); + dyn_guid = (struct GUID *)secrets_fetch(key, &size); } if (dyn_guid == NULL) { return False; } } - if (size != sizeof(struct uuid)) { + if (size != sizeof(struct GUID)) { DEBUG(1,("UUID size %d is wrong!\n", (int)size)); SAFE_FREE(dyn_guid); return False; diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c index 8026ee3e8a0..427ed37229e 100644 --- a/source/printing/nt_printing.c +++ b/source/printing/nt_printing.c @@ -3000,7 +3000,7 @@ static BOOL map_nt_printer_info2_to_dsspooler(NT_PRINTER_INFO_LEVEL_2 *info2) } static void store_printer_guid(NT_PRINTER_INFO_LEVEL_2 *info2, - struct uuid guid) + struct GUID guid) { int i; REGVAL_CTR *ctr=NULL; @@ -3012,7 +3012,7 @@ static void store_printer_guid(NT_PRINTER_INFO_LEVEL_2 *info2, regval_ctr_delvalue(ctr, "objectGUID"); regval_ctr_addvalue(ctr, "objectGUID", REG_BINARY, - (char *) &guid, sizeof(struct uuid)); + (char *) &guid, sizeof(struct GUID)); } static WERROR nt_printer_publish_ads(ADS_STRUCT *ads, @@ -3025,7 +3025,7 @@ static WERROR nt_printer_publish_ads(ADS_STRUCT *ads, TALLOC_CTX *ctx; ADS_MODLIST mods; const char *attrs[] = {"objectGUID", NULL}; - struct uuid guid; + struct GUID guid; WERROR win_rc = WERR_OK; DEBUG(5, ("publishing printer %s\n", printer->info_2->printername)); @@ -3262,7 +3262,7 @@ WERROR check_published_printers(void) } BOOL is_printer_published(Printer_entry *print_hnd, int snum, - struct uuid *guid) + struct GUID *guid) { NT_PRINTER_INFO_LEVEL *printer = NULL; REGVAL_CTR *ctr; @@ -3283,8 +3283,8 @@ BOOL is_printer_published(Printer_entry *print_hnd, int snum, } /* fetching printer guids really ought to be a separate function.. */ - if (guid && regval_size(guid_val) == sizeof(struct uuid)) - memcpy(guid, regval_data_p(guid_val), sizeof(struct uuid)); + if (guid && regval_size(guid_val) == sizeof(struct GUID)) + memcpy(guid, regval_data_p(guid_val), sizeof(struct GUID)); free_a_printer(&printer, 2); return True; @@ -3301,7 +3301,7 @@ WERROR check_published_printers(void) } BOOL is_printer_published(Printer_entry *print_hnd, int snum, - struct uuid *guid) + struct GUID *guid) { return False; } diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c index deb97724a0e..97d8326ede4 100644 --- a/source/rpc_client/cli_lsarpc.c +++ b/source/rpc_client/cli_lsarpc.c @@ -547,7 +547,7 @@ NTSTATUS rpccli_lsa_query_info_policy2(struct rpc_pipe_client *cli, POLICY_HND *pol, uint16 info_class, char **domain_name, char **dns_name, char **forest_name, - struct uuid **domain_guid, + struct GUID **domain_guid, DOM_SID **domain_sid) { prs_struct qbuf, rbuf; @@ -606,13 +606,13 @@ NTSTATUS rpccli_lsa_query_info_policy2(struct rpc_pipe_client *cli, } if (domain_guid) { - *domain_guid = TALLOC_P(mem_ctx, struct uuid); + *domain_guid = TALLOC_P(mem_ctx, struct GUID); if (!*domain_guid) { return NT_STATUS_NO_MEMORY; } memcpy(*domain_guid, &r.ctr.info.id12.dom_guid, - sizeof(struct uuid)); + sizeof(struct GUID)); } if (domain_sid && r.ctr.info.id12.ptr_dom_sid != 0) { diff --git a/source/rpc_client/cli_netlogon.c b/source/rpc_client/cli_netlogon.c index 3a892cb7f4e..7213b9096b4 100644 --- a/source/rpc_client/cli_netlogon.c +++ b/source/rpc_client/cli_netlogon.c @@ -424,12 +424,12 @@ WERROR rpccli_netlogon_dsr_getdcname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, const char *domain_name, - struct uuid *domain_guid, - struct uuid *site_guid, + struct GUID *domain_guid, + struct GUID *site_guid, uint32_t flags, char **dc_unc, char **dc_address, int32 *dc_address_type, - struct uuid *domain_guid_out, + struct GUID *domain_guid_out, char **domain_name_out, char **forest_name, uint32 *dc_flags, diff --git a/source/rpc_parse/parse_dfs.c b/source/rpc_parse/parse_dfs.c index fde3dc6e03a..e590aae0526 100644 --- a/source/rpc_parse/parse_dfs.c +++ b/source/rpc_parse/parse_dfs.c @@ -340,7 +340,7 @@ BOOL netdfs_io_dfs_Info3_d(const char *desc, NETDFS_DFS_INFO3 *v, prs_struct *ps return True; } -BOOL init_netdfs_dfs_Info4(NETDFS_DFS_INFO4 *v, const char *path, const char *comment, uint32 state, uint32 timeout, struct uuid guid, uint32 num_stores, NETDFS_DFS_STORAGEINFO **stores) +BOOL init_netdfs_dfs_Info4(NETDFS_DFS_INFO4 *v, const char *path, const char *comment, uint32 state, uint32 timeout, struct GUID guid, uint32 num_stores, NETDFS_DFS_STORAGEINFO **stores) { DEBUG(5,("init_netdfs_dfs_Info4\n")); diff --git a/source/rpc_parse/parse_misc.c b/source/rpc_parse/parse_misc.c index cb7c06eb459..8d7a423bb7b 100644 --- a/source/rpc_parse/parse_misc.c +++ b/source/rpc_parse/parse_misc.c @@ -288,10 +288,10 @@ BOOL smb_io_dom_sid2(const char *desc, DOM_SID2 *sid, prs_struct *ps, int depth) } /******************************************************************* - Reads or writes a struct uuid + Reads or writes a struct GUID ********************************************************************/ -BOOL smb_io_uuid(const char *desc, struct uuid *uuid, +BOOL smb_io_uuid(const char *desc, struct GUID *uuid, prs_struct *ps, int depth) { if (uuid == NULL) @@ -518,7 +518,7 @@ BOOL smb_io_unistr(const char *desc, UNISTR *uni, prs_struct *ps, int depth) size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len) { - str->buffer = TALLOC_ZERO(get_talloc_ctx(), len); + str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len); if (str->buffer == NULL) smb_panic("create_rpc_blob: talloc fail\n"); return len; @@ -617,7 +617,8 @@ void init_regval_buffer(REGVAL_BUFFER *str, const uint8 *buf, size_t len) if (buf != NULL) { SMB_ASSERT(str->buf_max_len >= str->buf_len); - str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->buf_max_len); + str->buffer = (uint16 *)TALLOC_ZERO(get_talloc_ctx(), + str->buf_max_len); if (str->buffer == NULL) smb_panic("init_regval_buffer: talloc fail\n"); memcpy(str->buffer, buf, str->buf_len); @@ -723,7 +724,8 @@ void init_string2(STRING2 *str, const char *buf, size_t max_len, size_t str_len) /* store the string */ if(str_len != 0) { - str->buffer = TALLOC_ZERO(get_talloc_ctx(), str->str_max_len); + str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), + str->str_max_len); if (str->buffer == NULL) smb_panic("init_string2: malloc fail\n"); memcpy(str->buffer, buf, str_len); @@ -1690,15 +1692,9 @@ BOOL smb_io_pol_hnd(const char *desc, POLICY_HND *pol, prs_struct *ps, int depth if(UNMARSHALLING(ps)) ZERO_STRUCTP(pol); - if (!prs_uint32("data1", ps, depth, &pol->data1)) + if (!prs_uint32("handle_type", ps, depth, &pol->handle_type)) return False; - if (!prs_uint32("data2", ps, depth, &pol->data2)) - return False; - if (!prs_uint16("data3", ps, depth, &pol->data3)) - return False; - if (!prs_uint16("data4", ps, depth, &pol->data4)) - return False; - if(!prs_uint8s (False, "data5", ps, depth, pol->data5, sizeof(pol->data5))) + if (!smb_io_uuid("uuid", (struct GUID*)&pol->uuid, ps, depth)) return False; return True; diff --git a/source/rpc_parse/parse_net.c b/source/rpc_parse/parse_net.c index bc6b32e6ead..d0dbbf1c383 100644 --- a/source/rpc_parse/parse_net.c +++ b/source/rpc_parse/parse_net.c @@ -3233,8 +3233,8 @@ BOOL net_io_r_sam_deltas(const char *desc, void init_net_q_dsr_getdcname(NET_Q_DSR_GETDCNAME *r_t, const char *server_unc, const char *domain_name, - struct uuid *domain_guid, - struct uuid *site_guid, + struct GUID *domain_guid, + struct GUID *site_guid, uint32_t flags) { DEBUG(5, ("init_net_q_dsr_getdcname\n")); @@ -3291,7 +3291,7 @@ BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, return False; if (UNMARSHALLING(ps) && (r_t->ptr_domain_guid)) { - r_t->domain_guid = PRS_ALLOC_MEM(ps, struct uuid, 1); + r_t->domain_guid = PRS_ALLOC_MEM(ps, struct GUID, 1); if (r_t->domain_guid == NULL) return False; } @@ -3307,7 +3307,7 @@ BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, return False; if (UNMARSHALLING(ps) && (r_t->ptr_site_guid)) { - r_t->site_guid = PRS_ALLOC_MEM(ps, struct uuid, 1); + r_t->site_guid = PRS_ALLOC_MEM(ps, struct GUID, 1); if (r_t->site_guid == NULL) return False; } @@ -3330,7 +3330,7 @@ BOOL net_io_q_dsr_getdcname(const char *desc, NET_Q_DSR_GETDCNAME *r_t, ********************************************************************/ void init_net_r_dsr_getdcname(NET_R_DSR_GETDCNAME *r_t, const char *dc_unc, const char *dc_address, int32 dc_address_type, - struct uuid domain_guid, const char *domain_name, + struct GUID domain_guid, const char *domain_name, const char *forest_name, uint32 dc_flags, const char *dc_site_name, const char *client_site_name) diff --git a/source/rpc_parse/parse_samr.c b/source/rpc_parse/parse_samr.c index 6a36a9119a2..4198bf571c9 100644 --- a/source/rpc_parse/parse_samr.c +++ b/source/rpc_parse/parse_samr.c @@ -4890,7 +4890,7 @@ inits a SAMR_R_LOOKUP_NAMES structure. NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, uint32 num_rids, - uint32 *rid, enum SID_NAME_USE *type, + uint32 *rid, enum lsa_SidType *type, NTSTATUS status) { DEBUG(5, ("init_samr_r_lookup_names\n")); diff --git a/source/rpc_server/srv_lsa_hnd.c b/source/rpc_server/srv_lsa_hnd.c index 7da87d5b93d..88c59ee8952 100644 --- a/source/rpc_server/srv_lsa_hnd.c +++ b/source/rpc_server/srv_lsa_hnd.c @@ -103,6 +103,7 @@ BOOL create_policy_hnd(pipes_struct *p, POLICY_HND *hnd, void (*free_fn)(void *) { static uint32 pol_hnd_low = 0; static uint32 pol_hnd_high = 0; + time_t t = time(NULL); struct policy *pol; @@ -127,12 +128,17 @@ BOOL create_policy_hnd(pipes_struct *p, POLICY_HND *hnd, void (*free_fn)(void *) if (pol_hnd_low == 0) (pol_hnd_high)++; - SIVAL(&pol->pol_hnd.data1, 0 , 0); /* first bit must be null */ - SIVAL(&pol->pol_hnd.data2, 0 , pol_hnd_low ); /* second bit is incrementing */ - SSVAL(&pol->pol_hnd.data3, 0 , pol_hnd_high); /* second bit is incrementing */ - SSVAL(&pol->pol_hnd.data4, 0 , (pol_hnd_high>>16)); /* second bit is incrementing */ - SIVAL(pol->pol_hnd.data5, 0, time(NULL)); /* something random */ - SIVAL(pol->pol_hnd.data5, 4, sys_getpid()); /* something more random */ + SIVAL(&pol->pol_hnd.handle_type, 0 , 0); /* first bit must be null */ + SIVAL(&pol->pol_hnd.uuid.time_low, 0 , pol_hnd_low ); /* second bit is incrementing */ + SSVAL(&pol->pol_hnd.uuid.time_mid, 0 , pol_hnd_high); /* second bit is incrementing */ + SSVAL(&pol->pol_hnd.uuid.time_hi_and_version, 0 , (pol_hnd_high>>16)); /* second bit is incrementing */ + + /* split the current time into two 16 bit values */ + + SSVAL(pol->pol_hnd.uuid.clock_seq, 0, (t>>16)); /* something random */ + SSVAL(pol->pol_hnd.uuid.node, 0, t); /* something random */ + + SIVAL(pol->pol_hnd.uuid.node, 2, sys_getpid()); /* something more random */ DLIST_ADD(p->pipe_handles->Policy, pol); p->pipe_handles->count++; diff --git a/source/rpc_server/srv_lsa_nt.c b/source/rpc_server/srv_lsa_nt.c index 010c35e3fff..3e39b2fd831 100644 --- a/source/rpc_server/srv_lsa_nt.c +++ b/source/rpc_server/srv_lsa_nt.c @@ -164,7 +164,7 @@ static NTSTATUS lookup_lsa_rids(TALLOC_CTX *mem_ctx, int dom_idx; char *full_name; const char *domain; - enum SID_NAME_USE type = SID_NAME_UNKNOWN; + enum lsa_SidType type = SID_NAME_UNKNOWN; /* Split name into domain and user component */ @@ -239,7 +239,7 @@ static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx, int dom_idx; char *full_name; const char *domain; - enum SID_NAME_USE type = SID_NAME_UNKNOWN; + enum lsa_SidType type = SID_NAME_UNKNOWN; /* Split name into domain and user component */ @@ -487,7 +487,7 @@ static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *s static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name, const char *dns_name, const char *forest_name, - struct uuid *dom_guid, DOM_SID *dom_sid) + struct GUID *dom_guid, DOM_SID *dom_sid) { if (nb_name && *nb_name) { init_unistr2(&r_l->uni_nb_dom_name, nb_name, UNI_FLAGS_NONE); @@ -512,7 +512,7 @@ static void init_dns_dom_info(LSA_DNS_DOM_INFO *r_l, const char *nb_name, /* how do we init the guid ? probably should write an init fn */ if (dom_guid) { - memcpy(&r_l->dom_guid, dom_guid, sizeof(struct uuid)); + memcpy(&r_l->dom_guid, dom_guid, sizeof(struct GUID)); } if (dom_sid) { @@ -1866,7 +1866,7 @@ NTSTATUS _lsa_query_info2(pipes_struct *p, LSA_Q_QUERY_INFO2 *q_u, LSA_R_QUERY_I char *dns_name = NULL; char *forest_name = NULL; DOM_SID *sid = NULL; - struct uuid guid; + struct GUID guid; fstring dnsdomname; ZERO_STRUCT(guid); diff --git a/source/rpc_server/srv_pipe.c b/source/rpc_server/srv_pipe.c index b4787f652df..db1c3fea0e5 100644 --- a/source/rpc_server/srv_pipe.c +++ b/source/rpc_server/srv_pipe.c @@ -990,9 +990,9 @@ BOOL check_bind_req(struct pipes_struct *p, RPC_IFACE* abstract, DEBUG(10,("checking %s\n", pipe_names[i].client_pipe)); if ( strequal(pipe_names[i].client_pipe, pname) && (abstract->version == pipe_names[i].abstr_syntax.version) - && (memcmp(&abstract->uuid, &pipe_names[i].abstr_syntax.uuid, sizeof(struct uuid)) == 0) + && (memcmp(&abstract->uuid, &pipe_names[i].abstr_syntax.uuid, sizeof(struct GUID)) == 0) && (transfer->version == pipe_names[i].trans_syntax.version) - && (memcmp(&transfer->uuid, &pipe_names[i].trans_syntax.uuid, sizeof(struct uuid)) == 0) ) { + && (memcmp(&transfer->uuid, &pipe_names[i].trans_syntax.uuid, sizeof(struct GUID)) == 0) ) { struct api_struct *fns = NULL; int n_fns = 0; PIPE_RPC_FNS *context_fns; diff --git a/source/rpc_server/srv_reg_nt.c b/source/rpc_server/srv_reg_nt.c index 8fd0e55c547..3728252c993 100644 --- a/source/rpc_server/srv_reg_nt.c +++ b/source/rpc_server/srv_reg_nt.c @@ -30,9 +30,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -#define OUR_HANDLE(hnd) (((hnd)==NULL)?"NULL":(IVAL((hnd)->data5,4)==(uint32)sys_getpid()?"OURS":"OTHER")), \ -((unsigned int)IVAL((hnd)->data5,4)),((unsigned int)sys_getpid()) - static struct generic_mapping reg_generic_map = { REG_KEY_READ, REG_KEY_WRITE, REG_KEY_EXECUTE, REG_KEY_ALL }; diff --git a/source/rpc_server/srv_samr_nt.c b/source/rpc_server/srv_samr_nt.c index 900da112944..42e2550786d 100644 --- a/source/rpc_server/srv_samr_nt.c +++ b/source/rpc_server/srv_samr_nt.c @@ -1471,7 +1471,7 @@ NTSTATUS _samr_query_aliasinfo(pipes_struct *p, SAMR_Q_QUERY_ALIASINFO *q_u, SAM NTSTATUS _samr_lookup_names(pipes_struct *p, SAMR_Q_LOOKUP_NAMES *q_u, SAMR_R_LOOKUP_NAMES *r_u) { uint32 rid[MAX_SAM_ENTRIES]; - enum SID_NAME_USE type[MAX_SAM_ENTRIES]; + enum lsa_SidType type[MAX_SAM_ENTRIES]; int i; int num_rids = q_u->num_names2; DOM_SID pol_sid; @@ -1712,7 +1712,7 @@ static BOOL make_samr_lookup_rids(TALLOC_CTX *ctx, uint32 num_names, NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOKUP_RIDS *r_u) { const char **names; - enum SID_NAME_USE *attrs = NULL; + enum lsa_SidType *attrs = NULL; uint32 *wire_attrs = NULL; UNIHDR *hdr_name = NULL; UNISTR2 *uni_name = NULL; @@ -1736,7 +1736,7 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK } names = TALLOC_ZERO_ARRAY(p->mem_ctx, const char *, num_rids); - attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, enum SID_NAME_USE, num_rids); + attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, enum lsa_SidType, num_rids); wire_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, uint32, num_rids); if ((num_rids != 0) && ((names == NULL) || (attrs == NULL) || (wire_attrs==NULL))) @@ -1755,7 +1755,7 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK &hdr_name, &uni_name)) return NT_STATUS_NO_MEMORY; - /* Convert from enum SID_NAME_USE to uint32 for wire format. */ + /* Convert from enum lsa_SidType to uint32 for wire format. */ for (i = 0; i < num_rids; i++) { wire_attrs[i] = (uint32)attrs[i]; } @@ -2485,7 +2485,7 @@ NTSTATUS _samr_query_domain_info(pipes_struct *p, static NTSTATUS can_create(TALLOC_CTX *mem_ctx, const char *new_name) { - enum SID_NAME_USE type; + enum lsa_SidType type; BOOL result; DEBUG(10, ("Checking whether [%s] can be created\n", new_name)); @@ -3027,7 +3027,7 @@ NTSTATUS _samr_open_alias(pipes_struct *p, SAMR_Q_OPEN_ALIAS *q_u, SAMR_R_OPEN_A { /* Check we actually have the requested alias */ - enum SID_NAME_USE type; + enum lsa_SidType type; BOOL result; gid_t gid; diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c index ffe7f39ebe1..d9b34fe4e91 100644 --- a/source/rpc_server/srv_spoolss_nt.c +++ b/source/rpc_server/srv_spoolss_nt.c @@ -66,10 +66,6 @@ static uint32 smb_connections=0; extern STANDARD_MAPPING printer_std_mapping, printserver_std_mapping; -#define OUR_HANDLE(hnd) (((hnd)==NULL)?"NULL":(IVAL((hnd)->data5,4)==(uint32)sys_getpid()?"OURS":"OTHER")), \ -((unsigned int)IVAL((hnd)->data5,4)),((unsigned int)sys_getpid()) - - /* API table for Xcv Monitor functions */ struct xcv_api_table { @@ -4275,7 +4271,7 @@ static BOOL construct_printer_info_5(Printer_entry *print_hnd, PRINTER_INFO_5 *p static BOOL construct_printer_info_7(Printer_entry *print_hnd, PRINTER_INFO_7 *printer, int snum) { char *guid_str = NULL; - struct uuid guid; + struct GUID guid; if (is_printer_published(print_hnd, snum, &guid)) { asprintf(&guid_str, "{%s}", smb_uuid_string_static(guid)); diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c index d94572bc767..9e7e19080ec 100644 --- a/source/smbd/lanman.c +++ b/source/smbd/lanman.c @@ -1965,7 +1965,7 @@ static BOOL api_NetUserGetGroups(connection_struct *conn,uint16 vuid, char *para size_t i; NTSTATUS result; DOM_SID user_sid; - enum SID_NAME_USE type; + enum lsa_SidType type; TALLOC_CTX *mem_ctx; *rparam_len = 8; diff --git a/source/smbd/service.c b/source/smbd/service.c index ed70f32cfe8..13f7f7866ad 100644 --- a/source/smbd/service.c +++ b/source/smbd/service.c @@ -426,7 +426,7 @@ static NTSTATUS find_forced_group(BOOL force_user, NTSTATUS result = NT_STATUS_NO_SUCH_GROUP; TALLOC_CTX *mem_ctx; DOM_SID group_sid; - enum SID_NAME_USE type; + enum lsa_SidType type; char *groupname; BOOL user_must_be_member = False; gid_t gid; diff --git a/source/smbd/share_access.c b/source/smbd/share_access.c index a8a54123318..3bc442f1baf 100644 --- a/source/smbd/share_access.c +++ b/source/smbd/share_access.c @@ -71,7 +71,7 @@ static BOOL token_contains_name(TALLOC_CTX *mem_ctx, { const char *prefix; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; if (username != NULL) { name = talloc_sub_basic(mem_ctx, username, name); diff --git a/source/utils/net_groupmap.c b/source/utils/net_groupmap.c index 10a672bc1f0..64156844119 100644 --- a/source/utils/net_groupmap.c +++ b/source/utils/net_groupmap.c @@ -188,7 +188,7 @@ static int net_groupmap_add(int argc, const char **argv) fstring string_sid = ""; fstring type = ""; fstring ntcomment = ""; - enum SID_NAME_USE sid_type = SID_NAME_DOM_GRP; + enum lsa_SidType sid_type = SID_NAME_DOM_GRP; uint32 rid = 0; gid_t gid; int i; @@ -338,7 +338,7 @@ static int net_groupmap_modify(int argc, const char **argv) fstring ntgroup = ""; fstring unixgrp = ""; fstring sid_string = ""; - enum SID_NAME_USE sid_type = SID_NAME_UNKNOWN; + enum lsa_SidType sid_type = SID_NAME_UNKNOWN; int i; gid_t gid; diff --git a/source/utils/net_lookup.c b/source/utils/net_lookup.c index 9d593bcf54d..b768089fff5 100644 --- a/source/utils/net_lookup.c +++ b/source/utils/net_lookup.c @@ -247,7 +247,7 @@ static int net_lookup_name(int argc, const char **argv) { const char *dom, *name; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; if (argc != 1) { d_printf("usage: net lookup name \n"); @@ -269,7 +269,7 @@ static int net_lookup_sid(int argc, const char **argv) { const char *dom, *name; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; if (argc != 1) { d_printf("usage: net lookup sid \n"); diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c index 190992e3741..7595428e246 100644 --- a/source/utils/net_rpc.c +++ b/source/utils/net_rpc.c @@ -1330,7 +1330,7 @@ static NTSTATUS rpc_sh_handle_user(TALLOC_CTX *mem_ctx, NTSTATUS result = NT_STATUS_UNSUCCESSFUL; DOM_SID sid; uint32 rid; - enum SID_NAME_USE type; + enum lsa_SidType type; if (argc == 0) { d_fprintf(stderr, "usage: %s \n", ctx->whoami); @@ -2008,7 +2008,7 @@ static NTSTATUS get_sid_from_name(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *name, DOM_SID *sid, - enum SID_NAME_USE *type) + enum lsa_SidType *type) { DOM_SID *sids = NULL; uint32 *types = NULL; @@ -2131,7 +2131,7 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd, POLICY_HND alias_pol; DOM_SID member_sid; - enum SID_NAME_USE member_type; + enum lsa_SidType member_type; DOM_SID sid; @@ -2192,7 +2192,7 @@ static NTSTATUS rpc_group_addmem_internals(const DOM_SID *domain_sid, const char **argv) { DOM_SID group_sid; - enum SID_NAME_USE group_type; + enum lsa_SidType group_type; if (argc != 2) { d_printf("Usage: 'net rpc group addmem \n"); @@ -2308,7 +2308,7 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd, POLICY_HND alias_pol; DOM_SID member_sid; - enum SID_NAME_USE member_type; + enum lsa_SidType member_type; DOM_SID sid; @@ -2366,7 +2366,7 @@ static NTSTATUS rpc_group_delmem_internals(const DOM_SID *domain_sid, const char **argv) { DOM_SID group_sid; - enum SID_NAME_USE group_type; + enum lsa_SidType group_type; if (argc != 2) { d_printf("Usage: 'net rpc group delmem \n"); diff --git a/source/utils/net_sam.c b/source/utils/net_sam.c index 654c9ec5b2a..9edbc7b8cf4 100644 --- a/source/utils/net_sam.c +++ b/source/utils/net_sam.c @@ -32,7 +32,7 @@ static int net_sam_userset(int argc, const char **argv, const char *field, { struct samu *sam_acct = NULL; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; const char *dom, *name; NTSTATUS status; @@ -127,7 +127,7 @@ static int net_sam_set_userflag(int argc, const char **argv, const char *field, { struct samu *sam_acct = NULL; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; const char *dom, *name; NTSTATUS status; uint16 acct_flags; @@ -215,7 +215,7 @@ static int net_sam_set_time(int argc, const char **argv, const char *field, { struct samu *sam_acct = NULL; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; const char *dom, *name; NTSTATUS status; time_t new_time; @@ -302,7 +302,7 @@ static int net_sam_set_comment(int argc, const char **argv) { GROUP_MAP map; DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; const char *dom, *name; NTSTATUS status; @@ -462,7 +462,7 @@ static int net_sam_createbuiltingroup(int argc, const char **argv) { NTSTATUS status; uint32 rid; - enum SID_NAME_USE type; + enum lsa_SidType type; fstring groupname; DOM_SID sid; @@ -514,7 +514,7 @@ static int net_sam_addmem(int argc, const char **argv) { const char *groupdomain, *groupname, *memberdomain, *membername; DOM_SID group, member; - enum SID_NAME_USE grouptype, membertype; + enum lsa_SidType grouptype, membertype; NTSTATUS status; if (argc != 2) { @@ -587,7 +587,7 @@ static int net_sam_delmem(int argc, const char **argv) const char *memberdomain = NULL; const char *membername = NULL; DOM_SID group, member; - enum SID_NAME_USE grouptype; + enum lsa_SidType grouptype; NTSTATUS status; if (argc != 2) { @@ -645,7 +645,7 @@ static int net_sam_listmem(int argc, const char **argv) { const char *groupdomain, *groupname; DOM_SID group; - enum SID_NAME_USE grouptype; + enum lsa_SidType grouptype; NTSTATUS status; if (argc != 1) { @@ -793,7 +793,7 @@ static int net_sam_list(int argc, const char **argv) static int net_sam_show(int argc, const char **argv) { DOM_SID sid; - enum SID_NAME_USE type; + enum lsa_SidType type; const char *dom, *name; if (argc != 1) { diff --git a/source/utils/net_util.c b/source/utils/net_util.c index 805104cefa1..d8becebf0dd 100644 --- a/source/utils/net_util.c +++ b/source/utils/net_util.c @@ -32,7 +32,7 @@ BOOL is_valid_policy_hnd(const POLICY_HND *hnd) NTSTATUS net_rpc_lookup_name(TALLOC_CTX *mem_ctx, struct cli_state *cli, const char *name, const char **ret_domain, const char **ret_name, DOM_SID *ret_sid, - enum SID_NAME_USE *ret_type) + enum lsa_SidType *ret_type) { struct rpc_pipe_client *lsa_pipe; POLICY_HND pol; -- 2.11.4.GIT