[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH 2/6] libc: POSIX: getuid/getgid



+ libc: POSIX: Stubs fuer getuid(), geteuid(), getgid(), getegid()
---
 src/modules/include/unistd.h |   13 +++++++++
 src/modules/lib/posix/user.c |   60 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100644 src/modules/lib/posix/user.c

diff --git a/src/modules/include/unistd.h b/src/modules/include/unistd.h
index 341b363..c7b7bbb 100644
--- a/src/modules/include/unistd.h
+++ b/src/modules/include/unistd.h
@@ -145,6 +145,19 @@ unsigned int sleep(unsigned int seconds);
 
 /// Datei umbenennen oder verschieben
 int rename(const char* path_old, const char* path_new);
+
+/// Gibt die aktuelle Benutzer-ID zurueck
+uid_t getuid(void);
+
+/// Gibt die effektive Benutzer-ID zurueck
+uid_t geteuid(void);
+
+/// Gibt die aktuelle Gruppen-ID zurueck
+gid_t getgid(void);
+//
+/// Gibt die effektive Gruppen-ID zurueck
+gid_t getegid(void);
+
 #endif
 
 #endif
diff --git a/src/modules/lib/posix/user.c b/src/modules/lib/posix/user.c
new file mode 100644
index 0000000..4499b9c
--- /dev/null
+++ b/src/modules/lib/posix/user.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2009 The tyndur Project. All rights reserved.
+ *
+ * This code is derived from software contributed to the tyndur Project
+ * by Kevin Wolf.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the tyndur Project
+ *     and its contributors.
+ * 4. Neither the name of the tyndur Project nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <unistd.h>
+
+/// Gibt die aktuelle Benutzer-ID zurueck
+uid_t getuid(void)
+{
+    return 0;
+}
+
+/// Gibt die effektive Benutzer-ID zurueck
+uid_t geteuid(void)
+{
+    return 0;
+}
+
+/// Gibt die aktuelle Gruppen-ID zurueck
+gid_t getgid(void)
+{
+    return 0;
+}
+
+/// Gibt die effektive Gruppen-ID zurueck
+gid_t getegid(void)
+{
+    return 0;
+}
-- 
1.5.4.5