[53] in Hesiod

home help back first fref pref prev next nref lref last post

Hesiod on a RS/6000

daemon@ATHENA.MIT.EDU (Mark Rosenstein)
Thu Aug 15 13:38:00 1991

Date: Thu, 15 Aug 91 13:28:28 -0400
From: Mark Rosenstein <mar@MIT.EDU>
To: nabors@wes.army.mil
Cc: hesiod@MIT.EDU
In-Reply-To: nabors@bart.MIT.EDU's message of Thu, 15 Aug 91 11:56:13 -0500 <9108151656.AA03646@bart>

Shari, I've added you to the hesiod list, effective late tonight.

Your problem compiling on the RS/6000 has to do with differences in
the struct passwd between AIX and BSD.  We recently ported it to the
RS/6000 here, and had to fix this same problem.  This diff also adds a
hes_getpwuid() function to the library.
					-Mark


*** /tmp/,RCSt1012488	Thu Aug 15 13:25:00 1991
--- hespwnam.c	Mon Jun 10 03:15:59 1991
***************
*** 5,33 ****
   *
   * Original version by Steve Dyer, IBM/Project Athena.
   *
!  *	$Author: treese $
   *	$Source: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/athena.lib/hesiod/RCS/hespwnam.c,v $
   *	$Athena: hespwnam.c,v 1.4 88/08/07 21:52:51 treese Locked $
   */
  
  #include "mit-copyright.h"
  
  #ifndef lint
! static char rcsid_pwnam_c[] = "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/athena.lib/hesiod/RCS/hespwnam.c,v 1.5 88/08/07 23:17:19 treese Exp $";
  #endif
  #include <stdio.h>
  #include <pwd.h>
--- 5,19 ----
   *
   * Original version by Steve Dyer, IBM/Project Athena.
   *
!  *	$Author: probe $
   *	$Source: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/athena.lib/hesiod/RCS/hespwnam.c,v $
   *	$Athena: hespwnam.c,v 1.4 88/08/07 21:52:51 treese Locked $
   */
  
  #include "mit-copyright.h"
  
  #ifndef lint
! static char rcsid_pwnam_c[] = "$Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/athena.lib/hesiod/RCS/hespwnam.c,v 1.8 91/06/10 03:15:41 probe Exp $";
  #endif
  #include <stdio.h>
  #include <pwd.h>
***************
*** 36,49 ****
  static struct passwd pw_entry;
  static char buf[256];
  
! struct passwd *
! hes_getpwnam(nam)
! 	char *nam;
  {
  	register char *p, **pp; char *_NextPWField(), **hes_resolve();
  
! 	pp = hes_resolve(nam, "passwd");
! 	if (pp == NULL)
  		return(NULL);
  	/* choose only the first response (only 1 expected) */
  	(void) strcpy(buf, pp[0]);
--- 22,36 ----
  static struct passwd pw_entry;
  static char buf[256];
  
! static struct passwd *
! hes_getpwcommon(arg, which)
! 	char *arg;
! 	int which;	/* 0=hes_getpwnam, 1=hes_getpwuid */
  {
  	register char *p, **pp; char *_NextPWField(), **hes_resolve();
  
! 	pp = hes_resolve(arg, which ? "uid" : "passwd");
! 	if (pp == NULL || *pp == NULL)
  		return(NULL);
  	/* choose only the first response (only 1 expected) */
  	(void) strcpy(buf, pp[0]);
***************
*** 55,62 ****
--- 42,54 ----
  	pw_entry.pw_uid = atoi(p);
  	p = _NextPWField(p);
  	pw_entry.pw_gid = atoi(p);
+ #if (!defined(_AIX) || (AIXV < 31)) && !defined(sun)
  	pw_entry.pw_quota = 0;
+ #if defined(_AIX) && (AIXV < 31)
+ 	pw_entry.pw_age =
+ #endif
  	pw_entry.pw_comment = "";
+ #endif
  	p = _NextPWField(p);
  	pw_entry.pw_gecos = p;
  	p = _NextPWField(p);
***************
*** 84,86 ****
--- 76,94 ----
  	return(ptr);
  }
  
+ struct passwd *
+ hes_getpwnam(nam)
+ 	char *nam;
+ {
+ 	return hes_getpwcommon(nam, 0);
+ }
+ 
+ struct passwd *
+ hes_getpwuid(uid)
+ 	int uid;
+ {
+ 	char uidstr[16];
+ 
+ 	sprintf(uidstr, "%d", uid);
+ 	return hes_getpwcommon(uidstr, 1);
+ }

home help back first fref pref prev next nref lref last post