From 87aad6a13a6c8d4cefbf23c8be461ce6887bfce6 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 17 May 2011 13:56:37 -0400 Subject: [PATCH] Add NO_LOCALNAME The pname to uid functionality at present assumes there is an implementation of getpwnam() and that the local user identifier is an integer. On Windows, the local user identifier is a SId. Add NO_LOCALNAME as a build option so that Windows (for now) can build without providing a getpwnam() implementation. Change-Id: I04cfd6d2cd52e6228733f1da1dab420b453e6566 --- include/NTMakefile | 1 + lib/gssapi/krb5/pname_to_uid.c | 5 +++++ lib/gssapi/mech/gss_pname_to_uid.c | 4 ++++ windows/NTMakefile.config | 3 +++ 4 files changed, 13 insertions(+) diff --git a/include/NTMakefile b/include/NTMakefile index 3838c4599..85ea4e270 100644 --- a/include/NTMakefile +++ b/include/NTMakefile @@ -76,6 +76,7 @@ while(<>) { if ("$(HAVE_SCC)") { print "#define HAVE_SCC 1\n"; } if ("$(DIR_hdbdir)") { print "#define HDB_DB_DIR \"".'$(DIR_hdbdir)'."\"\n"; } if ("$(HAVE_MSLSA_CACHE)") { print "#define HAVE_MSLSA_CACHE 1\n"; } + if ("$(NO_LOCALNAME)") { print "#define NO_LOCALNAME 1\n"; } } elsif (m/\@VERSION_OPTDEFS\@/) { diff --git a/lib/gssapi/krb5/pname_to_uid.c b/lib/gssapi/krb5/pname_to_uid.c index c658161fc..c14ff9005 100644 --- a/lib/gssapi/krb5/pname_to_uid.c +++ b/lib/gssapi/krb5/pname_to_uid.c @@ -38,6 +38,10 @@ _gsskrb5_pname_to_uid(OM_uint32 *minor_status, const gss_OID mech_type, uid_t *uidp) { +#ifdef NO_LOCALNAME + *minor_status = KRB5_NO_LOCALNAME; + return GSS_S_FAILURE; +#else krb5_error_code ret; krb5_context context; krb5_const_principal princ = (krb5_const_principal)pname; @@ -77,4 +81,5 @@ _gsskrb5_pname_to_uid(OM_uint32 *minor_status, *uidp = pwd->pw_uid; return GSS_S_COMPLETE; +#endif /* NO_LOCALNAME */ } diff --git a/lib/gssapi/mech/gss_pname_to_uid.c b/lib/gssapi/mech/gss_pname_to_uid.c index 458b3757f..444d38a8d 100644 --- a/lib/gssapi/mech/gss_pname_to_uid.c +++ b/lib/gssapi/mech/gss_pname_to_uid.c @@ -59,6 +59,9 @@ attr_pname_to_uid(OM_uint32 *minor_status, struct _gss_mechanism_name *mn, uid_t *uidp) { +#ifdef NO_LOCALNAME + return GSS_S_UNAVAILABLE; +#else OM_uint32 major_status = GSS_S_UNAVAILABLE; OM_uint32 tmpMinor; int more = -1; @@ -124,6 +127,7 @@ attr_pname_to_uid(OM_uint32 *minor_status, } return major_status; +#endif /* NO_LOCALNAME */ } OM_uint32 diff --git a/windows/NTMakefile.config b/windows/NTMakefile.config index 0e1703832..27288fc8c 100644 --- a/windows/NTMakefile.config +++ b/windows/NTMakefile.config @@ -100,6 +100,9 @@ DIR_hdbdir=%{COMMON_APPDATA}/heimdal/hdb # Enable weak crypto WEAK_CRYPTO=1 +# Disable use of GSS LOCALNAME support +NO_LOCALNAME=1 + # Disable build of installers !ifndef NO_INSTALLERS BUILD_INSTALLERS=1