Another showstopper for 3.2.2.

simo idra at
Sun Aug 17 14:24:12 GMT 2008

On Sun, 2008-08-17 at 16:19 +0200, Volker Lendecke wrote:
> On Sun, Aug 17, 2008 at 10:13:50AM -0400, simo wrote:
> > The patch itself seem ok, but why playing with building a tring to make
> > lookup_name parse it again ? Why not just passing the domain as a new
> > parameter to lookup_name ?
> Because lookup_name does a lot of logic to get non-qualified
> names right. If you always have to pass in a domain name,
> someone else needs to get the domain part right. Where would
> you put that logic?

This is the logic to split domain and name strings:

        p = strchr_m(full_name, '\\');

        if (p != NULL) {
                domain = talloc_strndup(tmp_ctx, full_name,
                                        PTR_DIFF(p, full_name));
                name = talloc_strdup(tmp_ctx, p+1);
        } else {
                domain = talloc_strdup(tmp_ctx, "");
                name = talloc_strdup(tmp_ctx, full_name);

        if ((domain == NULL) || (name == NULL)) {
                DEBUG(0, ("talloc failed\n"));
                return false;

It does not seem very complex, and we can easily have a function like
the following to wrap the lines above:

NTSTATUS samba_split_domain_name(TALLOC_CTX *ctx, char *fullname, char**domain, char **name);

This way functions that already have the domain and name strings can
directly call lookup_name, the others will simply call
samba_split_domain_name() first.


Simo Sorce
Samba Team GPL Compliance Officer <simo at>
Senior Software Engineer at Red Hat Inc. <simo at>

More information about the samba-technical mailing list