From: "J. Bruce Fields" <bfields@fieldses.org>
To: Timo Aaltonen <timo.aaltonen-uOixanVlb7U@public.gmane.org>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] Check for AD style machine principal name
Date: Wed, 5 May 2010 13:36:45 -0400 [thread overview]
Message-ID: <20100505173645.GA13073@fieldses.org> (raw)
In-Reply-To: <alpine.DEB.2.00.1005051934040.3282-9o+TK994UVukEuhtYYxXtw@public.gmane.org>
On Wed, May 05, 2010 at 07:53:33PM +0300, Timo Aaltonen wrote:
>
> CC:ing the "new" list.
>
> On Tue, 27 Apr 2010, J. Bruce Fields wrote:
>
>> On Mon, Apr 26, 2010 at 05:00:59PM +0300, timo.aaltonen-uOixanVlb7U@public.gmane.org wrote:
>>> @@ -737,6 +737,26 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
>>> }
>>>
>>> /*
>>> + * Convert the hostname to machine principal name as created
>>> + * by MS Active Directory.
>>> +*/
>>> +
>>> +static char *
>>> +hostname_to_adprinc(char *name)
>>> +{
>>> + int i = 0;
>>> + char *buf = strdup(name);
>>
>> We should handle the possible NULL return.
>
> How about not calling hostname_to_adprinc from find_keytab_entry unless
> myhostname is != NULL?
I'm not sure what you mean. I'm just pointing out that strdup() can
return NULL if the memory allocation fails.
>
>>> + int len = strlen(name);
>>> + while(i < len) {
>>> + buf[i] = toupper(buf[i]);
>>> + i++;
>>> + }
>>> + buf[i++] = '$';
>>> + buf[i] = 0;
>>
>> This is past the end of the buffer. Maybe you want buf to be
>> strlen(name)+1?
>
> Ok, so:
> char *buf = malloc(sizeof(name)+1);
> buf = strdup(name);
> .
> .
> works, and should be ok?
The strdup should be a strcpy.
>
>>> @@ -812,6 +836,35 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *hostname,
>>> break;
>>> if (strcmp(realm, default_realm) == 0)
>>> tried_default = 1;
>>> + /* First try the Active Directory style machine principal */
>>> + code = krb5_build_principal_ext(context, &princ,
>>> + strlen(realm),
>>> + realm,
>>> + strlen(adprinc),
>>> + adprinc,
>>> + NULL);
>>> + if (code) {
>>> + k5err = gssd_k5_err_msg(context, code);
>>> + printerr(1, "%s while building principal for "
>>> + "'%s@%s'\n", k5err,
>>> + adprinc, realm);
>>> + continue;
>>
>> Is there an infinite loop here?
>
> Not to my knowledge,
We need a more convincing argument than that, unless someone else has
the cycles to take this over!
--b.
> it's basically the same chunk of code copied from a
> few lines below, modified to suit the adprinc.
>
>
> --
> Timo Aaltonen
> Systems Specialist
> IT Services, Aalto University
next prev parent reply other threads:[~2010-05-05 17:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1272290459-11335-1-git-send-email-timo.aaltonen@aalto.fi>
[not found] ` <560_1272392934_4BD72CE6_560_482_1_20100427182806.GP30729@fieldses.org>
2010-05-05 16:53 ` [PATCH] Check for AD style machine principal name Timo Aaltonen
[not found] ` <alpine.DEB.2.00.1005051934040.3282-9o+TK994UVukEuhtYYxXtw@public.gmane.org>
2010-05-05 17:36 ` J. Bruce Fields [this message]
2010-05-05 17:46 ` Kevin Coffman
[not found] ` <n2s4d569c331005051046t28cd5dch1e5dfe4a73b987bf-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-05-05 22:15 ` Timo Aaltonen
[not found] ` <alpine.DEB.2.00.1005052347130.3282-9o+TK994UVukEuhtYYxXtw@public.gmane.org>
2010-05-05 22:25 ` Staubach_Peter
[not found] ` <BF3BB6D12298F54B89C8DCC1E4073D80A24712-1Zg0zMUlrbd9m/dOYFj4Yjjd7nCn89gW@public.gmane.org>
2010-05-05 22:33 ` Timo Aaltonen
[not found] ` <alpine.DEB.2.00.1005060131080.3282-9o+TK994UVukEuhtYYxXtw@public.gmane.org>
2010-05-05 22:43 ` Staubach_Peter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100505173645.GA13073@fieldses.org \
--to=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=timo.aaltonen-uOixanVlb7U@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.