pwupd.c (d6f907dc7a4aab1976e3040243e0242717dc13cb) | pwupd.c (48aee7f33a5dce843b51b7907af59573f8d3a7c4) |
---|---|
1/*- 2 * Copyright (c) 1996 by David L. Nugent <davidn@blaze.net.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 31 unchanged lines hidden (view full) --- 40#include <errno.h> 41#include <sys/types.h> 42#include <sys/stat.h> 43#include <sys/wait.h> 44#include <stdarg.h> 45 46#include "pwupd.h" 47 | 1/*- 2 * Copyright (c) 1996 by David L. Nugent <davidn@blaze.net.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 31 unchanged lines hidden (view full) --- 40#include <errno.h> 41#include <sys/types.h> 42#include <sys/stat.h> 43#include <sys/wait.h> 44#include <stdarg.h> 45 46#include "pwupd.h" 47 |
48#define HAVE_PWDB_C 1 49 |
|
48static int 49pwdb(char *arg,...) 50{ 51 int i = 0; 52 pid_t pid; 53 va_list ap; 54 char *args[8]; 55 --- 53 unchanged lines hidden (view full) --- 109pw_update(struct passwd * pwd, char const * user, int mode) 110{ 111 int rc = 0; 112 113 endpwent(); 114 115 /* 116 * First, let's check the see if the database is alright | 50static int 51pwdb(char *arg,...) 52{ 53 int i = 0; 54 pid_t pid; 55 va_list ap; 56 char *args[8]; 57 --- 53 unchanged lines hidden (view full) --- 111pw_update(struct passwd * pwd, char const * user, int mode) 112{ 113 int rc = 0; 114 115 endpwent(); 116 117 /* 118 * First, let's check the see if the database is alright |
119 * Note: -c is only available in FreeBSD 2.2 and above |
|
117 */ | 120 */ |
121#ifdef HAVE_PWDB_C |
|
118 if (pwdb("-c", NULL) == 0) { /* Check only */ | 122 if (pwdb("-c", NULL) == 0) { /* Check only */ |
123#else 124 { /* No -c */ 125#endif |
|
119 char pfx[32]; 120 char pwbuf[MAXPWLINE]; 121 int l = sprintf(pfx, "%s:", user); 122 123 /* 124 * Update the passwd file first 125 */ 126 if (pwd == NULL) --- 34 unchanged lines hidden --- | 126 char pfx[32]; 127 char pwbuf[MAXPWLINE]; 128 int l = sprintf(pfx, "%s:", user); 129 130 /* 131 * Update the passwd file first 132 */ 133 if (pwd == NULL) --- 34 unchanged lines hidden --- |