Author: metze
Date: 2004-11-19 12:58:08 +0000 (Fri, 19 Nov 2004)
New Revision: 131

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=131

Log:
- we don't need ldb_proto.h anymore
  the new ldb.h freom current samba has the prototypes
  
  btw: to build the libldb.so* do this in samba4
  ./configure --enable-experimental
  make proto library_libldb
  cp -d bin/libldb.so* /usr/lib/
  cp lib/ldb/include/ldb.h /usr/include/

- fix some princ with and without '@REALM' cases

metze

Modified:
   trunk/heimdal/configure.in
   trunk/heimdal/lib/hdb/hdb-ldb.c


Changeset:
Modified: trunk/heimdal/configure.in
===================================================================
--- trunk/heimdal/configure.in  2004-11-15 20:22:04 UTC (rev 130)
+++ trunk/heimdal/configure.in  2004-11-19 12:58:08 UTC (rev 131)
@@ -72,7 +72,6 @@
 #include <stdarg.h>
 
 #include <ldb.h>
-#include <ldb_proto.h>
 ],
 [-lldb],,,LDB)
 

Modified: trunk/heimdal/lib/hdb/hdb-ldb.c
===================================================================
--- trunk/heimdal/lib/hdb/hdb-ldb.c     2004-11-15 20:22:04 UTC (rev 130)
+++ trunk/heimdal/lib/hdb/hdb-ldb.c     2004-11-19 12:58:08 UTC (rev 131)
@@ -42,7 +42,6 @@
 #include <stdarg.h>
 
 #include <ldb.h>
-#include <ldb_proto.h>
 
 #include "hdb-ldb.h"
 
@@ -235,9 +234,20 @@
 
        krb5_free_principal(context, ent->principal);
 
-       asprintf(&unparsed_name_with_realm, "[EMAIL PROTECTED]", unparsed_name, 
realm);
+       if (!strchr(unparsed_name, '@')) {
+               asprintf(&unparsed_name_with_realm, "[EMAIL PROTECTED]", 
unparsed_name, realm);
+       } else {
+               unparsed_name_with_realm = strdup(unparsed_name);
+       }
+       if (!unparsed_name_with_realm) {
+               krb5_set_error_string(context, "asprintf or strdup: out of 
memory");
+               ret = ENOMEM;
+               goto out;
+       }
        ret = krb5_parse_name(context, unparsed_name_with_realm, 
&ent->principal);
        if (ret != 0) {
+               krb5_warnx(context, "LDB_message2entry: krb5_parse_name(%s)\n",
+                               unparsed_name_with_realm);
                goto out;
        }
 
@@ -421,8 +431,14 @@
        }
 
        rc = asprintf(&filter,
-               
"(&(objectClass=user)(|(userPrincipalName=%s)(|(servicePrincipalName=HOST/%s)(samAccountName=%s))))",
-                   princ, princ, account);
+               "(&(objectClass=user)"
+               "(|(userPrincipalName=%s)([EMAIL PROTECTED])"
+                 
"(servicePrincipalName=HOST/%s)(servicePrincipalName=HOST/[EMAIL PROTECTED])"
+                 "(samAccountName=%s)))",
+               princ, princ, realm,
+               princ, princ, realm,
+               account);
+
        if (rc < 0) {
                krb5_set_error_string(context, "asprintf: out of memory");
                ret = ENOMEM;
@@ -570,7 +586,7 @@
                return ret;
        }
 
-       rc = asprintf(&krbtgt_princ, "%s/%s", KRB5_TGS_NAME, realm);
+       rc = asprintf(&krbtgt_princ, "%s/[EMAIL PROTECTED]", KRB5_TGS_NAME, 
realm, realm);
 
        if (rc < 0) {
                krb5_set_error_string(context, "asprintf: out of memory");
@@ -578,7 +594,7 @@
                return ENOMEM;
        }
        
-       if (strcmp(krbtgt_princ, princ) == 0) {
+       if (strcasecmp(krbtgt_princ, princ) == 0) {
                free(princ);
                princ = strdup(KRB5_TGS_NAME);
                if (!princ) {

Reply via email to