1 #ifndef CLIB_USERGROUP_PROTOS_H 2 #define CLIB_USERGROUP_PROTOS_H 3 4 /* 5 usergroup.library C prototypes 6 7 Copyright © 2003 The MorphOS Development Team, All Rights Reserved. 8 */ 9 10 #ifndef LIBRARIES_USERGROUP_H 11 #include <libraries/usergroup.h> 12 #endif 13 14 #ifndef UTILITY_TAGITEM_H 15 #include <utility/tagitem.h> 16 #endif 17 18 #ifndef EXEC_TASKS_H 19 #include <exec/tasks.h> 20 #endif 21 22 #ifndef _PWD_H_ 23 #include <pwd.h> 24 #endif 25 26 #ifndef _GRP_H_ 27 #include <grp.h> 28 #endif 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif /* __cplusplus */ 33 34 /* Setup functions */ 35 int ug_SetupContextTagList(const UBYTE* pname, struct TagItem *taglist); 36 int ug_SetupContextTags(const UBYTE* pname, ...); 37 int ug_GetErr(void); 38 const char *ug_StrError(LONG code); 39 40 /* User identification */ 41 uid_t getuid(void); 42 uid_t geteuid(void); 43 int setreuid(uid_t real, uid_t eff); 44 int setuid(uid_t id); 45 46 /* Group membership */ 47 gid_t getgid(void); 48 gid_t getegid(void); 49 int setregid(gid_t real, gid_t eff); 50 int setgid(gid_t id); 51 int getgroups(int ngroups, gid_t *groups); 52 int setgroups(int ngroups, const gid_t *groups); 53 int initgroups(const char *name, gid_t basegroup); 54 55 /* User database */ 56 struct passwd *getpwnam(const char *name); 57 struct passwd *getpwuid(uid_t uid); 58 void setpwent(void); 59 struct passwd *getpwent(void); 60 void endpwent(void); 61 62 /* Group database */ 63 struct group *getgrnam(const char * name); 64 struct group *getgrgid(gid_t gid); 65 void setgrent(void); 66 struct group *getgrent(void); 67 void endgrent(void); 68 69 /* Password handling */ 70 char *crypt(const char *key, const char *salt); 71 char *ug_GetSalt(const struct passwd *user, char *buffer, ULONG size); 72 char *getpass(const char *prompt); 73 74 /* Default protections */ 75 mode_t umask(mode_t mask); 76 mode_t getumask(void); 77 78 /* Sessions */ 79 pid_t setsid(void); 80 pid_t getpgrp(void); 81 char *getlogin(void); 82 int setlogin(const char *buffer); 83 84 /* Sessions, user login database (utmp) */ 85 void setutent(void); 86 struct utmp *getutent(void); 87 void endutent(void); 88 struct lastlog *getlastlog(uid_t uid); 89 int setlastlog(uid_t uid, char *name, char *host); 90 91 /* Credentials */ 92 struct UserGroupCredentials *getcredentials(struct Task *task); 93 94 #ifdef __cplusplus 95 } 96 #endif /* __cplusplus */ 97 98 #endif /* !CLIB_USERGROUP_PROTOS_H */