The functionality from this function is related to btmp.
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
const char *host,
/*@null@*/const struct utmp *ut);
extern int setutmp (struct utmp *ut);
+/*
+ * failtmp - update the cumulative failure log
+ *
+ * failtmp updates the (struct utmp) formatted failure log which
+ * maintains a record of all login failures.
+ */
+extern void failtmp (const char *username, const struct utmp *);
/* valid.c */
extern bool valid (const char *, const struct passwd *);
#include <unistd.h>
#include "defines.h"
#include "faillog.h"
-#include "getdef.h"
#include "failure.h"
#define YEAR (365L*DAY)
/*
fail->fail_cnt, lasttime, fail->fail_line);
/*@=formatconst@*/
}
-
-/*
- * failtmp - update the cumulative failure log
- *
- * failtmp updates the (struct utmp) formatted failure log which
- * maintains a record of all login failures.
- */
-
-void failtmp (const char *username, const struct utmp *failent)
-{
- const char *ftmp;
- int fd;
-
- /*
- * Get the name of the failure file. If no file has been defined
- * in login.defs, don't do this.
- */
-
- ftmp = getdef_str ("FTMP_FILE");
- if (NULL == ftmp) {
- return;
- }
-
- /*
- * Open the file for append. It must already exist for this
- * feature to be used.
- */
-
- if (access (ftmp, F_OK) != 0) {
- return;
- }
-
- fd = open (ftmp, O_WRONLY | O_APPEND);
- if (-1 == fd) {
- SYSLOG ((LOG_WARN,
- "Can't append failure of user %s to %s.",
- username, ftmp));
- return;
- }
-
- /*
- * Append the new failure record and close the log file.
- */
-
- if ( (write (fd, failent, sizeof *failent) != (ssize_t) sizeof *failent)
- || (close (fd) != 0)) {
- SYSLOG ((LOG_WARN,
- "Can't append failure of user %s to %s.",
- username, ftmp));
- (void) close (fd);
- }
-}
-
#include "defines.h"
#include "faillog.h"
-#include <utmp.h>
/*
* failure - make failure entry
*/
extern void failprint (const struct faillog *);
-/*
- * failtmp - update the cumulative failure log
- *
- * failtmp updates the (struct utmp) formatted failure log which
- * maintains a record of all login failures.
- */
-extern void failtmp (const char *username, const struct utmp *);
-
#endif
#include "defines.h"
#include "prototypes.h"
+#include "getdef.h"
#include <utmp.h>
#include <assert.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
+#include <fcntl.h>
#include "alloc.h"
return strcmp (full_tty, tmptty) == 0;
}
+/*
+ * failtmp - update the cumulative failure log
+ *
+ * failtmp updates the (struct utmp) formatted failure log which
+ * maintains a record of all login failures.
+ */
+void failtmp (const char *username, const struct utmp *failent)
+{
+ const char *ftmp;
+ int fd;
+
+ /*
+ * Get the name of the failure file. If no file has been defined
+ * in login.defs, don't do this.
+ */
+
+ ftmp = getdef_str ("FTMP_FILE");
+ if (NULL == ftmp) {
+ return;
+ }
+
+ /*
+ * Open the file for append. It must already exist for this
+ * feature to be used.
+ */
+
+ if (access (ftmp, F_OK) != 0) {
+ return;
+ }
+
+ fd = open (ftmp, O_WRONLY | O_APPEND);
+ if (-1 == fd) {
+ SYSLOG ((LOG_WARN,
+ "Can't append failure of user %s to %s.",
+ username, ftmp));
+ return;
+ }
+
+ /*
+ * Append the new failure record and close the log file.
+ */
+
+ if ( (write (fd, failent, sizeof *failent) != (ssize_t) sizeof *failent)
+ || (close (fd) != 0)) {
+ SYSLOG ((LOG_WARN,
+ "Can't append failure of user %s to %s.",
+ username, ftmp));
+ (void) close (fd);
+ }
+}
+
/*
* get_current_utmp - return the most probable utmp entry for the current
* session