* libmisc/utmp.c, src/userdel.c, src/logoutd.c: Replace #if by #ifdef
This commit is contained in:
parent
90cc7f0f1d
commit
dd85562fac
@ -1,3 +1,7 @@
|
|||||||
|
2009-04-28 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* libmisc/utmp.c, src/userdel.c, src/logoutd.c: Replace #if by #ifdef
|
||||||
|
|
||||||
2009-04-28 Nicolas François <nicolas.francois@centraliens.net>
|
2009-04-28 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/vipw.c: Harmonize messages.
|
* src/vipw.c: Harmonize messages.
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
|
||||||
#if USE_UTMPX
|
#ifdef USE_UTMPX
|
||||||
#include <utmpx.h>
|
#include <utmpx.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -54,21 +54,21 @@ char *Prog;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
#if HAVE_UTMPX_H
|
#ifdef USE_UTMPX
|
||||||
static int check_login (const struct utmpx *ut);
|
static int check_login (const struct utmpx *ut);
|
||||||
#else
|
#else /* !USE_UTMPX */
|
||||||
static int check_login (const struct utmp *ut);
|
static int check_login (const struct utmp *ut);
|
||||||
#endif
|
#endif /* !USE_UTMPX */
|
||||||
static void send_mesg_to_tty (int tty_fd);
|
static void send_mesg_to_tty (int tty_fd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check_login - check if user (struct utmpx/utmp) allowed to stay logged in
|
* check_login - check if user (struct utmpx/utmp) allowed to stay logged in
|
||||||
*/
|
*/
|
||||||
#if HAVE_UTMPX_H
|
#ifdef USE_UTMPX
|
||||||
static int check_login (const struct utmpx *ut)
|
static int check_login (const struct utmpx *ut)
|
||||||
#else
|
#else /* !USE_UTMPX */
|
||||||
static int check_login (const struct utmp *ut)
|
static int check_login (const struct utmp *ut)
|
||||||
#endif
|
#endif /* !USE_UTMPX */
|
||||||
{
|
{
|
||||||
char user[sizeof (ut->ut_user) + 1];
|
char user[sizeof (ut->ut_user) + 1];
|
||||||
time_t now;
|
time_t now;
|
||||||
@ -147,11 +147,11 @@ int main (int argc, char **argv)
|
|||||||
int status;
|
int status;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
#if HAVE_UTMPX_H
|
#ifdef USE_UTMPX
|
||||||
struct utmpx *ut;
|
struct utmpx *ut;
|
||||||
#else
|
#else /* !USE_UTMPX */
|
||||||
struct utmp *ut;
|
struct utmp *ut;
|
||||||
#endif
|
#endif /* !USE_UTMPX */
|
||||||
char user[sizeof (ut->ut_user) + 1]; /* terminating NUL */
|
char user[sizeof (ut->ut_user) + 1]; /* terminating NUL */
|
||||||
char tty_name[sizeof (ut->ut_line) + 6]; /* /dev/ + NUL */
|
char tty_name[sizeof (ut->ut_line) + 6]; /* /dev/ + NUL */
|
||||||
int tty_fd;
|
int tty_fd;
|
||||||
@ -200,22 +200,22 @@ int main (int argc, char **argv)
|
|||||||
* Attempt to re-open the utmpx/utmp file. The file is only
|
* Attempt to re-open the utmpx/utmp file. The file is only
|
||||||
* open while it is being used.
|
* open while it is being used.
|
||||||
*/
|
*/
|
||||||
#if HAVE_UTMPX_H
|
#ifdef USE_UTMPX
|
||||||
setutxent ();
|
setutxent ();
|
||||||
#else
|
#else /* !USE_UTMPX */
|
||||||
setutent ();
|
setutent ();
|
||||||
#endif
|
#endif /* !USE_UTMPX */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read all of the entries in the utmpx/utmp file. The entries
|
* Read all of the entries in the utmpx/utmp file. The entries
|
||||||
* for login sessions will be checked to see if the user
|
* for login sessions will be checked to see if the user
|
||||||
* is permitted to be signed on at this time.
|
* is permitted to be signed on at this time.
|
||||||
*/
|
*/
|
||||||
#if HAVE_UTMPX_H
|
#ifdef USE_UTMPX
|
||||||
while ((ut = getutxent ()) != NULL)
|
while ((ut = getutxent ()) != NULL)
|
||||||
#else
|
#else /* !USE_UTMPX */
|
||||||
while ((ut = getutent ()) != NULL)
|
while ((ut = getutent ()) != NULL)
|
||||||
#endif
|
#endif /* !USE_UTMPX */
|
||||||
{
|
{
|
||||||
if (ut->ut_type != USER_PROCESS) {
|
if (ut->ut_type != USER_PROCESS) {
|
||||||
continue;
|
continue;
|
||||||
@ -279,11 +279,11 @@ int main (int argc, char **argv)
|
|||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_UTMPX_H
|
#ifdef USE_UTMPX
|
||||||
endutxent ();
|
endutxent ();
|
||||||
#else
|
#else /* !USE_UTMPX */
|
||||||
endutent ();
|
endutent ();
|
||||||
#endif
|
#endif /* !USE_UTMPX */
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
sleep (60);
|
sleep (60);
|
||||||
|
@ -590,17 +590,17 @@ static void user_busy (const char *name, uid_t uid)
|
|||||||
* We see if the user is logged in by looking for the user name
|
* We see if the user is logged in by looking for the user name
|
||||||
* in the utmp file.
|
* in the utmp file.
|
||||||
*/
|
*/
|
||||||
#if HAVE_UTMPX_H
|
#ifdef USE_UTMPX
|
||||||
struct utmpx *utent;
|
struct utmpx *utent;
|
||||||
|
|
||||||
setutxent ();
|
setutxent ();
|
||||||
while ((utent = getutxent ()) != NULL)
|
while ((utent = getutxent ()) != NULL)
|
||||||
#else
|
#else /* !USE_UTMPX */
|
||||||
struct utmp *utent;
|
struct utmp *utent;
|
||||||
|
|
||||||
setutent ();
|
setutent ();
|
||||||
while ((utent = getutent ()) != NULL)
|
while ((utent = getutent ()) != NULL)
|
||||||
#endif
|
#endif /* !USE_UTMPX */
|
||||||
{
|
{
|
||||||
if (utent->ut_type != USER_PROCESS)
|
if (utent->ut_type != USER_PROCESS)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user