svn commit: trunk/busybox/libbb

aldot at busybox.net aldot at busybox.net
Tue Sep 20 21:08:10 UTC 2005


Author: aldot
Date: 2005-09-20 14:08:10 -0700 (Tue, 20 Sep 2005)
New Revision: 11516

Log:
- consolidated password helpers into bb_pwd.c


Removed:
   trunk/busybox/libbb/get_ug_id.c
   trunk/busybox/libbb/my_getgrgid.c
   trunk/busybox/libbb/my_getgrnam.c
   trunk/busybox/libbb/my_getpwnam.c
   trunk/busybox/libbb/my_getpwuid.c
   trunk/busybox/libbb/my_getug.c


Changeset:
Deleted: trunk/busybox/libbb/get_ug_id.c
===================================================================
--- trunk/busybox/libbb/get_ug_id.c	2005-09-20 21:06:17 UTC (rev 11515)
+++ trunk/busybox/libbb/get_ug_id.c	2005-09-20 21:08:10 UTC (rev 11516)
@@ -1,30 +0,0 @@
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <stdlib.h>
-
-extern unsigned long get_ug_id(const char *s, long (*my_getxxnam)(const char *))
-{
-	unsigned long r;
-	char *p;
-
-	r = strtoul(s, &p, 10);
-	if (*p || (s == p)) {
-		r = my_getxxnam(s);
-	}
-
-	return r;
-}

Deleted: trunk/busybox/libbb/my_getgrgid.c
===================================================================
--- trunk/busybox/libbb/my_getgrgid.c	2005-09-20 21:06:17 UTC (rev 11515)
+++ trunk/busybox/libbb/my_getgrgid.c	2005-09-20 21:08:10 UTC (rev 11516)
@@ -1,57 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Utility routines.
- *
- * Copyright (C) 1999-2004 by Erik Andersen <andersen at codepoet.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-  /* Hacked by Tito Ragusa (c) 2004 <farmatito at tiscali.it> to make it more
-  * flexible :
-  *
-  * if bufsize is > 0 char *group cannot be set to NULL.
-  *                   On success groupname is written on static allocated buffer group
-  *                   (and a pointer to it is returned).
-  *                   On failure gid as string is written to static allocated buffer 
-  *                   group and NULL is returned.
-  * if bufsize is = 0 char *group can be set to NULL.
-  *                   On success groupname is returned. 
-  *                   On failure NULL is returned.
-  * if bufsize is < 0 char *group can be set to NULL.
-  *                   On success groupname is returned.
-  *                   On failure an error message is printed and the program exits.   
-  */
-  
-#include "libbb.h"
-#include "grp_.h"
-
-/* gets a groupname given a gid */
-char * my_getgrgid(char *group, long gid, int bufsize)
-{
-	struct group *mygroup = getgrgid(gid);
-
-	return  my_getug(group, (mygroup) ? mygroup->gr_name : (char *)mygroup, gid, bufsize, 'g');
-}
-
-
-/* END CODE */
-/*
-Local Variables:
-c-file-style: "linux"
-c-basic-offset: 4
-tab-width: 4
-End:
-*/

Deleted: trunk/busybox/libbb/my_getgrnam.c
===================================================================
--- trunk/busybox/libbb/my_getgrnam.c	2005-09-20 21:06:17 UTC (rev 11515)
+++ trunk/busybox/libbb/my_getgrnam.c	2005-09-20 21:08:10 UTC (rev 11516)
@@ -1,49 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Utility routines.
- *
- * Copyright (C) 1999-2004 by Erik Andersen <andersen at codepoet.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "libbb.h"
-#include "pwd_.h"
-#include "grp_.h"
-
-
-/* returns a gid given a group name */
-long my_getgrnam(const char *name)
-{
-	struct group *mygroup;
-
-	mygroup  = getgrnam(name);
-	if (mygroup==NULL)
-		bb_error_msg_and_die("unknown group name: %s", name);
-
-	return (mygroup->gr_gid);
-}
-
-
-/* END CODE */
-/*
-Local Variables:
-c-file-style: "linux"
-c-basic-offset: 4
-tab-width: 4
-End:
-*/

Deleted: trunk/busybox/libbb/my_getpwnam.c
===================================================================
--- trunk/busybox/libbb/my_getpwnam.c	2005-09-20 21:06:17 UTC (rev 11515)
+++ trunk/busybox/libbb/my_getpwnam.c	2005-09-20 21:08:10 UTC (rev 11516)
@@ -1,49 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Utility routines.
- *
- * Copyright (C) 1999-2004 by Erik Andersen <andersen at codepoet.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "libbb.h"
-#include "pwd_.h"
-#include "grp_.h"
-
-
-/* returns a uid given a username */
-long my_getpwnam(const char *name)
-{
-	struct passwd *myuser;
-
-	myuser  = getpwnam(name);
-	if (myuser==NULL)
-		bb_error_msg_and_die("unknown user name: %s", name);
-
-	return myuser->pw_uid;
-}
-
-
-/* END CODE */
-/*
-Local Variables:
-c-file-style: "linux"
-c-basic-offset: 4
-tab-width: 4
-End:
-*/

Deleted: trunk/busybox/libbb/my_getpwuid.c
===================================================================
--- trunk/busybox/libbb/my_getpwuid.c	2005-09-20 21:06:17 UTC (rev 11515)
+++ trunk/busybox/libbb/my_getpwuid.c	2005-09-20 21:08:10 UTC (rev 11516)
@@ -1,56 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Utility routines.
- *
- * Copyright (C) 1999-2004 by Erik Andersen <andersen at codepoet.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- /* Hacked by Tito Ragusa (c) 2004 <farmatito at tiscali.it> to make it more
-  * flexible :
-  *
-  * if bufsize is > 0 char *name can not be set to NULL.
-  *                   On success username is written on the static allocated buffer name 
-  *                   (and a pointer to it is returned).
-  *                   On failure uid as string is written to the static allocated buffer name
-  *                   and NULL is returned.
-  * if bufsize is = 0 char *name can be set to NULL.
-  *                   On success username is returned. 
-  *                   On failure NULL is returned.
-  * if bufsize is < 0 char *name can be set to NULL
-  *                   On success username is returned.
-  *                   On failure an error message is printed and the program exits.   
-  */
-  
-#include "libbb.h"
-#include "pwd_.h"
-
-/* gets a username given a uid */
-char * my_getpwuid(char *name, long uid, int bufsize)
-{
-	struct passwd *myuser = getpwuid(uid);
-
-	return  my_getug(name, (myuser) ? myuser->pw_name : (char *)myuser , uid, bufsize, 'u');
-}
-
-/* END CODE */
-/*
-Local Variables:
-c-file-style: "linux"
-c-basic-offset: 4
-tab-width: 4
-End:
-*/

Deleted: trunk/busybox/libbb/my_getug.c
===================================================================
--- trunk/busybox/libbb/my_getug.c	2005-09-20 21:06:17 UTC (rev 11515)
+++ trunk/busybox/libbb/my_getug.c	2005-09-20 21:08:10 UTC (rev 11516)
@@ -1,64 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Utility routines.
- *
- * Copyright (C) 2004 by Tito Ragusa <farmatito at tiscali.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
- /* 
-  *
-  * if bufsize is > 0 char *buffer can not be set to NULL.
-  *                   If idname is not NULL it is written on the static allocated buffer 
-  *                   (and a pointer to it is returned).
-  *                   if idname is NULL, id as string is written to the static allocated buffer
-  *                   and NULL is returned.
-  * if bufsize is = 0 char *buffer can be set to NULL.
-  *                   If idname exists a pointer to it is returned,
-  *                   else NULL is returned.
-  * if bufsize is < 0 char *buffer can be set to NULL.
-  *                   If idname exists a pointer to it is returned,
-  *                   else an error message is printed and the program exits.   
-  */
-  
-#include <stdio.h>
-#include <assert.h>
-#include "libbb.h"
-
-
-/* internal function for my_getpwuid and my_getgrgid */
-char * my_getug(char *buffer, char *idname, long id, int bufsize, char prefix)
-{
-	if(bufsize > 0 ) {
-		assert(buffer!=NULL);
-		if(idname) {
-			return safe_strncpy(buffer, idname, bufsize);
-		}
-		snprintf(buffer, bufsize, "%ld", id);
-	} else if(bufsize < 0 && !idname) {
-		bb_error_msg_and_die("unknown %cid %ld", prefix, id); 
-	}
-	return idname;
-}
-
-/* END CODE */
-/*
-Local Variables:
-c-file-style: "linux"
-c-basic-offset: 4
-tab-width: 4
-End:
-*/




More information about the busybox-cvs mailing list