Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pwauth/auth_aix.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* status code. (This version for systems with a getuserpw() call.)
*/

int check_auth(char *login, char *passwd)
int check_auth(const char *login, const char *passwd)
{
char *cpass;
struct userpw *upwd= getuserpw(login);
Expand Down Expand Up @@ -85,7 +85,7 @@ int check_auth(char *login, char *passwd)
* interface and return a status code.
*/

int check_auth(char *login, char *passwd)
int check_auth(const char *login, const char *passwd)
{
char *cpass;
char *message;
Expand Down
2 changes: 1 addition & 1 deletion pwauth/auth_bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* (This version for systems with only a getpwnam() call.)
*/

int check_auth(char *login, char *passwd)
int check_auth(const char *login, const char *passwd)
{
char *cpass;
struct passwd *pwd= getpwnam(login);
Expand Down
2 changes: 1 addition & 1 deletion pwauth/auth_hpux.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* (This version for systems with a getprpwnam() call.)
*/

int check_auth(char *login, char *passwd)
int check_auth(const char *login, const char *passwd)
{
char *cpass;
struct pr_passwd *pwd= getprpwnam(login);
Expand Down
6 changes: 3 additions & 3 deletions pwauth/auth_mdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include <pwd.h>
#endif
#include <shadow.h> /* is -I/usr/local/include on gcc command? */
char *kg_pwhash(char *clear, char *user, char *result, int resultlen);
char *pw_encrypt();
char *kg_pwhash(const char *clear, const char *user, char *result, int resultlen);
char *pw_encrypt(const char *clear, const char *salt);
#endif /* SHADOW_MDW */

#ifdef SHADOW_MDW
Expand All @@ -50,7 +50,7 @@ char *pw_encrypt();
* (This version for systems with kg_pwhash() call.)
*/

int check_auth(char *login, char *passwd)
int check_auth(const char *login, const char *passwd)
{
char *cpass;
char bf[40];
Expand Down
2 changes: 1 addition & 1 deletion pwauth/auth_openbsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* (This version for systems with auth_usercheck() call.)
*/

int check_auth(char *login, char *passwd)
int check_auth(const char *login, const char *passwd)
{
auth_session_t *as;
login_cap_t *lc;
Expand Down
6 changes: 3 additions & 3 deletions pwauth/auth_pam.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
/* Application data structure passed to PAM_conv: */

struct ad_user {
char *login;
char *passwd;
const char *login;
const char *passwd;
};

/* The pam_unix.so library in Solaris 2.6 fails to pass along appdata_ptr
Expand Down Expand Up @@ -150,7 +150,7 @@ int PAM_conv (int num_msg, const struct pam_message **msg,
* (This version for systems using PAM.)
*/

int check_auth(char *login, char *passwd)
int check_auth(const char *login, const char *passwd)
{
#ifndef PAM_SOLARIS_26
struct ad_user user_info= {login, passwd};
Expand Down
10 changes: 5 additions & 5 deletions pwauth/auth_sun.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
#include <pwd.h>
#endif
#include <shadow.h>
struct spwd *getspnam();
char *crypt();
struct spwd *getspnam(const char *name);
char *crypt(const char *key, const char *salt);
#endif /* SHADOW_SUN */

#ifdef SHADOW_JFH
#ifdef NEED_UID
#include <pwd.h>
#endif
#include <shadow.h> /* this may be hidden in /usr/local/include */
struct spwd *getspnam();
char *pw_encrypt();
struct spwd *getspnam(const char *name);
char *pw_encrypt(const char *clear, const char *salt);
#endif /* SHADOW_JFH */

#if defined(SHADOW_JFH) || defined(SHADOW_SUN)
Expand All @@ -59,7 +59,7 @@ char *pw_encrypt();
* (This version for systems with getspnam() call.)
*/

int check_auth(char *login, char *passwd)
int check_auth(const char *login, const char *passwd)
{
char *cpass;
struct spwd *spwd= getspnam(login);
Expand Down
3 changes: 2 additions & 1 deletion pwauth/checkfaillog.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ int main(int argc, char **argv)
{
int i, j;
int reset= 0, verbose= 1;
char *user= NULL, *msg= NULL;
char *user= NULL;
const char *msg= NULL;
uid_t uid= getuid();

/* Parse command line */
Expand Down
15 changes: 8 additions & 7 deletions pwauth/fail_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <utmp.h>
#include <time.h>

#include "config.h"
#include "fail_log.h"
Expand All @@ -52,7 +53,7 @@
* <count> failures since last login. Last was <time> on <tty>.\n
*/

char *check_fails(uid_t uid, int reset, int verbose)
const char *check_fails(uid_t uid, int reset, int verbose)
{
struct faillog flog;
int flfd;
Expand Down Expand Up @@ -90,12 +91,12 @@ char *check_fails(uid_t uid, int reset, int verbose)
ct[19]= '\0';
if (now - flog.fail_time < (24*3600))
ct+= 11;
sprintf(buf,"%d %s since last login. Last was %s on %s.",
snprintf(buf, sizeof(buf), "%d %s since last login. Last was %s on %s.",
flog.fail_cnt, flog.fail_cnt == 1 ? "failure" : "failures",
ct, flog.fail_line);
}
else
sprintf(buf,"%d:%ld::%s",
snprintf(buf, sizeof(buf), "%d:%ld::%s",
flog.fail_cnt, flog.fail_time, flog.fail_line);

/* Reset the count, if that was desired */
Expand All @@ -120,7 +121,7 @@ char *check_fails(uid_t uid, int reset, int verbose)
* <count> failures since last login. Last was <time> from <host> on <tty>.\n
*/

char *check_fails(uid_t uid, int reset, int verbose)
const char *check_fails(uid_t uid, int reset, int verbose)
{
struct badlogin flog;
int flfd;
Expand Down Expand Up @@ -159,16 +160,16 @@ char *check_fails(uid_t uid, int reset, int verbose)
if (now - flog.bl_time < (24*3600))
ct+= 11;
if (flog.bl_host[0] != '\0')
sprintf(buf,"%d %s since last login. Last was %s from %s on %s.",
snprintf(buf, sizeof(buf), "%d %s since last login. Last was %s from %s on %s.",
flog.count, flog.count == 1 ? "failure" : "failures",
ct, flog.bl_host, flog.bl_line);
else
sprintf(buf,"%d %s since last login. Last was %s on %s.",
snprintf(buf, sizeof(buf), "%d %s since last login. Last was %s on %s.",
flog.count, flog.count == 1 ? "failure" : "failures",
ct, flog.bl_line);
}
else
sprintf(buf,"%d:%ld:%s:%s",
snprintf(buf, sizeof(buf), "%d:%ld:%s:%s",
flog.count, flog.bl_time, flog.bl_host, flog.bl_line);

/* Reset the count, if that was desired */
Expand Down
8 changes: 4 additions & 4 deletions pwauth/fail_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* uses this anymore, so I'm not going to bother implementing that.
*/

int check_fails()
int check_fails(void)
{
int result= 1;
struct faillog flog;
Expand All @@ -70,7 +70,7 @@ int check_fails()
/* LOG_FAILURE - Do whatever we need to do to log a failed login attempt.
*/

void log_failure()
void log_failure(void)
{
int flfd;
struct faillog flog;
Expand Down Expand Up @@ -112,7 +112,7 @@ void log_failure()
* been exceeded, then the count is reset to zero.
*/

int check_fails()
int check_fails(void)
{
int result= 1;
#if defined(MAX_FAIL_COUNT) || defined(RESET_FAIL_COUNT)
Expand Down Expand Up @@ -149,7 +149,7 @@ int check_fails()
/* LOG_FAILURE - Do whatever we need to do to log a failed login attempt.
*/

log_failure()
int log_failure(void)
{
int flfd;
struct badlogin flog;
Expand Down
6 changes: 3 additions & 3 deletions pwauth/lastlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
* =======================================================================
*/

#include <time.h>
#include <unistd.h>

#include "pwauth.h"

/* LASTLOG - update the system's lastlog */

#ifdef UNIX_LASTLOG
void lastlog()
void lastlog(void)
{
struct lastlog ll;
int fd;
Expand All @@ -57,7 +57,7 @@ void lastlog()

if ((fd= open(LASTLOG,O_WRONLY)) < 0) return;

lseek(fd, (long)(hisuid * sizeof(struct lastlog)), 0);
lseek(fd, (long)(hisuid * sizeof(struct lastlog)), SEEK_SET);
write(fd, &ll, sizeof(struct lastlog));
close(fd);
}
Expand Down
5 changes: 2 additions & 3 deletions pwauth/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ int server_uids[]= {SERVER_UIDS, 0};
#endif


int
main(int argc, char **argv)
int main(int argc, char **argv)
{
#ifdef ENV_METHOD
char *login, *passwd;
Expand All @@ -55,8 +54,8 @@ main(int argc, char **argv)
#endif
#ifdef SERVER_UIDS
int uid;
#endif
int i;
#endif
int status;
struct rlimit rlim;

Expand Down
2 changes: 1 addition & 1 deletion pwauth/nologin.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* uid is below MIN_NOLOGIN_UID.
*/

check_nologin()
int check_nologin(void)
{
/* Return true if the file does not exist (the access() function returns
* true if the file doesn't exist - pretty dumb, eh?) */
Expand Down
4 changes: 3 additions & 1 deletion pwauth/pwauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
Expand Down Expand Up @@ -130,4 +131,5 @@ extern int haveuid;

void snooze(int seconds);
void lastlog(void);
int check_auth(char *login, char *passwd);
int check_auth(const char *login, const char *passwd);
int check_nologin(void);
3 changes: 1 addition & 2 deletions pwauth/snooze.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
* sleep time, if other pwauth processes are in sleeps.
*/

void
snooze(int seconds)
void snooze(int seconds)
{
int slfd;
struct flock lock;
Expand Down