* [PATCH] AD principal configurable
@ 2014-08-07 14:19 Jurjen Bokma
2014-08-18 16:48 ` Steve Dickson
0 siblings, 1 reply; 2+ messages in thread
From: Jurjen Bokma @ 2014-08-07 14:19 UTC (permalink / raw)
To: Steve Dickson; +Cc: Linux NFS Mailing list, Jurjen Bokma
Signed-off-by: Jurjen Bokma <j.bokma@rug.nl>
---
utils/gssd/krb5_util.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 4b57141..8f492a6 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -801,6 +801,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
char *k5err = NULL;
int tried_all = 0, tried_default = 0;
krb5_principal princ;
+ const char *notsetstr = "not set";
+ char *adhostoverride;
/* Get full target hostname */
@@ -818,13 +820,21 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
}
/* Compute the active directory machine name HOST$ */
- strcpy(myhostad, myhostname);
- for (i = 0; myhostad[i] != 0; ++i) {
- if (myhostad[i] == '.') break;
- myhostad[i] = toupper(myhostad[i]);
+ krb5_appdefault_string(context, "nfs", NULL, "ad_principal_name", notsetstr, &adhostoverride);
+ if (strcmp(adhostoverride, notsetstr) != 0) {
+ printerr (0, "AD host string overridden with \"%s\" from appdefaults\n", adhostoverride);
+ /* No overflow: Windows cannot handle strings longer than 19 chars */
+ strcpy(myhostad, adhostoverride);
+ free(adhostoverride);
+ } else {
+ strcpy(myhostad, myhostname);
+ for (i = 0; myhostad[i] != 0; ++i) {
+ if (myhostad[i] == '.') break;
+ myhostad[i] = toupper(myhostad[i]);
+ }
+ myhostad[i] = '$';
+ myhostad[i+1] = 0;
}
- myhostad[i] = '$';
- myhostad[i+1] = 0;
retval = get_full_hostname(myhostname, myhostname, sizeof(myhostname));
if (retval) {
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] AD principal configurable
2014-08-07 14:19 [PATCH] AD principal configurable Jurjen Bokma
@ 2014-08-18 16:48 ` Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2014-08-18 16:48 UTC (permalink / raw)
To: Jurjen Bokma; +Cc: Linux NFS Mailing list
On 08/07/2014 10:19 AM, Jurjen Bokma wrote:
> Signed-off-by: Jurjen Bokma <j.bokma@rug.nl>
Committed... Thanks for taking the time to
redo the patch...
steved.
> ---
> utils/gssd/krb5_util.c | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
> index 4b57141..8f492a6 100644
> --- a/utils/gssd/krb5_util.c
> +++ b/utils/gssd/krb5_util.c
> @@ -801,6 +801,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
> char *k5err = NULL;
> int tried_all = 0, tried_default = 0;
> krb5_principal princ;
> + const char *notsetstr = "not set";
> + char *adhostoverride;
>
>
> /* Get full target hostname */
> @@ -818,13 +820,21 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
> }
>
> /* Compute the active directory machine name HOST$ */
> - strcpy(myhostad, myhostname);
> - for (i = 0; myhostad[i] != 0; ++i) {
> - if (myhostad[i] == '.') break;
> - myhostad[i] = toupper(myhostad[i]);
> + krb5_appdefault_string(context, "nfs", NULL, "ad_principal_name", notsetstr, &adhostoverride);
> + if (strcmp(adhostoverride, notsetstr) != 0) {
> + printerr (0, "AD host string overridden with \"%s\" from appdefaults\n", adhostoverride);
> + /* No overflow: Windows cannot handle strings longer than 19 chars */
> + strcpy(myhostad, adhostoverride);
> + free(adhostoverride);
> + } else {
> + strcpy(myhostad, myhostname);
> + for (i = 0; myhostad[i] != 0; ++i) {
> + if (myhostad[i] == '.') break;
> + myhostad[i] = toupper(myhostad[i]);
> + }
> + myhostad[i] = '$';
> + myhostad[i+1] = 0;
> }
> - myhostad[i] = '$';
> - myhostad[i+1] = 0;
>
> retval = get_full_hostname(myhostname, myhostname, sizeof(myhostname));
> if (retval) {
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-18 16:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-07 14:19 [PATCH] AD principal configurable Jurjen Bokma
2014-08-18 16:48 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).