From: Stefan Metzmacher Date: Wed, 6 Nov 2019 14:38:23 +0000 (+0100) Subject: krb5_wrap: move source3/libads/krb5_errs.c to lib/krb5_wrap/krb5_errs.c X-Git-Tag: ldb-2.1.1~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c403fa1a7fe6725957aab7e8039877d1becad8bf;p=thirdparty%2Fsamba.git krb5_wrap: move source3/libads/krb5_errs.c to lib/krb5_wrap/krb5_errs.c Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/source3/libads/krb5_errs.c b/lib/krb5_wrap/krb5_errs.c similarity index 98% rename from source3/libads/krb5_errs.c rename to lib/krb5_wrap/krb5_errs.c index 0c2ada59966..37428defe1e 100644 --- a/source3/libads/krb5_errs.c +++ b/lib/krb5_wrap/krb5_errs.c @@ -1,26 +1,24 @@ -/* +/* * Unix SMB/CIFS implementation. * Kerberos error mapping functions * Copyright (C) Guenther Deschner 2005 - * + * * 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 "smb_krb5.h" - -#include "krb5_errs.h" +#include "krb5_samba.h" #ifdef HAVE_KRB5 @@ -81,11 +79,11 @@ convert a KRB5 error to a NT status32 code NTSTATUS krb5_to_nt_status(krb5_error_code kerberos_error) { int i; - + if (kerberos_error == 0) { return NT_STATUS_OK; } - + for (i=0; NT_STATUS_V(krb5_to_nt_status_map[i].ntstatus); i++) { if (kerberos_error == krb5_to_nt_status_map[i].krb5_code) return krb5_to_nt_status_map[i].ntstatus; @@ -100,11 +98,11 @@ convert an NT status32 code to a KRB5 error krb5_error_code nt_status_to_krb5(NTSTATUS nt_status) { int i; - + if NT_STATUS_IS_OK(nt_status) { return 0; } - + for (i=0; NT_STATUS_V(nt_status_to_krb5_map[i].ntstatus); i++) { if (NT_STATUS_EQUAL(nt_status,nt_status_to_krb5_map[i].ntstatus)) return nt_status_to_krb5_map[i].krb5_code; @@ -114,4 +112,3 @@ convert an NT status32 code to a KRB5 error } #endif - diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h index 64ae0275dbd..ca9a893e4f7 100644 --- a/lib/krb5_wrap/krb5_samba.h +++ b/lib/krb5_wrap/krb5_samba.h @@ -406,4 +406,7 @@ int ads_krb5_cli_get_ticket(TALLOC_CTX *mem_ctx, time_t *tgs_expire, const char *impersonate_princ_s); +NTSTATUS krb5_to_nt_status(krb5_error_code kerberos_error); +krb5_error_code nt_status_to_krb5(NTSTATUS nt_status); + #endif /* _KRB5_SAMBA_H */ diff --git a/lib/krb5_wrap/wscript_build b/lib/krb5_wrap/wscript_build index 624964452af..dd9fc08fff7 100644 --- a/lib/krb5_wrap/wscript_build +++ b/lib/krb5_wrap/wscript_build @@ -5,7 +5,19 @@ if bld.CONFIG_SET('SAMBA4_USES_HEIMDAL'): add_deps = ' asn1' bld.SAMBA_LIBRARY('krb5samba', - source='krb5_samba.c gss_samba.c keytab_util.c enctype_convert.c', - deps='samba-util talloc krb5 com_err gssapi' + add_deps, + source=''' + krb5_samba.c + gss_samba.c + keytab_util.c + enctype_convert.c + krb5_errs.c + ''', + deps=''' + samba-util + talloc + krb5 + com_err + gssapi + ''' + add_deps, private_library=True ) diff --git a/source3/libads/ads_status.c b/source3/libads/ads_status.c index fb3646386ca..70569949aeb 100644 --- a/source3/libads/ads_status.c +++ b/source3/libads/ads_status.c @@ -25,7 +25,6 @@ #include "system/gssapi.h" #include "smb_ldap.h" #include "libads/ads_status.h" -#include "krb5_errs.h" /* build a ADS_STATUS structure diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c index 8d8c47fae4d..dd21d895fc2 100644 --- a/source3/libads/authdata.c +++ b/source3/libads/authdata.c @@ -32,7 +32,6 @@ #include "auth/gensec/gensec.h" #include "auth/gensec/gensec_internal.h" /* TODO: remove this */ #include "../libcli/auth/spnego.h" -#include "krb5_errs.h" #ifdef HAVE_KRB5 diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index 559ec3b7f53..5959da919b0 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -31,7 +31,6 @@ #include "secrets.h" #include "../lib/tsocket/tsocket.h" #include "lib/util/asn1.h" -#include "krb5_errs.h" #ifdef HAVE_KRB5 diff --git a/source3/libads/krb5_errs.h b/source3/libads/krb5_errs.h deleted file mode 100644 index 57b6391ff74..00000000000 --- a/source3/libads/krb5_errs.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Kerberos error mapping functions - * Copyright (C) Guenther Deschner 2005 - * - * 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 . - */ - -#ifndef __KRB5_ERRS_H__ -#define __KRB5_ERRS_H__ - -#include "replace.h" -#include "libcli/util/ntstatus.h" -#include - -NTSTATUS krb5_to_nt_status(krb5_error_code kerberos_error); -krb5_error_code nt_status_to_krb5(NTSTATUS nt_status); - -#endif diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c index 2b6995bd566..e593ae8536c 100644 --- a/source3/libnet/libnet_dssync.c +++ b/source3/libnet/libnet_dssync.c @@ -25,7 +25,6 @@ #include "rpc_client/cli_pipe.h" #include "../libcli/drsuapi/drsuapi.h" #include "../librpc/gen_ndr/ndr_drsuapi_c.h" -#include "libads/krb5_errs.h" /**************************************************************** ****************************************************************/ diff --git a/source3/libnet/libnet_dssync_keytab.c b/source3/libnet/libnet_dssync_keytab.c index 7526cd3294e..8999a3535fb 100644 --- a/source3/libnet/libnet_dssync_keytab.c +++ b/source3/libnet/libnet_dssync_keytab.c @@ -23,7 +23,6 @@ #include "libnet/libnet_dssync.h" #include "libnet/libnet_keytab.h" #include "librpc/gen_ndr/ndr_drsblobs.h" -#include "libads/krb5_errs.h" #if defined(HAVE_ADS) diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 82d8384e91c..13d035a8d41 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -41,7 +41,6 @@ #include "../libcli/smb/smb_seal.h" #include "lib/param/param.h" #include "../libcli/smb/smb2_negotiate_context.h" -#include "libads/krb5_errs.h" #define STAR_SMBSERVER "*SMBSERVER" diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c index efba80f1474..5cda8f065c4 100644 --- a/source3/passdb/machine_account_secrets.c +++ b/source3/passdb/machine_account_secrets.c @@ -37,7 +37,6 @@ #include "lib/krb5_wrap/krb5_samba.h" #include "lib/util/time_basic.h" #include "../libds/common/flags.h" -#include "libads/krb5_errs.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB diff --git a/source3/winbindd/winbindd_cred_cache.c b/source3/winbindd/winbindd_cred_cache.c index 5baecf906b9..52aa0ff6aea 100644 --- a/source3/winbindd/winbindd_cred_cache.c +++ b/source3/winbindd/winbindd_cred_cache.c @@ -26,7 +26,6 @@ #include "../libcli/auth/libcli_auth.h" #include "smb_krb5.h" #include "libads/kerberos_proto.h" -#include "libads/krb5_errs.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index a3d8716f781..b5850a33b0f 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -44,7 +44,6 @@ #include "lib/afs/afs_funcs.h" #include "libsmb/samlogon_cache.h" #include "rpc_client/util_netlogon.h" -#include "libads/krb5_errs.h" #include "param/param.h" #include "messaging/messaging.h" #include "lib/crypto/gnutls_helpers.h" diff --git a/source3/wscript_build b/source3/wscript_build index 10d9f71ae76..5dd0af73c8b 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -406,7 +406,6 @@ bld.SAMBA3_SUBSYSTEM('samba3core', lib/server_prefork.c lib/server_prefork_util.c lib/ldap_escape.c - libads/krb5_errs.c lib/system_smbd.c lib/audit.c lib/tevent_wait.c