From 4c782c26ac6112bcdee43ccdb0b3b2bf62ee63ac Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 2 Aug 2010 18:10:10 +0000 Subject: [PATCH] 2010-07-30 Bharath Suri PR 1645/cpukit * libcsupport/src/getuid.c: Moved setuid() routine to its own file. * libcsupport/src/setuid.c: New file with setuid() routine. * libcsupport/src/seteuid.c: New file with seteuid() routine. --- cpukit/ChangeLog | 8 ++++++++ cpukit/libcsupport/Makefile.am | 2 +- cpukit/libcsupport/src/getuid.c | 31 +++++++------------------------ cpukit/libcsupport/src/seteuid.c | 26 ++++++++++++++++++++++++++ cpukit/libcsupport/src/setuid.c | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 25 deletions(-) create mode 100644 cpukit/libcsupport/src/seteuid.c create mode 100644 cpukit/libcsupport/src/setuid.c diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index d364acc250..80567863d1 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,11 @@ +2010-07-30 Bharath Suri + + PR 1645/cpukit + * libcsupport/src/getuid.c: Moved setuid() routine to its own + file. + * libcsupport/src/setuid.c: New file with setuid() routine. + * libcsupport/src/seteuid.c: New file with seteuid() routine. + 2010-07-30 Joel Sherrill * libcsupport/src/fstat.c, libcsupport/src/rmdir.c, diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am index 9eb4df5c24..e3a302c72e 100644 --- a/cpukit/libcsupport/Makefile.am +++ b/cpukit/libcsupport/Makefile.am @@ -85,7 +85,7 @@ DIRECTORY_SCAN_C_FILES += src/getcwd.c ID_C_FILES = src/getegid.c src/geteuid.c src/getgid.c src/getgroups.c \ src/getlogin.c src/getpgrp.c src/getpid.c src/getppid.c src/getuid.c \ - src/setpgid.c src/setsid.c + src/setuid.c src/seteuid.c src/setpgid.c src/setsid.c MALLOC_C_FILES = src/malloc_initialize.c src/calloc.c src/malloc.c \ src/realloc.c src/_calloc_r.c src/_malloc_r.c \ diff --git a/cpukit/libcsupport/src/getuid.c b/cpukit/libcsupport/src/getuid.c index 65e3184005..0fa7627c6a 100644 --- a/cpukit/libcsupport/src/getuid.c +++ b/cpukit/libcsupport/src/getuid.c @@ -1,4 +1,11 @@ /* + * COPYRIGHT (c) 1989-2010. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * * $Id$ */ @@ -10,38 +17,14 @@ #include #include -#include -#include -#include - #include /* - * MACRO in userenv.h - * -uid_t _POSIX_types_Uid = 0; -*/ - -/*PAGE - * * 4.2.1 Get Real User, Effective User, Ral Group, and Effective Group IDs, * P1003.1b-1993, p. 84 */ - uid_t getuid( void ) { return _POSIX_types_Uid; } -/*PAGE - * - * 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84 - */ - -int setuid( - uid_t uid -) -{ - _POSIX_types_Uid = uid; - return 0; -} diff --git a/cpukit/libcsupport/src/seteuid.c b/cpukit/libcsupport/src/seteuid.c new file mode 100644 index 0000000000..e4263abfd5 --- /dev/null +++ b/cpukit/libcsupport/src/seteuid.c @@ -0,0 +1,26 @@ +/* + * COPYRIGHT (c) 1989-2010. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include + +int seteuid( uid_t euid ) +{ + _POSIX_types_Euid = euid; + return 0; +} diff --git a/cpukit/libcsupport/src/setuid.c b/cpukit/libcsupport/src/setuid.c new file mode 100644 index 0000000000..bb4651dfae --- /dev/null +++ b/cpukit/libcsupport/src/setuid.c @@ -0,0 +1,32 @@ +/* + * COPYRIGHT (c) 1989-2010. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include + +/* + * + * 4.2.2 Set User and Group IDs, P1003.1b-1993, p. 84 + */ +int setuid( + uid_t uid +) +{ + _POSIX_types_Uid = uid; + return 0; +}