mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-01-19 16:10:45 +00:00
- (djm) [loginrec.c] __func__ifiy
This commit is contained in:
parent
8899ed3b62
commit
6b0279c084
@ -1,6 +1,7 @@
|
||||
20040912
|
||||
- (djm) [loginrec.c] Start KNF and tidy up of this long-neglected file.
|
||||
No change in resultant binary
|
||||
- (djm) [loginrec.c] __func__ifiy
|
||||
|
||||
20040911
|
||||
- (djm) [ssh-agent.c] unifdef some cygwin code; ok dtucker@
|
||||
@ -1738,4 +1739,4 @@
|
||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||
|
||||
$Id: ChangeLog,v 1.3548 2004/09/12 05:23:14 djm Exp $
|
||||
$Id: ChangeLog,v 1.3549 2004/09/12 05:25:17 djm Exp $
|
||||
|
68
loginrec.c
68
loginrec.c
@ -140,7 +140,7 @@
|
||||
# include <libutil.h>
|
||||
#endif
|
||||
|
||||
RCSID("$Id: loginrec.c,v 1.60 2004/09/12 05:18:55 djm Exp $");
|
||||
RCSID("$Id: loginrec.c,v 1.61 2004/09/12 05:25:17 djm Exp $");
|
||||
|
||||
/**
|
||||
** prototypes for helper functions in this file
|
||||
@ -266,7 +266,7 @@ login_get_lastlog(struct logininfo *li, const int uid)
|
||||
*/
|
||||
pw = getpwuid(uid);
|
||||
if (pw == NULL)
|
||||
fatal("login_get_lastlog: Cannot find account for uid %i", uid);
|
||||
fatal("%s: Cannot find account for uid %i", __func__, uid);
|
||||
|
||||
/* No MIN_SIZEOF here - we absolutely *must not* truncate the
|
||||
* username (XXX - so check for trunc!) */
|
||||
@ -335,7 +335,7 @@ login_init_entry(struct logininfo *li, int pid, const char *username,
|
||||
strlcpy(li->username, username, sizeof(li->username));
|
||||
pw = getpwnam(li->username);
|
||||
if (pw == NULL) {
|
||||
fatal("login_init_entry: Cannot find user \"%s\"",
|
||||
fatal("%s: Cannot find user \"%s\"", __func__,
|
||||
li->username);
|
||||
}
|
||||
li->uid = pw->pw_uid;
|
||||
@ -864,12 +864,12 @@ utmp_perform_login(struct logininfo *li)
|
||||
construct_utmp(li, &ut);
|
||||
# ifdef UTMP_USE_LIBRARY
|
||||
if (!utmp_write_library(li, &ut)) {
|
||||
logit("utmp_perform_login: utmp_write_library() failed");
|
||||
logit("%s: utmp_write_library() failed", __func__);
|
||||
return (0);
|
||||
}
|
||||
# else
|
||||
if (!utmp_write_direct(li, &ut)) {
|
||||
logit("utmp_perform_login: utmp_write_direct() failed");
|
||||
logit("%s: utmp_write_direct() failed", __func__);
|
||||
return (0);
|
||||
}
|
||||
# endif
|
||||
@ -885,12 +885,12 @@ utmp_perform_logout(struct logininfo *li)
|
||||
construct_utmp(li, &ut);
|
||||
# ifdef UTMP_USE_LIBRARY
|
||||
if (!utmp_write_library(li, &ut)) {
|
||||
logit("utmp_perform_logout: utmp_write_library() failed");
|
||||
logit("%s: utmp_write_library() failed", __func__);
|
||||
return (0);
|
||||
}
|
||||
# else
|
||||
if (!utmp_write_direct(li, &ut)) {
|
||||
logit("utmp_perform_logout: utmp_write_direct() failed");
|
||||
logit("%s: utmp_write_direct() failed", __func__);
|
||||
return (0);
|
||||
}
|
||||
# endif
|
||||
@ -909,7 +909,7 @@ utmp_write_entry(struct logininfo *li)
|
||||
return (utmp_perform_logout(li));
|
||||
|
||||
default:
|
||||
logit("utmp_write_entry: invalid type field");
|
||||
logit("%s: invalid type field", __func__);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -950,7 +950,7 @@ utmpx_write_library(struct logininfo *li, struct utmpx *utx)
|
||||
static int
|
||||
utmpx_write_direct(struct logininfo *li, struct utmpx *utx)
|
||||
{
|
||||
logit("utmpx_write_direct: not implemented!");
|
||||
logit("%s: not implemented!", __func__);
|
||||
return (0);
|
||||
}
|
||||
# endif /* UTMPX_USE_LIBRARY */
|
||||
@ -963,12 +963,12 @@ utmpx_perform_login(struct logininfo *li)
|
||||
construct_utmpx(li, &utx);
|
||||
# ifdef UTMPX_USE_LIBRARY
|
||||
if (!utmpx_write_library(li, &utx)) {
|
||||
logit("utmpx_perform_login: utmp_write_library() failed");
|
||||
logit("%s: utmp_write_library() failed", __func__);
|
||||
return (0);
|
||||
}
|
||||
# else
|
||||
if (!utmpx_write_direct(li, &ut)) {
|
||||
logit("utmpx_perform_login: utmp_write_direct() failed");
|
||||
logit("%s: utmp_write_direct() failed", __func__);
|
||||
return (0);
|
||||
}
|
||||
# endif
|
||||
@ -1006,7 +1006,7 @@ utmpx_write_entry(struct logininfo *li)
|
||||
case LTYPE_LOGOUT:
|
||||
return (utmpx_perform_logout(li));
|
||||
default:
|
||||
logit("utmpx_write_entry: invalid type field");
|
||||
logit("%s: invalid type field", __func__);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -1030,14 +1030,14 @@ wtmp_write(struct logininfo *li, struct utmp *ut)
|
||||
int fd, ret = 1;
|
||||
|
||||
if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) < 0) {
|
||||
logit("wtmp_write: problem writing %s: %s",
|
||||
logit("%s: problem writing %s: %s", __func__,
|
||||
WTMP_FILE, strerror(errno));
|
||||
return (0);
|
||||
}
|
||||
if (fstat(fd, &buf) == 0)
|
||||
if (atomicio(vwrite, fd, ut, sizeof(*ut)) != sizeof(*ut)) {
|
||||
ftruncate(fd, buf.st_size);
|
||||
logit("wtmp_write: problem writing %s: %s",
|
||||
logit("%s: problem writing %s: %s", __func__,
|
||||
WTMP_FILE, strerror(errno));
|
||||
ret = 0;
|
||||
}
|
||||
@ -1074,7 +1074,7 @@ wtmp_write_entry(struct logininfo *li)
|
||||
case LTYPE_LOGOUT:
|
||||
return (wtmp_perform_logout(li));
|
||||
default:
|
||||
logit("wtmp_write_entry: invalid type field");
|
||||
logit("%s: invalid type field", __func__);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -1124,12 +1124,12 @@ wtmp_get_entry(struct logininfo *li)
|
||||
li->tv_sec = li->tv_usec = 0;
|
||||
|
||||
if ((fd = open(WTMP_FILE, O_RDONLY)) < 0) {
|
||||
logit("wtmp_get_entry: problem opening %s: %s",
|
||||
logit("%s: problem opening %s: %s", __func__,
|
||||
WTMP_FILE, strerror(errno));
|
||||
return (0);
|
||||
}
|
||||
if (fstat(fd, &st) != 0) {
|
||||
logit("wtmp_get_entry: couldn't stat %s: %s",
|
||||
logit("%s: couldn't stat %s: %s", __func__,
|
||||
WTMP_FILE, strerror(errno));
|
||||
close(fd);
|
||||
return (0);
|
||||
@ -1144,7 +1144,7 @@ wtmp_get_entry(struct logininfo *li)
|
||||
|
||||
while (!found) {
|
||||
if (atomicio(read, fd, &ut, sizeof(ut)) != sizeof(ut)) {
|
||||
logit("wtmp_get_entry: read of %s failed: %s",
|
||||
logit("%s: read of %s failed: %s", __func__,
|
||||
WTMP_FILE, strerror(errno));
|
||||
close (fd);
|
||||
return (0);
|
||||
@ -1202,7 +1202,7 @@ wtmpx_write(struct logininfo *li, struct utmpx *utx)
|
||||
int fd, ret = 1;
|
||||
|
||||
if ((fd = open(WTMPX_FILE, O_WRONLY|O_APPEND, 0)) < 0) {
|
||||
logit("wtmpx_write: problem opening %s: %s",
|
||||
logit("%s: problem opening %s: %s", __func__,
|
||||
WTMPX_FILE, strerror(errno));
|
||||
return (0);
|
||||
}
|
||||
@ -1210,7 +1210,7 @@ wtmpx_write(struct logininfo *li, struct utmpx *utx)
|
||||
if (fstat(fd, &buf) == 0)
|
||||
if (atomicio(vwrite, fd, utx, sizeof(*utx)) != sizeof(*utx)) {
|
||||
ftruncate(fd, buf.st_size);
|
||||
logit("wtmpx_write: problem writing %s: %s",
|
||||
logit("%s: problem writing %s: %s", __func__,
|
||||
WTMPX_FILE, strerror(errno));
|
||||
ret = 0;
|
||||
}
|
||||
@ -1253,7 +1253,7 @@ wtmpx_write_entry(struct logininfo *li)
|
||||
case LTYPE_LOGOUT:
|
||||
return (wtmpx_perform_logout(li));
|
||||
default:
|
||||
logit("wtmpx_write_entry: invalid type field");
|
||||
logit("%s: invalid type field", __func__);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -1289,12 +1289,12 @@ wtmpx_get_entry(struct logininfo *li)
|
||||
li->tv_sec = li->tv_usec = 0;
|
||||
|
||||
if ((fd = open(WTMPX_FILE, O_RDONLY)) < 0) {
|
||||
logit("wtmpx_get_entry: problem opening %s: %s",
|
||||
logit("%s: problem opening %s: %s", __func__,
|
||||
WTMPX_FILE, strerror(errno));
|
||||
return (0);
|
||||
}
|
||||
if (fstat(fd, &st) != 0) {
|
||||
logit("wtmpx_get_entry: couldn't stat %s: %s",
|
||||
logit("%s: couldn't stat %s: %s", __func__,
|
||||
WTMPX_FILE, strerror(errno));
|
||||
close(fd);
|
||||
return (0);
|
||||
@ -1309,7 +1309,7 @@ wtmpx_get_entry(struct logininfo *li)
|
||||
|
||||
while (!found) {
|
||||
if (atomicio(read, fd, &utx, sizeof(utx)) != sizeof(utx)) {
|
||||
logit("wtmpx_get_entry: read of %s failed: %s",
|
||||
logit("%s: read of %s failed: %s", __func__,
|
||||
WTMPX_FILE, strerror(errno));
|
||||
close (fd);
|
||||
return (0);
|
||||
@ -1354,7 +1354,7 @@ syslogin_perform_login(struct logininfo *li)
|
||||
struct utmp *ut;
|
||||
|
||||
if ((ut = (struct utmp *)malloc(sizeof(*ut))) == NULL) {
|
||||
logit("syslogin_perform_login: couldn't malloc()");
|
||||
logit("%s: couldn't malloc()", __func__);
|
||||
return (0);
|
||||
}
|
||||
construct_utmp(li, ut);
|
||||
@ -1373,7 +1373,7 @@ syslogin_perform_logout(struct logininfo *li)
|
||||
(void)line_stripname(line, li->line, sizeof(line));
|
||||
|
||||
if (!logout(line))
|
||||
logit("syslogin_perform_logout: logout() returned an error");
|
||||
logit("%s: logout() returned an error", __func__);
|
||||
# ifdef HAVE_LOGWTMP
|
||||
else
|
||||
logwtmp(line, "", "");
|
||||
@ -1395,7 +1395,7 @@ syslogin_write_entry(struct logininfo *li)
|
||||
case LTYPE_LOGOUT:
|
||||
return (syslogin_perform_logout(li));
|
||||
default:
|
||||
logit("syslogin_write_entry: Invalid type field");
|
||||
logit("%s: Invalid type field", __func__);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -1430,7 +1430,7 @@ lastlog_filetype(char *filename)
|
||||
struct stat st;
|
||||
|
||||
if (stat(LASTLOG_FILE, &st) != 0) {
|
||||
logit("lastlog_perform_login: Couldn't stat %s: %s",
|
||||
logit("%s: Couldn't stat %s: %s", __func__,
|
||||
LASTLOG_FILE, strerror(errno));
|
||||
return (0);
|
||||
}
|
||||
@ -1462,14 +1462,14 @@ lastlog_openseek(struct logininfo *li, int *fd, int filemode)
|
||||
LASTLOG_FILE, li->username);
|
||||
break;
|
||||
default:
|
||||
logit("lastlog_openseek: %.100s is not a file or directory!",
|
||||
logit("%s: %.100s is not a file or directory!", __func__,
|
||||
LASTLOG_FILE);
|
||||
return (0);
|
||||
}
|
||||
|
||||
*fd = open(lastlog_file, filemode, 0600);
|
||||
if (*fd < 0) {
|
||||
debug("lastlog_openseek: Couldn't open %s: %s",
|
||||
debug("%s: Couldn't open %s: %s", __func__,
|
||||
lastlog_file, strerror(errno));
|
||||
return (0);
|
||||
}
|
||||
@ -1479,8 +1479,8 @@ lastlog_openseek(struct logininfo *li, int *fd, int filemode)
|
||||
offset = (off_t) ((long)li->uid * sizeof(struct lastlog));
|
||||
|
||||
if (lseek(*fd, offset, SEEK_SET) != offset) {
|
||||
logit("lastlog_openseek: %s->lseek(): %s",
|
||||
lastlog_file, strerror(errno));
|
||||
logit("%s: %s->lseek(): %s", __func__,
|
||||
lastlog_file, strerror(errno));
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -1503,7 +1503,7 @@ lastlog_perform_login(struct logininfo *li)
|
||||
/* write the entry */
|
||||
if (atomicio(vwrite, fd, &last, sizeof(last)) != sizeof(last)) {
|
||||
close(fd);
|
||||
logit("lastlog_write_filemode: Error writing to %s: %s",
|
||||
logit("%s: Error writing to %s: %s", __func__,
|
||||
LASTLOG_FILE, strerror(errno));
|
||||
return (0);
|
||||
}
|
||||
@ -1519,7 +1519,7 @@ lastlog_write_entry(struct logininfo *li)
|
||||
case LTYPE_LOGIN:
|
||||
return (lastlog_perform_login(li));
|
||||
default:
|
||||
logit("lastlog_write_entry: Invalid type field");
|
||||
logit("%s: Invalid type field", __func__);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user