Index: lustre/utils/gss/svcgssd_proc.c =================================================================== RCS file: /lustre/lustre-core/utils/gss/svcgssd_proc.c,v retrieving revision 1.5 diff -u -r1.5 svcgssd_proc.c --- lustre/utils/gss/svcgssd_proc.c 29 Jan 2008 21:24:51 -0000 1.5 +++ lustre/utils/gss/svcgssd_proc.c 20 Jun 2008 00:54:09 -0000 @@ -335,6 +335,10 @@ realm = strchr(sname, '@'); if (realm) *realm++ = '\0'; + else { + printerr(0, "ERROR: %s has no realm name\n", sname); + goto out_free; + } host = strchr(sname, '/'); if (host) @@ -355,7 +359,7 @@ } if (strcasecmp(host, namebuf)) { - printerr(0, "ERROR: %s/%s@s claimed hostname doesn't " + printerr(0, "ERROR: %s/%s@%s claimed hostname doesn't " "match %s, nid %016llx\n", sname, host, realm, namebuf, nid); goto out_free; @@ -363,29 +367,29 @@ } else { if (!strcmp(sname, GSSD_SERVICE_MDS)) { printerr(0, "ERROR: "GSSD_SERVICE_MDS"@%s from %016llx " - "doesn't bind with hostname\n", - realm ? realm : "", nid); + "doesn't bind with hostname\n", realm, nid); goto out_free; } } /* 2. check realm */ - if (!realm) { - /* just deny it - cred->cr_remote = (mds_local_realm != NULL); - */ - printerr(0, "ERROR: %s%s%s have no realm name\n", - sname, host ? "/" : "", host ? "host" : ""); - goto out_free; - } - if (!mds_local_realm || strcasecmp(mds_local_realm, realm)) { cred->cr_remote = 1; - if (cred->cr_mapped_uid == -1) - printerr(0, "ERROR: %s from %016llx is remote but " - "without mapping\n", sname, nid); - /* mapped, skip user checking */ + /* Allow mapped user */ + if (cred->cr_mapped_uid != -1) + res = 0; + /* Allow OSS auth using client machine credential */ + else if (lustre_svc == LUSTRE_GSS_SVC_OSS && + !strcmp(sname, LUSTRE_ROOT_NAME)) + res = 0; + /* Invalid remote user */ + else + printerr(0, "ERROR: %s%s%s@%s from %016llx is remote " + "but without mapping\n", sname, + host ? "/" : "", host ? host : "", realm, nid); + + /* skip local user check */ goto out_free; } @@ -401,8 +405,9 @@ cred->cr_usr_mds = 1; } else { if (cred->cr_mapped_uid == -1) { - printerr(0, "ERROR: invalid user, %s/%s@%s " - "from %016llx\n", sname, host, + printerr(0, "ERROR: invalid user, %s%s%s@%s " + "from %016llx\n", sname, + host ? "/" : "", host ? host : "", realm, nid); goto out_free; } @@ -415,11 +420,12 @@ printerr(2, "%s resolve to uid %u\n", sname, cred->cr_uid); } - printerr(1, "%s: authenticated %s%s%s@%s from %016llx\n", - lustre_svc_name[lustre_svc], sname, - host ? "/" : "", host ? host : "", realm, nid); res = 0; out_free: + if (!res) + printerr(1, "%s: authenticated %s%s%s@%s from %016llx\n", + lustre_svc_name[lustre_svc], sname, + host ? "/" : "", host ? host : "", realm, nid); free(sname); return res; }