[Sysfence-commit] sysfence/sys users.c,NONE,1.1 users.h,NONE,1.1 Makefile,1.1,1.2
Status: Alpha
Brought to you by:
emes
|
From: Michal S. <em...@us...> - 2004-06-03 22:01:08
|
Update of /cvsroot/sysfence/sysfence/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25511 Modified Files: Makefile Added Files: users.c users.h Log Message: + username <-> uid translation Index: Makefile =================================================================== RCS file: /cvsroot/sysfence/sysfence/sys/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 26 May 2004 17:30:41 -0000 1.1 +++ Makefile 3 Jun 2004 22:00:42 -0000 1.2 @@ -8,14 +8,16 @@ $(CC) -c $(CFLAGS) communication.c -o communication.o $(CC) -c $(CFLAGS) processtitle.c -o processtitle.o $(CC) -c $(CFLAGS) sighandlers.c -o sighandlers.o + $(CC) -c $(CFLAGS) users.c -o users.o debug: - gcc -c -ggdb -DDEBUG exit.c -o exit.o - gcc -c -ggdb -DDEBUG log.c -o log.o - gcc -c -ggdb -DDEBUG xalloc.c -o xalloc.o - gcc -c -ggdb -DDEBUG communication.c -o communication.o - gcc -c -ggdb -DDEBUG processtitle.c -o processtitle.o - gcc -c -ggdb -DDEBUG sighandlers.c -o sighandlers.o + $(CC) -c -ggdb -DDEBUG exit.c -o exit.o + $(CC) -c -ggdb -DDEBUG log.c -o log.o + $(CC) -c -ggdb -DDEBUG xalloc.c -o xalloc.o + $(CC) -c -ggdb -DDEBUG communication.c -o communication.o + $(CC) -c -ggdb -DDEBUG processtitle.c -o processtitle.o + $(CC) -c -ggdb -DDEBUG sighandlers.c -o sighandlers.o + $(CC) -c -ggdb -DDEBUG users.c -o users.o clean: rm -f *.o --- NEW FILE: users.h --- /* copyright (c) 2004, Michal Salaban <em...@pl...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation (see file COPYING for details). You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: users.h,v 1.1 2004/06/03 22:00:43 emes Exp $ */ uid_t * username2uid (char *name); char * uid2username (uid_t uid); /* $Id: users.h,v 1.1 2004/06/03 22:00:43 emes Exp $ */ --- NEW FILE: users.c --- /* copyright (c) 2004, Michal Salaban <em...@pl...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation (see file COPYING for details). You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. $Id: users.c,v 1.1 2004/06/03 22:00:42 emes Exp $ */ #include <sys/types.h> #include <pwd.h> #include <stdio.h> #include <string.h> #include "xalloc.h" #include "users.h" uid_t * username2uid (char *name) { struct passwd *p = getpwnam (name); uid_t *b; if (!p) return NULL; b = (uid_t *) xalloc (NULL, sizeof (uid_t)); *b = p->pw_uid; return b; } char * uid2username (uid_t uid) { struct passwd *p = getpwuid (uid); char *b; if (!p) return NULL; b = (char *) xalloc (NULL, strlen (p->pw_name) + 1); strcpy (b, p->pw_name); return b; } /* $Id: users.c,v 1.1 2004/06/03 22:00:42 emes Exp $ */ |