]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/pwupd.h
Cast uid/git to uintmax_t when using printf-like functions so the size of
[pw-darwin.git] / pw / pwupd.h
index f9364838035fa7156ee70737d35d0c7dd6d86c37..054c5a55293b36d1f1938df05bf15b460609aafc 100644 (file)
 #ifndef _PWUPD_H_
 #define _PWUPD_H_
 
+#include <sys/cdefs.h>
+#include <sys/param.h>
 #include <sys/types.h>
+
 #include <pwd.h>
 #include <grp.h>
-
-#include <sys/cdefs.h>
+#include <stdbool.h>
+#include <stringlist.h>
 
 #if defined(__FreeBSD__)
 #define        RET_SETGRENT    int
@@ -41,8 +44,7 @@
 #define        RET_SETGRENT    void
 #endif
 
-struct pwf
-{
+struct pwf {
        int                 _altdir;
        void              (*_setpwent)(void);
        void              (*_endpwent)(void);
@@ -56,8 +58,52 @@ struct pwf
        struct group  * (*_getgrnam)(const char * nam);
 };
 
+struct userconf {
+       int             default_password;       /* Default password for new users? */
+       int             reuse_uids;             /* Reuse uids? */
+       int             reuse_gids;             /* Reuse gids? */
+       char            *nispasswd;             /* Path to NIS version of the passwd file */
+       char            *dotdir;                /* Where to obtain skeleton files */
+       char            *newmail;               /* Mail to send to new accounts */
+       char            *logfile;               /* Where to log changes */
+       char            *home;                  /* Where to create home directory */
+       mode_t          homemode;               /* Home directory permissions */
+       char            *shelldir;              /* Where shells are located */
+       char            **shells;               /* List of shells */
+       char            *shell_default;         /* Default shell */
+       char            *default_group;         /* Default group number */
+       StringList      *groups;                /* Default (additional) groups */
+       char            *default_class;         /* Default user class */
+       uid_t           min_uid, max_uid;       /* Allowed range of uids */
+       gid_t           min_gid, max_gid;       /* Allowed range of gids */
+       int             expire_days;            /* Days to expiry */
+       int             password_days;          /* Days to password expiry */
+};
+
+struct pwconf {
+       char             rootdir[MAXPATHLEN];
+       char             etcpath[MAXPATHLEN];
+       char            *newname;
+       char            *config;
+       char            *gecos;
+       int              fd;
+       int              rootfd;
+       int              which;
+       bool             quiet;
+       bool             force;
+       bool             all;
+       bool             dryrun;
+       bool             pretty;
+       bool             v7;
+       bool             checkduplicate;
+       bool             deletehome;
+       bool             precrypted;
+       struct userconf *userconf;
+};
+
 extern struct pwf PWF;
 extern struct pwf VPWF;
+extern struct pwconf conf;
 
 #define SETPWENT()     PWF._setpwent()
 #define ENDPWENT()     PWF._endpwent()
@@ -91,14 +137,12 @@ int addpwent(struct passwd * pwd);
 int delpwent(struct passwd * pwd);
 int chgpwent(char const * login, struct passwd * pwd);
 
-int setpwdir(const char * dir);
 char * getpwpath(char const * file);
 
 int addgrent(struct group * grp);
 int delgrent(struct group * grp);
 int chggrent(char const * name, struct group * grp);
 
-int setgrdir(const char * dir);
 char * getgrpath(const char *file);
 
 void vsetpwent(void);
@@ -113,9 +157,9 @@ struct group * vgetgrnam(const char * nam);
 RET_SETGRENT   vsetgrent(void);
 void           vendgrent(void);
 
-void copymkdir(char const * dir, char const * skel, mode_t mode, uid_t uid, gid_t gid);
-void rm_r(char const * dir, uid_t uid);
-int extendarray(char ***buf, int *buflen, int needed);
+void copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid,
+    gid_t gid, int flags);
+void rm_r(int rootfd, char const * dir, uid_t uid);
 __END_DECLS
 
 #endif                         /* !_PWUPD_H */