From 05fbe0c7f763fbe8c1c48eb82ebdfe04bfa034ea Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 12 Jun 2009 15:20:48 +0200 Subject: libds: merge the UF<->ACB flag mapping functions. Guenther --- source4/cldap_server/netlogon.c | 2 +- source4/dsdb/common/flag_mapping.c | 145 -------------------------------- source4/dsdb/common/sidmap.c | 4 +- source4/dsdb/common/util.c | 4 +- source4/dsdb/config.mk | 4 +- source4/dsdb/samdb/ldb_modules/samldb.c | 8 +- source4/rpc_server/lsa/lsa_lookup.c | 4 +- source4/rpc_server/samr/dcesrv_samr.c | 6 +- 8 files changed, 16 insertions(+), 161 deletions(-) delete mode 100644 source4/dsdb/common/flag_mapping.c (limited to 'source4') diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index 8a21ea55c9a..b1a46c3c312 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -189,7 +189,7 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx, "(!(userAccountControl:" LDB_OID_COMPARATOR_AND ":=%u))" "(userAccountControl:" LDB_OID_COMPARATOR_OR ":=%u))", ldb_binary_encode_string(mem_ctx, user), - UF_ACCOUNTDISABLE, samdb_acb2uf(acct_control)); + UF_ACCOUNTDISABLE, ds_acb2uf(acct_control)); if (ret != LDB_SUCCESS) { DEBUG(2,("Unable to find referece to user '%s' with ACB 0x%8x under %s: %s\n", user, acct_control, ldb_dn_get_linearized(dom_res->msgs[0]->dn), diff --git a/source4/dsdb/common/flag_mapping.c b/source4/dsdb/common/flag_mapping.c deleted file mode 100644 index af284c41e7b..00000000000 --- a/source4/dsdb/common/flag_mapping.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - Unix SMB/CIFS implementation. - helper mapping functions for the SAMDB server - - Copyright (C) Stefan (metze) Metzmacher 2002 - Copyright (C) Andrew Tridgell 2004 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include "includes.h" -#include "librpc/gen_ndr/samr.h" -#include "../libds/common/flags.h" -#include "lib/ldb/include/ldb.h" -#include "dsdb/common/proto.h" - -/* -translated the ACB_CTRL Flags to UserFlags (userAccountControl) -*/ -/* mapping between ADS userAccountControl and SAMR acct_flags */ -static const struct { - uint32_t uf; - uint32_t acb; -} acct_flags_map[] = { - { UF_ACCOUNTDISABLE, ACB_DISABLED }, - { UF_HOMEDIR_REQUIRED, ACB_HOMDIRREQ }, - { UF_PASSWD_NOTREQD, ACB_PWNOTREQ }, - { UF_TEMP_DUPLICATE_ACCOUNT, ACB_TEMPDUP }, - { UF_NORMAL_ACCOUNT, ACB_NORMAL }, - { UF_MNS_LOGON_ACCOUNT, ACB_MNS }, - { UF_INTERDOMAIN_TRUST_ACCOUNT, ACB_DOMTRUST }, - { UF_WORKSTATION_TRUST_ACCOUNT, ACB_WSTRUST }, - { UF_SERVER_TRUST_ACCOUNT, ACB_SVRTRUST }, - { UF_DONT_EXPIRE_PASSWD, ACB_PWNOEXP }, - { UF_LOCKOUT, ACB_AUTOLOCK }, - { UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED, ACB_ENC_TXT_PWD_ALLOWED }, - { UF_SMARTCARD_REQUIRED, ACB_SMARTCARD_REQUIRED }, - { UF_TRUSTED_FOR_DELEGATION, ACB_TRUSTED_FOR_DELEGATION }, - { UF_NOT_DELEGATED, ACB_NOT_DELEGATED }, - { UF_USE_DES_KEY_ONLY, ACB_USE_DES_KEY_ONLY}, - { UF_DONT_REQUIRE_PREAUTH, ACB_DONT_REQUIRE_PREAUTH }, - { UF_PASSWORD_EXPIRED, ACB_PW_EXPIRED }, - { UF_NO_AUTH_DATA_REQUIRED, ACB_NO_AUTH_DATA_REQD } -}; - -uint32_t samdb_acb2uf(uint32_t acb) -{ - uint32_t i, ret = 0; - for (i=0;imsg, ac->msg, "sAMAccountType", @@ -590,7 +590,7 @@ static int samldb_check_samAccountType(struct samldb_ctx *ac) "groupType invalid"); return LDB_ERR_UNWILLING_TO_PERFORM; } else { - account_type = samdb_gtype2atype(group_type); + account_type = ds_gtype2atype(group_type); ret = samdb_msg_add_uint(ldb, ac->msg, ac->msg, "sAMAccountType", @@ -1280,7 +1280,7 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req) req->op.mod.message = msg = ldb_msg_copy_shallow(req, req->op.mod.message); group_type = strtoul((const char *)el->values[0].data, NULL, 0); - account_type = samdb_gtype2atype(group_type); + account_type = ds_gtype2atype(group_type); ret = samdb_msg_add_uint(ldb, msg, msg, "sAMAccountType", account_type); @@ -1296,7 +1296,7 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req) req->op.mod.message = msg = ldb_msg_copy_shallow(req, req->op.mod.message); user_account_control = strtoul((const char *)el->values[0].data, NULL, 0); - account_type = samdb_uf2atype(user_account_control); + account_type = ds_uf2atype(user_account_control); ret = samdb_msg_add_uint(ldb, msg, msg, "sAMAccountType", account_type); diff --git a/source4/rpc_server/lsa/lsa_lookup.c b/source4/rpc_server/lsa/lsa_lookup.c index dc47d3783ae..005c7d4f06b 100644 --- a/source4/rpc_server/lsa/lsa_lookup.c +++ b/source4/rpc_server/lsa/lsa_lookup.c @@ -394,7 +394,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct tevent_context *ev_ctx, atype = samdb_result_uint(res[i], "sAMAccountType", 0); - *rtype = samdb_atype_map(atype); + *rtype = ds_atype_map(atype); if (*rtype == SID_NAME_UNKNOWN) { return STATUS_SOME_UNMAPPED; } @@ -503,7 +503,7 @@ static NTSTATUS dcesrv_lsa_lookup_sid(struct lsa_policy_state *state, TALLOC_CTX atype = samdb_result_uint(res[0], "sAMAccountType", 0); - *rtype = samdb_atype_map(atype); + *rtype = ds_atype_map(atype); return NT_STATUS_OK; } diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index 489247c1d0f..c7556012304 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -1360,7 +1360,7 @@ static NTSTATUS dcesrv_samr_CreateUser2(struct dcesrv_call_state *dce_call, TALL UF_INTERDOMAIN_TRUST_ACCOUNT | UF_WORKSTATION_TRUST_ACCOUNT | UF_SERVER_TRUST_ACCOUNT)); - user_account_control |= samdb_acb2uf(r->in.acct_flags); + user_account_control |= ds_acb2uf(r->in.acct_flags); talloc_free(msg); msg = ldb_msg_new(mem_ctx); @@ -1876,7 +1876,7 @@ static NTSTATUS dcesrv_samr_LookupNames(struct dcesrv_call_state *dce_call, TALL continue; } - rtype = samdb_atype_map(atype); + rtype = ds_atype_map(atype); if (rtype == SID_NAME_UNKNOWN) { status = STATUS_SOME_UNMAPPED; @@ -1962,7 +1962,7 @@ static NTSTATUS dcesrv_samr_LookupRids(struct dcesrv_call_state *dce_call, TALLO continue; } - ids[i] = samdb_atype_map(atype); + ids[i] = ds_atype_map(atype); if (ids[i] == SID_NAME_UNKNOWN) { status = STATUS_SOME_UNMAPPED; -- cgit