This is the mail archive of the
libc-alpha@cygnus.com
mailing list for the glibc project.
passwd adjunct support gone between libc 5 and libc6
- To: libc-alpha@cygnus.com
- Subject: passwd adjunct support gone between libc 5 and libc6
- From: Matthew Arnison <maffew@physics.usyd.edu.au>
- Date: Mon, 6 Jul 1998 19:28:10 +1000 (EST)
Hi folks
Just upgraded from Debian 1.3 to Debian 2.0 beta, and my network accounts
all broke.
It's because we have a Solaris 2.5.x NIS server with passwd.adjunct style
lookups for shadow passwords (ie. ##username in password field rather than
an "x")
Now libc5 supported this (thus did debian 1.3), but from my reading of the
glibc 2.0.7 source code, the adjunct stuff is completely gone from glibc6.
Why is that?
By the way, i think the new nss stuff is cool.
I have made my own personal patch into the glibc6 source, based on the
libc5 course, which works well, and worked first go. The patch is to
glibc-2.0.7r/nis/nss_nis/nis-pwd.c
Which I can send if you like. Actually I've attached it below.
I also suspect it would make sense to fix nss_compat as well. I don't
think nss_files needs to know about adjunct, as it's only an issue when
talking to NIS servers of different breeds that do shadow passwords
differently.
We do want to keep Linux as nice and co-operative and compatible with
other systems, right? (Not to mention my selfish motives - I don't want
to be stuck on glibc2.0.7 or have to repatch new versions. :)
Anyway, I have sent similar details into the Debian bug tracking system 1
week ago, but have had no response, so I thought I'd go one level up in
the chain.
Cheers and keep up the fantastic efforts,
m.
--
Matthew Arnison Email: mra@physics.usyd.edu.au
Research Scientist Phone: +61 2 9351-6874
Physical Optics Dept. Fax: +61 2 9351-7727
School of Physics A28 Web: http://www.physics.usyd.edu.au/physopt/
University of Sydney NSW 2006
Australia
diff -u glibc-2.0.7r/nis/nss_nis/nis-pwd.c glibc-2.0.7r-adjunct/nis/nss_nis/nis-pwd.c
--- glibc-2.0.7r/nis/nss_nis/nis-pwd.c Thu Dec 25 08:07:24 1997
+++ glibc-2.0.7r-adjunct/nis/nss_nis/nis-pwd.c Mon Jun 29 02:17:09 1998
@@ -155,8 +155,9 @@
{
struct parser_data *data = (void *) buffer;
enum nss_status retval;
- char *domain, *result, *p;
- int len, parse_res;
+ char *domain, *result, *p, *tem;
+ char *result1;
+ int len, len1, parse_res;
if (name == NULL)
{
@@ -184,8 +185,37 @@
return NSS_STATUS_TRYAGAIN;
}
- p = strncpy (buffer, result, len);
- buffer[len] = '\0';
+ if (result && (tem=strchr(result,':')) && tem[1]=='#' && tem[2]=='#' &&
+ yp_match(domain, "passwd.adjunct.byname", name, strlen (name),
+ &result1, &len1) == 0)
+ {
+ /* then we found a passwd.adjunct entry */
+ /* merge encrypted password therein into original result */
+
+ char * encrypted = strchr(result1,':');
+ if (encrypted)
+ {
+ char *endp;
+ endp = strchr(encrypted+1,':');
+ if (endp)
+ {
+ *endp = 0;
+ tem = strchr(tem+1,':');
+ if (tem)
+ {
+ sprintf(buffer, "%s:%s:%s", name, encrypted+1, tem+1);
+ p = buffer;
+ }
+ }
+ }
+ free(result1);
+ }
+
+ else
+ {
+ p = strncpy (buffer, result, len);
+ buffer[len] = '\0';
+ }
while (isspace (*p))
++p;
free (result);