]> git.armaanb.net Git - opendoas.git/blob - libopenbsd/openbsd.h
Add proper pam session handling
[opendoas.git] / libopenbsd / openbsd.h
1 #ifndef _LIB_OPENBSD_H_
2 #define _LIB_OPENBSD_H_
3
4 #include <stdarg.h>
5 #include <sys/types.h>
6 #include <sys/cdefs.h>
7
8 #include "readpassphrase.h"
9
10 /* API definitions lifted from OpenBSD src/include */
11
12 /* login_cap.h */
13 #ifndef HAVE_LOGIN_CAP_H
14 #define        LOGIN_SETGROUP          0x0001  /* Set group */
15 #define        LOGIN_SETLOGIN          0x0002  /* Set login */
16 #define        LOGIN_SETPATH           0x0004  /* Set path */
17 #define        LOGIN_SETPRIORITY       0x0008  /* Set priority */
18 #define        LOGIN_SETRESOURCES      0x0010  /* Set resource limits */
19 #define        LOGIN_SETUMASK          0x0020  /* Set umask */
20 #define        LOGIN_SETUSER           0x0040  /* Set user */
21 #define        LOGIN_SETENV            0x0080  /* Set environment */
22 #define        LOGIN_SETALL            0x00ff  /* Set all. */
23
24 typedef struct login_cap login_cap_t;
25 struct passwd;
26 int setusercontext(login_cap_t *, struct passwd *, uid_t, unsigned int);
27 #endif /* !HAVE_LOGIN_CAP_H */
28
29 /* pwd.h */
30 #define _PW_NAME_LEN 63
31
32 /* stdlib.h */
33 #ifndef HAVE_REALLOCARRAY
34 void * reallocarray(void *optr, size_t nmemb, size_t size);
35 #endif /* HAVE_REALLOCARRAY */
36 #ifndef HAVE_STRTONUM
37 long long strtonum(const char *numstr, long long minval,
38                 long long maxval, const char **errstrp);
39 #endif /* !HAVE_STRTONUM */
40
41 /* string.h */
42 #ifndef HAVE_EXPLICIT_BZERO
43 void explicit_bzero(void *, size_t);
44 #endif
45 #ifndef HAVE_STRLCAT
46 size_t strlcat(char *dst, const char *src, size_t dsize);
47 #endif /* !HAVE_STRLCAT */
48 #ifndef HAVE_STRLCPY
49 size_t strlcpy(char *dst, const char *src, size_t dsize);
50 #endif /* !HAVE_STRLCPY */
51
52 /* unistd.h */
53 #ifndef HAVE_EXECVPE
54 int execvpe(const char *, char *const *, char *const *);
55 #endif /* !HAVE_EXECVPE */
56 #ifndef HAVE_SETRESUID
57 int setresuid(uid_t, uid_t, uid_t);
58 #endif /* !HAVE_SETRESUID */
59 #ifndef HAVE_PLEDGE
60 int pledge(const char *promises, const char *paths[]);
61 #endif /* !HAVE_PLEDGE */
62
63 /* err.h */
64 #ifndef HAVE_VERRC
65 void verrc(int eval, int code, const char *fmt, va_list ap);
66 #endif /* !HAVE_VERRC */
67 #ifndef HAVE_ERRC
68 void errc(int eval, int code, const char *fmt, ...);
69 #endif /* !HAVE_ERRC */
70
71 #ifndef HAVE_SETPROGNAME
72 const char * getprogname(void);
73 void setprogname(const char *progname);
74 #endif /* !HAVE_SETPROGNAME */
75
76 #endif /* _LIB_OPENBSD_H_ */