Ported to OpenBSD
This commit is contained in:
@@ -213,7 +213,7 @@ int execute(char **args, char *in, char *out, char *err)
|
||||
|
||||
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
static void fail_exit(int status)
|
||||
{
|
||||
// gr_unlock();
|
||||
@@ -627,7 +627,7 @@ static int new_password(const struct passwd *pw, char *newpasswd)
|
||||
}
|
||||
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
|
||||
static void update_noshadow(int shadow_locked)
|
||||
{
|
||||
@@ -751,7 +751,7 @@ static void update_noshadow(int shadow_locked)
|
||||
pw_unlock();
|
||||
}
|
||||
|
||||
#endif /* Not __FreeBSD__ && __NetBSD__ */
|
||||
#endif /* Not __FreeBSD__ && __NetBSD__ && __OpenBSD__ */
|
||||
|
||||
|
||||
#ifdef SHADOW_PASSWORD
|
||||
@@ -815,7 +815,7 @@ static void update_shadow(void)
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
const struct passwd *pw;
|
||||
const struct group *gr;
|
||||
#ifdef SHADOW_PASSWORD
|
||||
@@ -971,7 +971,7 @@ int main(int argc, char *argv[])
|
||||
* to root to protect against unexpected signals. Any
|
||||
* keyboard signals are set to be ignored.
|
||||
*/
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
pwd_init();
|
||||
#else
|
||||
pw_init();
|
||||
@@ -985,7 +985,7 @@ int main(int argc, char *argv[])
|
||||
exit(E_FAILURE);
|
||||
}
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
|
||||
#ifdef HAVE_USERSEC_H
|
||||
update_userpw(pw->pw_passwd);
|
||||
@@ -999,7 +999,7 @@ int main(int argc, char *argv[])
|
||||
update_noshadow(0);
|
||||
#endif /* !HAVE_USERSEC_H */
|
||||
|
||||
#else /* __FreeBSD__ && __NetBSD__ */
|
||||
#else /* __FreeBSD__ && __NetBSD__ && __OpenBSD__ */
|
||||
/*
|
||||
* FreeBSD password change, borrowed from the original FreeBSD sources
|
||||
*/
|
||||
@@ -1018,7 +1018,7 @@ int main(int argc, char *argv[])
|
||||
if (!pw_mkdb(pw->pw_name))
|
||||
pw_error((char *)NULL, 0, 1);
|
||||
|
||||
#endif /* __FreeBSD__ */
|
||||
#endif /* __FreeBSD__ && __NetBSD__ && __OpenBSD__ */
|
||||
|
||||
#ifdef _VPOPMAIL_PATH
|
||||
fflush(stdout);
|
||||
|
@@ -30,7 +30,7 @@ char *crypt_make_salt(void);
|
||||
char *pw_encrypt(const char *, const char *);
|
||||
int i64c(int);
|
||||
char *l64a(long);
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
static void fail_exit(int);
|
||||
static void oom(void);
|
||||
static void update_noshadow(int);
|
||||
|
@@ -198,7 +198,7 @@ int main(int argc, char *argv[])
|
||||
* Build command to add user entry to the /etc/passwd and /etc/shadow
|
||||
* files. We use the systems own useradd program.
|
||||
*/
|
||||
#if defined(__linux__) || defined(__NetBSD__)
|
||||
#if defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
if ((access("/usr/bin/useradd", R_OK)) == 0)
|
||||
args[0] = (char *)"/usr/bin/useradd";
|
||||
else if ((access("/bin/useradd", R_OK)) == 0)
|
||||
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
|
||||
args[9] = argv[2];
|
||||
args[10] = NULL;
|
||||
#endif
|
||||
#if defined(__NetBSD__)
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
args[1] = (char *)"-c";
|
||||
args[2] = argv[3];
|
||||
args[3] = (char *)"-d";
|
||||
|
@@ -62,7 +62,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
||||
#include "../config.h"
|
||||
#include <sys/param.h>
|
||||
@@ -196,12 +196,12 @@ int pw_mkdb(char *username)
|
||||
execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL);
|
||||
} else {
|
||||
syslog(LOG_WARNING, "updating the database for %s...", username);
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-u", username, tempname, NULL);
|
||||
#elif __NetBSD__
|
||||
#elif defined(__NetBSD__)
|
||||
execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL);
|
||||
#else
|
||||
#error "Not FreeBSD or NetBSD - don't know what to do"
|
||||
#error "Not FreeBSD, OpenBSD or NetBSD - don't know what to do"
|
||||
#endif
|
||||
}
|
||||
pw_error((char *)_PATH_PWD_MKDB, 1, 1);
|
||||
@@ -285,7 +285,7 @@ void pw_copy(int ffd, int tfd, struct passwd *pw)
|
||||
goto err;
|
||||
continue;
|
||||
}
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__)
|
||||
(void)fprintf(to, "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n",
|
||||
pw->pw_name, pw->pw_passwd,
|
||||
pw->pw_fields & _PWF_UID ? uidstr : "",
|
||||
@@ -294,7 +294,7 @@ void pw_copy(int ffd, int tfd, struct passwd *pw)
|
||||
pw->pw_fields & _PWF_CHANGE ? chgstr : "",
|
||||
pw->pw_fields & _PWF_EXPIRE ? expstr : "",
|
||||
pw->pw_gecos, pw->pw_dir, pw->pw_shell);
|
||||
#elif __NetBSD__
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
(void)fprintf(to, "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n",
|
||||
pw->pw_name, pw->pw_passwd,
|
||||
uidstr, gidstr,
|
||||
@@ -302,7 +302,7 @@ void pw_copy(int ffd, int tfd, struct passwd *pw)
|
||||
chgstr, expstr,
|
||||
pw->pw_gecos, pw->pw_dir, pw->pw_shell);
|
||||
#else
|
||||
#error "Not FreeBSD or NetBSD - don't know what to do"
|
||||
#error "Not FreeBSD, OpenBSD or NetBSD - don't know what to do"
|
||||
#endif
|
||||
done = 1;
|
||||
if (ferror(to))
|
||||
@@ -317,7 +317,7 @@ void pw_copy(int ffd, int tfd, struct passwd *pw)
|
||||
pw_error(NULL, 0, 1);
|
||||
} else
|
||||
#endif /* YP */
|
||||
#ifdef __FreeBSD__
|
||||
#if defined(__FreeBSD__)
|
||||
(void)fprintf(to, "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n",
|
||||
pw->pw_name, pw->pw_passwd,
|
||||
pw->pw_fields & _PWF_UID ? uidstr : "",
|
||||
@@ -326,7 +326,7 @@ void pw_copy(int ffd, int tfd, struct passwd *pw)
|
||||
pw->pw_fields & _PWF_CHANGE ? chgstr : "",
|
||||
pw->pw_fields & _PWF_EXPIRE ? expstr : "",
|
||||
pw->pw_gecos, pw->pw_dir, pw->pw_shell);
|
||||
#elif __NetBSD__
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
(void)fprintf(to, "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s\n",
|
||||
pw->pw_name, pw->pw_passwd,
|
||||
uidstr, gidstr,
|
||||
@@ -334,7 +334,7 @@ void pw_copy(int ffd, int tfd, struct passwd *pw)
|
||||
chgstr, expstr,
|
||||
pw->pw_gecos, pw->pw_dir, pw->pw_shell);
|
||||
#else
|
||||
#error "Not FreeBSD or NetBSD - don't know what to do"
|
||||
#error "Not FreeBSD, OpenBSD or NetBSD - don't know what to do"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#ifndef _PW_UTIL_H
|
||||
#define _PW_UTIL_H
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
||||
void pw_error __P((char *, int, int));
|
||||
void pw_init __P((void));
|
||||
|
@@ -30,7 +30,7 @@
|
||||
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
|
||||
#include "../config.h"
|
||||
#include <stdio.h>
|
||||
@@ -168,7 +168,7 @@ int pw_name(const char *filename)
|
||||
|
||||
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
int pw_lock(void)
|
||||
{
|
||||
return commonio_lock(&passwd_db);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#ifndef _PWIO_H
|
||||
#define _PWIO_H
|
||||
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__)
|
||||
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
||||
|
||||
#ifndef PASSWD_FILE
|
||||
#define PASSWD_FILE "/etc/passwd"
|
||||
|
@@ -398,10 +398,10 @@ void setutmp(const char *name, const char *line, const char *host)
|
||||
utent = utline;
|
||||
}
|
||||
|
||||
#elif __FreeBSD__ || __NetBSD__
|
||||
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__
|
||||
|
||||
/*
|
||||
* FreeBSD/NetBSD version, simple and mean.
|
||||
* FreeBSD/NetBSD/OpenBSD version, simple and mean.
|
||||
*/
|
||||
void setutmp(const char *name, const char *line, const char *host)
|
||||
{
|
||||
|
@@ -20,7 +20,7 @@ static void updwtmpx(const char *, const struct utmpx *);
|
||||
void setutmp(const char *, const char *, const char *);
|
||||
#elif HAVE_UTMPX_H
|
||||
void setutmp(const char *, const char *, const char *);
|
||||
#elif __FreeBSD__ || __NetBSD__
|
||||
#elif __FreeBSD__ || __NetBSD__ || __OpenBSD__
|
||||
void setutmp(const char *, const char *, const char *);
|
||||
#else /* !SVR4 */
|
||||
void setutmp(const char *, const char *);
|
||||
|
Reference in New Issue
Block a user