From c61e14d3a8412cd50d98aab604e607692c844c8a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:33:30 +0200 Subject: Adding upstream version 2.40. Signed-off-by: Daniel Baumann --- liblastlog2/man/Makemodule.am | 20 ++++++ liblastlog2/man/lastlog2.3 | 67 ++++++++++++++++++++ liblastlog2/man/lastlog2.3.adoc | 51 +++++++++++++++ liblastlog2/man/ll2_import_lastlog.3 | 84 +++++++++++++++++++++++++ liblastlog2/man/ll2_import_lastlog.3.adoc | 65 +++++++++++++++++++ liblastlog2/man/ll2_read_all.3 | 93 ++++++++++++++++++++++++++++ liblastlog2/man/ll2_read_all.3.adoc | 74 ++++++++++++++++++++++ liblastlog2/man/ll2_read_entry.3 | 91 +++++++++++++++++++++++++++ liblastlog2/man/ll2_read_entry.3.adoc | 72 +++++++++++++++++++++ liblastlog2/man/ll2_remove_entry.3 | 82 ++++++++++++++++++++++++ liblastlog2/man/ll2_remove_entry.3.adoc | 63 +++++++++++++++++++ liblastlog2/man/ll2_rename_user.3 | 85 +++++++++++++++++++++++++ liblastlog2/man/ll2_rename_user.3.adoc | 66 ++++++++++++++++++++ liblastlog2/man/ll2_update_login_time.3 | 86 +++++++++++++++++++++++++ liblastlog2/man/ll2_update_login_time.3.adoc | 67 ++++++++++++++++++++ liblastlog2/man/ll2_write_entry.3 | 88 ++++++++++++++++++++++++++ liblastlog2/man/ll2_write_entry.3.adoc | 70 +++++++++++++++++++++ 17 files changed, 1224 insertions(+) create mode 100644 liblastlog2/man/Makemodule.am create mode 100644 liblastlog2/man/lastlog2.3 create mode 100644 liblastlog2/man/lastlog2.3.adoc create mode 100644 liblastlog2/man/ll2_import_lastlog.3 create mode 100644 liblastlog2/man/ll2_import_lastlog.3.adoc create mode 100644 liblastlog2/man/ll2_read_all.3 create mode 100644 liblastlog2/man/ll2_read_all.3.adoc create mode 100644 liblastlog2/man/ll2_read_entry.3 create mode 100644 liblastlog2/man/ll2_read_entry.3.adoc create mode 100644 liblastlog2/man/ll2_remove_entry.3 create mode 100644 liblastlog2/man/ll2_remove_entry.3.adoc create mode 100644 liblastlog2/man/ll2_rename_user.3 create mode 100644 liblastlog2/man/ll2_rename_user.3.adoc create mode 100644 liblastlog2/man/ll2_update_login_time.3 create mode 100644 liblastlog2/man/ll2_update_login_time.3.adoc create mode 100644 liblastlog2/man/ll2_write_entry.3 create mode 100644 liblastlog2/man/ll2_write_entry.3.adoc (limited to 'liblastlog2/man') diff --git a/liblastlog2/man/Makemodule.am b/liblastlog2/man/Makemodule.am new file mode 100644 index 0000000..803bfb7 --- /dev/null +++ b/liblastlog2/man/Makemodule.am @@ -0,0 +1,20 @@ + +MANPAGES += \ + liblastlog2/man/lastlog2.3 \ + liblastlog2/man/ll2_import_lastlog.3 \ + liblastlog2/man/ll2_read_all.3 \ + liblastlog2/man/ll2_read_entry.3 \ + liblastlog2/man/ll2_remove_entry.3 \ + liblastlog2/man/ll2_rename_user.3 \ + liblastlog2/man/ll2_update_login_time.3 \ + liblastlog2/man/ll2_write_entry.3 + +dist_noinst_DATA += \ + liblastlog2/man/lastlog2.3.adoc \ + liblastlog2/man/ll2_import_lastlog.3.adoc \ + liblastlog2/man/ll2_read_all.3.adoc \ + liblastlog2/man/ll2_read_entry.3.adoc \ + liblastlog2/man/ll2_remove_entry.3.adoc \ + liblastlog2/man/ll2_rename_user.3.adoc \ + liblastlog2/man/ll2_update_login_time.3.adoc \ + liblastlog2/man/ll2_write_entry.3.adoc diff --git a/liblastlog2/man/lastlog2.3 b/liblastlog2/man/lastlog2.3 new file mode 100644 index 0000000..b2ac0d7 --- /dev/null +++ b/liblastlog2/man/lastlog2.3 @@ -0,0 +1,67 @@ +'\" t +.\" Title: lastlog2 +.\" Author: [see the "AUTHOR(S)" section] +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2024-03-20 +.\" Manual: Programmer's Manual +.\" Source: util-linux 2.40 +.\" Language: English +.\" +.TH "LASTLOG2" "3" "2024-03-20" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +lastlog2 \- Y2038 safe version of lastlog library. +.SH "SYNOPSIS" +.sp +\fB#include \fP +.SH "DESCRIPTION" +.sp +\fBlastlog2\fP reports the last login of a given user or of all users who did ever login on a system. +.sp +It\(cqs using sqlite3 as database backend. Data is only collected via a PAM module, so that every +tools can make use of it, without modifying existing packages. +The output is as compatible as possible with the old lastlog implementation. +By default the database will be written as \f(CR/var/lib/lastlog/lastlog2.db\fP. +The size of the database depends on the amount of users, not how big the biggest UID is. +.SH "AUTHORS" +.sp +Thorsten Kukuk (\c +.MTO "kukuk\(atsuse.de" "" ")" +.SH "SEE ALSO" +.sp +\fBlastlog2\fP(3), +\fBll2_new_context(3), +*ll2_unref_context(3), +*ll2_write_entry\fP(3), +\fBll2_read_all\fP(3), +\fBll2_read_entry\fP(3), +\fBll2_update_login_time\fP(3), +\fBll2_remove_entry\fP(3), +\fBll2_rename_user\fP(3), +\fBll2_import_lastlog\fP(3) +.SH "REPORTING BUGS" +.sp +For bug reports, use the issue tracker at \c +.URL "https://github.com/util\-linux/util\-linux/issues" "" "." +.SH "AVAILABILITY" +.sp +The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c +.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." \ No newline at end of file diff --git a/liblastlog2/man/lastlog2.3.adoc b/liblastlog2/man/lastlog2.3.adoc new file mode 100644 index 0000000..05cab12 --- /dev/null +++ b/liblastlog2/man/lastlog2.3.adoc @@ -0,0 +1,51 @@ +//po4a: entry man manual += lastlog2(3) +:doctype: manpage +:man manual: Programmer's Manual +:man source: util-linux {release-version} +:page-layout: base +:lib: liblastlog2 +:firstversion: 2.40 + +== NAME + +lastlog2 - Y2038 safe version of lastlog library. + +== SYNOPSIS + +*#include * + +== DESCRIPTION + +*lastlog2* reports the last login of a given user or of all users who did ever login on a system. + +It's using sqlite3 as database backend. Data is only collected via a PAM module, so that every +tools can make use of it, without modifying existing packages. +The output is as compatible as possible with the old lastlog implementation. +By default the database will be written as `/var/lib/lastlog/lastlog2.db`. +The size of the database depends on the amount of users, not how big the biggest UID is. + +== AUTHORS + +Thorsten Kukuk (kukuk@suse.de) + +== SEE ALSO + +*lastlog2*(3), +*ll2_new_context(3), +*ll2_unref_context(3), +*ll2_write_entry*(3), +*ll2_read_all*(3), +*ll2_read_entry*(3), +*ll2_update_login_time*(3), +*ll2_remove_entry*(3), +*ll2_rename_user*(3), +*ll2_import_lastlog*(3) + +include::man-common/bugreports.adoc[] + +include::man-common/footer-lib.adoc[] + +ifdef::translation[] +include::man-common/translation.adoc[] +endif::[] diff --git a/liblastlog2/man/ll2_import_lastlog.3 b/liblastlog2/man/ll2_import_lastlog.3 new file mode 100644 index 0000000..23231c4 --- /dev/null +++ b/liblastlog2/man/ll2_import_lastlog.3 @@ -0,0 +1,84 @@ +'\" t +.\" Title: ll2_import_lastlog +.\" Author: [see the "AUTHOR(S)" section] +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2024-03-20 +.\" Manual: Programmer's Manual +.\" Source: util-linux 2.40 +.\" Language: English +.\" +.TH "LL2_IMPORT_LASTLOG" "3" "2024-03-20" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +ll2_import_lastlog \- Import old lastlog file. +.SH "SYNOPSIS" +.sp +\fB#include \fP +.sp +\fBint ll2_import_lastlog (struct ll2_context *\fIcontext\fP, +const char *\fIlastlog_file\fP, +char **\fIerror\fP);\fP +.SH "DESCRIPTION" +.sp +Importing all entries from \fIlastlog_file\fP file (lastlog(8)) into +lastlog2 database defined with \fIcontext\fP. +If \fIcontext\fP is NULL, the default database, defined in \fILL2_DEFAULT_DATABASE\fP, +will be taken. +.sp +.if n .RS 4 +.nf +.fam C +char *error = NULL; +const char *lastlog_path = "/var/log/lastlog"; + +int ret = ll2_import_lastlog (NULL, lastlog_path, &error); +.fam +.fi +.if n .RE +.SH "RETURN VALUE" +.sp +Returns 0 on success, \-ENOMEM or \-1 on other failure. +\fIerror\fP contains an error string if the return value is \-1. +\fIerror\fP is not guaranteed to contain an error string, could also be NULL. +\fIerror\fP should be freed by the caller. +.SH "AUTHORS" +.sp +Thorsten Kukuk (\c +.MTO "kukuk\(atsuse.de" "" ")" +.SH "SEE ALSO" +.sp +\fBlastlog2\fP(3), +\fBll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all\fP(3), +\fBll2_write_entry\fP(3), +\fBll2_read_entry\fP(3), +\fBll2_update_login_time\fP(3), +\fBll2_rename_user\fP(3), +\fBll2_remove_entry\fP(3) +.SH "REPORTING BUGS" +.sp +For bug reports, use the issue tracker at \c +.URL "https://github.com/util\-linux/util\-linux/issues" "" "." +.SH "AVAILABILITY" +.sp +The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c +.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." \ No newline at end of file diff --git a/liblastlog2/man/ll2_import_lastlog.3.adoc b/liblastlog2/man/ll2_import_lastlog.3.adoc new file mode 100644 index 0000000..9ddf54b --- /dev/null +++ b/liblastlog2/man/ll2_import_lastlog.3.adoc @@ -0,0 +1,65 @@ +//po4a: entry man manual += ll2_import_lastlog(3) +:doctype: manpage +:man manual: Programmer's Manual +:man source: util-linux {release-version} +:page-layout: base +:lib: liblastlog2 +:firstversion: 2.40 + +== NAME + +ll2_import_lastlog - Import old lastlog file. + +== SYNOPSIS + +*#include * + +*int ll2_import_lastlog (struct ll2_context *__context__, + const char *__lastlog_file__, + char **__error__);* + +== DESCRIPTION + +Importing all entries from _lastlog_file_ file (lastlog(8)) into +lastlog2 database defined with _context_. +If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_, +will be taken. + +-------------------------------------- +char *error = NULL; +const char *lastlog_path = "/var/log/lastlog"; + +int ret = ll2_import_lastlog (NULL, lastlog_path, &error); +-------------------------------------- + +== RETURN VALUE + +Returns 0 on success, -ENOMEM or -1 on other failure. +_error_ contains an error string if the return value is -1. +_error_ is not guaranteed to contain an error string, could also be NULL. +_error_ should be freed by the caller. + +== AUTHORS + +Thorsten Kukuk (kukuk@suse.de) + +== SEE ALSO + +*lastlog2*(3), +*ll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all*(3), +*ll2_write_entry*(3), +*ll2_read_entry*(3), +*ll2_update_login_time*(3), +*ll2_rename_user*(3), +*ll2_remove_entry*(3) + +include::man-common/bugreports.adoc[] + +include::man-common/footer-lib.adoc[] + +ifdef::translation[] +include::man-common/translation.adoc[] +endif::[] diff --git a/liblastlog2/man/ll2_read_all.3 b/liblastlog2/man/ll2_read_all.3 new file mode 100644 index 0000000..753749f --- /dev/null +++ b/liblastlog2/man/ll2_read_all.3 @@ -0,0 +1,93 @@ +'\" t +.\" Title: ll2_read_all +.\" Author: [see the "AUTHOR(S)" section] +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2024-03-20 +.\" Manual: Programmer's Manual +.\" Source: util-linux 2.40 +.\" Language: English +.\" +.TH "LL2_READ_ALL" "3" "2024-03-20" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +ll2_read_all \- Reads all entries from database and calls the callback function for each entry. +.SH "SYNOPSIS" +.sp +\fB#include \fP +\fBint ll2_read_all (struct ll2_context *\fIcontext\fP, +int (*\fIcallback\fP)(const char *\fIuser\fP, int64_t \fIll_time\fP, +const char *\fItty\fP, const char *\fIrhost\fP, +const char *\fIpam_service\fP, const char *\fIcb_error\fP), +char **\fIerror\fP);\fP +.SH "DESCRIPTION" +.sp +Reads all entries from database, defined in \fIcontext\fP, and calls callback fuction \fIcallback\fP for each entry. +If \fIcontext\fP is NULL, the default database, defined in \fILL2_DEFAULT_DATABASE\fP, will be taken. +.sp +.if n .RS 4 +.nf +.fam C +char *error = NULL; +const char *user = "root"; + +static int +callback (const char *res_user, int64_t ll_time, const char *res_tty, + const char *res_rhost, const char *res_service, const char *cb_error) +{ + /* returning != 0 if no further entry has to be handled by the callback */ + return 0; +} + +int ret = ll2_read_all (NULL, callback, &error); +.fam +.fi +.if n .RE +.SH "RETURN VALUE" +.sp +Returns 0 on success, \-ENOMEM or \-1 on other failure. +\fIerror\fP contains an error string if the return value is \-1. +\fIerror\fP is not guaranteed to contain an error string, could also be NULL. +\fIerror\fP should be freed by the caller. +If lastlog2 database does not exist at all, the errno ENOENT has been set +and can be checked. +.SH "AUTHORS" +.sp +Thorsten Kukuk (\c +.MTO "kukuk\(atsuse.de" "" ")" +.SH "SEE ALSO" +.sp +\fBlastlog2\fP(3), +\fBll2_new_context(3), +*ll2_unref_context(3), +*ll2_write_entry\fP(3), +\fBll2_read_entry\fP(3), +\fBll2_update_login_time\fP(3), +\fBll2_remove_entry\fP(3), +\fBll2_rename_user\fP(3), +\fBll2_import_lastlog\fP(3) +.SH "REPORTING BUGS" +.sp +For bug reports, use the issue tracker at \c +.URL "https://github.com/util\-linux/util\-linux/issues" "" "." +.SH "AVAILABILITY" +.sp +The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c +.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." \ No newline at end of file diff --git a/liblastlog2/man/ll2_read_all.3.adoc b/liblastlog2/man/ll2_read_all.3.adoc new file mode 100644 index 0000000..fbe589d --- /dev/null +++ b/liblastlog2/man/ll2_read_all.3.adoc @@ -0,0 +1,74 @@ +//po4a: entry man manual += ll2_read_all(3) +:doctype: manpage +:man manual: Programmer's Manual +:man source: util-linux {release-version} +:page-layout: base +:lib: liblastlog2 +:firstversion: 2.40 + +== NAME + +ll2_read_all - Reads all entries from database and calls the callback function for each entry. + +== SYNOPSIS + +*#include * +*int ll2_read_all (struct ll2_context *__context__, + int (*__callback__)(const char *__user__, int64_t __ll_time__, + const char *__tty__, const char *__rhost__, + const char *__pam_service__, const char *__cb_error__), + char **__error__);* + +== DESCRIPTION + +Reads all entries from database, defined in _context_, and calls callback fuction _callback_ for each entry. +If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_, will be taken. + +-------------------------------------- +char *error = NULL; +const char *user = "root"; + +static int +callback (const char *res_user, int64_t ll_time, const char *res_tty, + const char *res_rhost, const char *res_service, const char *cb_error) +{ + /* returning != 0 if no further entry has to be handled by the callback */ + return 0; +} + +int ret = ll2_read_all (NULL, callback, &error); +-------------------------------------- + +== RETURN VALUE + +Returns 0 on success, -ENOMEM or -1 on other failure. +_error_ contains an error string if the return value is -1. +_error_ is not guaranteed to contain an error string, could also be NULL. +_error_ should be freed by the caller. +If lastlog2 database does not exist at all, the errno ENOENT has been set +and can be checked. + +== AUTHORS + +Thorsten Kukuk (kukuk@suse.de) + +== SEE ALSO + +*lastlog2*(3), +*ll2_new_context(3), +*ll2_unref_context(3), +*ll2_write_entry*(3), +*ll2_read_entry*(3), +*ll2_update_login_time*(3), +*ll2_remove_entry*(3), +*ll2_rename_user*(3), +*ll2_import_lastlog*(3) + +include::man-common/bugreports.adoc[] + +include::man-common/footer-lib.adoc[] + +ifdef::translation[] +include::man-common/translation.adoc[] +endif::[] diff --git a/liblastlog2/man/ll2_read_entry.3 b/liblastlog2/man/ll2_read_entry.3 new file mode 100644 index 0000000..53f1e26 --- /dev/null +++ b/liblastlog2/man/ll2_read_entry.3 @@ -0,0 +1,91 @@ +'\" t +.\" Title: ll2_read_entry +.\" Author: [see the "AUTHOR(S)" section] +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2024-03-20 +.\" Manual: Programmer's Manual +.\" Source: util-linux 2.40 +.\" Language: English +.\" +.TH "LL2_READ_ENTRY" "3" "2024-03-20" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +ll2_read_entry \- Reads one entry from database and returns that. +.SH "SYNOPSIS" +.sp +\fB#include \fP +.sp +\fBint ll2_read_entry (struct ll2_context *\fIcontext\fP, const char *\fIuser\fP, +int64_t *\fIll_time\fP, char \fB\fItty\fP, char \fP\fIrhost\fP, +char \fB\fIpam_service\fP, char \fP\fIerror\fP);\fP +.SH "DESCRIPTION" +.sp +Reads the first entry from database, defined in \fIcontext\fP, for user \fIuser\fP. +If \fIcontext\fP is NULL, the default database, defined in \fILL2_DEFAULT_DATABASE\fP, +will be taken. +.sp +.if n .RS 4 +.nf +.fam C +char *error = NULL; +const char *user = "root"; +int64_t res_time; +char *res_tty = NULL; +char *res_rhost = NULL; +char *res_service = NULL; + +int ret = ll2_read_entry (NULL, user, &res_time, &res_tty, &res_rhost, &res_service, &error); +.fam +.fi +.if n .RE +.SH "RETURN VALUE" +.sp +Returns 0 on success, \-ENOMEM or \-1 on other failure. +\fIerror\fP contains an error string if the return value is \-1. +\fIerror\fP is not guaranteed to contain an error string, could also be NULL. +\fIerror\fP should be freed by the caller. +If lastlog2 database does not exist at all, the errno ENOENT has been set +and can be checked. +.sp +The evaluated values are returned by \fIll_time\fP, \fItty\fP, \fIrhost\fP and \fIpam_service\fP. +.SH "AUTHORS" +.sp +Thorsten Kukuk (\c +.MTO "kukuk\(atsuse.de" "" ")" +.SH "SEE ALSO" +.sp +\fBlastlog2\fP(3), +\fBll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all\fP(3), +\fBll2_write_entry\fP(3), +\fBll2_update_login_time\fP(3), +\fBll2_remove_entry\fP(3), +\fBll2_rename_user\fP(3), +\fBll2_import_lastlog\fP(3) +.SH "REPORTING BUGS" +.sp +For bug reports, use the issue tracker at \c +.URL "https://github.com/util\-linux/util\-linux/issues" "" "." +.SH "AVAILABILITY" +.sp +The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c +.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." \ No newline at end of file diff --git a/liblastlog2/man/ll2_read_entry.3.adoc b/liblastlog2/man/ll2_read_entry.3.adoc new file mode 100644 index 0000000..3bef1a8 --- /dev/null +++ b/liblastlog2/man/ll2_read_entry.3.adoc @@ -0,0 +1,72 @@ +//po4a: entry man manual += ll2_read_entry(3) +:doctype: manpage +:man manual: Programmer's Manual +:man source: util-linux {release-version} +:page-layout: base +:lib: liblastlog2 +:firstversion: 2.40 + +== NAME + +ll2_read_entry - Reads one entry from database and returns that. + +== SYNOPSIS + +*#include * + +*int ll2_read_entry (struct ll2_context *__context__, const char *__user__, + int64_t *__ll_time__, char **__tty__, char **__rhost__, + char **__pam_service__, char **__error__);* + +== DESCRIPTION + +Reads the first entry from database, defined in _context_, for user _user_. +If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_, +will be taken. + +-------------------------------------- +char *error = NULL; +const char *user = "root"; +int64_t res_time; +char *res_tty = NULL; +char *res_rhost = NULL; +char *res_service = NULL; + +int ret = ll2_read_entry (NULL, user, &res_time, &res_tty, &res_rhost, &res_service, &error); +-------------------------------------- + +== RETURN VALUE + +Returns 0 on success, -ENOMEM or -1 on other failure. +_error_ contains an error string if the return value is -1. +_error_ is not guaranteed to contain an error string, could also be NULL. +_error_ should be freed by the caller. +If lastlog2 database does not exist at all, the errno ENOENT has been set +and can be checked. + +The evaluated values are returned by _ll_time_, _tty_, _rhost_ and _pam_service_. + +== AUTHORS + +Thorsten Kukuk (kukuk@suse.de) + +== SEE ALSO + +*lastlog2*(3), +*ll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all*(3), +*ll2_write_entry*(3), +*ll2_update_login_time*(3), +*ll2_remove_entry*(3), +*ll2_rename_user*(3), +*ll2_import_lastlog*(3) + +include::man-common/bugreports.adoc[] + +include::man-common/footer-lib.adoc[] + +ifdef::translation[] +include::man-common/translation.adoc[] +endif::[] diff --git a/liblastlog2/man/ll2_remove_entry.3 b/liblastlog2/man/ll2_remove_entry.3 new file mode 100644 index 0000000..3cb444b --- /dev/null +++ b/liblastlog2/man/ll2_remove_entry.3 @@ -0,0 +1,82 @@ +'\" t +.\" Title: ll2_remove_entry +.\" Author: [see the "AUTHOR(S)" section] +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2024-03-20 +.\" Manual: Programmer's Manual +.\" Source: util-linux 2.40 +.\" Language: English +.\" +.TH "LL2_REMOVE_ENTRY" "3" "2024-03-20" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +ll2_remove_entry \- Remove all entries of an user. +.SH "SYNOPSIS" +.sp +\fB#include \fP +.sp +\fBint ll2_remove_entry (struct ll2_context *\fIcontext\fP, const char *\fIuser\fP, +char **\fIerror\fP);\fP +.SH "DESCRIPTION" +.sp +Removing all database entries, defined in \fIcontext\fP, with the user name \fIuser\fP. +If \fIcontext\fP is NULL, the default database, defined in \fILL2_DEFAULT_DATABASE\fP, +will be taken. +.sp +.if n .RS 4 +.nf +.fam C +char *error = NULL; +const char *user = "root"; + +int ret = ll2_remove_entry (NULL, user, &error); +.fam +.fi +.if n .RE +.SH "RETURN VALUE" +.sp +Returns 0 on success, \-ENOMEM or \-1 on other failure. +\fIerror\fP contains an error string if the return value is \-1. +\fIerror\fP is not guaranteed to contain an error string, could also be NULL. +\fIerror\fP should be freed by the caller. +.SH "AUTHORS" +.sp +Thorsten Kukuk (\c +.MTO "kukuk\(atsuse.de" "" ")" +.SH "SEE ALSO" +.sp +\fBlastlog2\fP(3), +\fBll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all\fP(3), +\fBll2_write_entry\fP(3), +\fBll2_read_entry\fP(3), +\fBll2_update_login_time\fP(3), +\fBll2_rename_user\fP(3), +\fBll2_import_lastlog\fP(3) +.SH "REPORTING BUGS" +.sp +For bug reports, use the issue tracker at \c +.URL "https://github.com/util\-linux/util\-linux/issues" "" "." +.SH "AVAILABILITY" +.sp +The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c +.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." \ No newline at end of file diff --git a/liblastlog2/man/ll2_remove_entry.3.adoc b/liblastlog2/man/ll2_remove_entry.3.adoc new file mode 100644 index 0000000..f38ab66 --- /dev/null +++ b/liblastlog2/man/ll2_remove_entry.3.adoc @@ -0,0 +1,63 @@ +//po4a: entry man manual += ll2_remove_entry(3) +:doctype: manpage +:man manual: Programmer's Manual +:man source: util-linux {release-version} +:page-layout: base +:lib: liblastlog2 +:firstversion: 2.40 + +== NAME + +ll2_remove_entry - Remove all entries of an user. + +== SYNOPSIS + +*#include * + +*int ll2_remove_entry (struct ll2_context *__context__, const char *__user__, + char **__error__);* + +== DESCRIPTION + +Removing all database entries, defined in _context_, with the user name _user_. +If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_, +will be taken. + +-------------------------------------- +char *error = NULL; +const char *user = "root"; + +int ret = ll2_remove_entry (NULL, user, &error); +-------------------------------------- + +== RETURN VALUE + +Returns 0 on success, -ENOMEM or -1 on other failure. +_error_ contains an error string if the return value is -1. +_error_ is not guaranteed to contain an error string, could also be NULL. +_error_ should be freed by the caller. + +== AUTHORS + +Thorsten Kukuk (kukuk@suse.de) + +== SEE ALSO + +*lastlog2*(3), +*ll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all*(3), +*ll2_write_entry*(3), +*ll2_read_entry*(3), +*ll2_update_login_time*(3), +*ll2_rename_user*(3), +*ll2_import_lastlog*(3) + +include::man-common/bugreports.adoc[] + +include::man-common/footer-lib.adoc[] + +ifdef::translation[] +include::man-common/translation.adoc[] +endif::[] diff --git a/liblastlog2/man/ll2_rename_user.3 b/liblastlog2/man/ll2_rename_user.3 new file mode 100644 index 0000000..7644838 --- /dev/null +++ b/liblastlog2/man/ll2_rename_user.3 @@ -0,0 +1,85 @@ +'\" t +.\" Title: ll2_rename_user +.\" Author: [see the "AUTHOR(S)" section] +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2024-03-20 +.\" Manual: Programmer's Manual +.\" Source: util-linux 2.40 +.\" Language: English +.\" +.TH "LL2_RENAME_USER" "3" "2024-03-20" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +ll2_rename_user \- Renames an user entry. +.SH "SYNOPSIS" +.sp +\fB#include \fP +.sp +\fBint ll2_rename_user (struct ll2_context *\fIcontext\fP, const char *\fIuser\fP, +const char *\fInewname\fP, char **\fIerror\fP);\fP +.SH "DESCRIPTION" +.sp +Changing user name from \fIuser\fP to \fInewname\fP of one entry in +database, which is defined by \fIcontext\fP. All other entries with the user \fIuser\fP +will be deleted. +If \fIcontext\fP is NULL, the default database, defined in \fILL2_DEFAULT_DATABASE\fP, +will be taken. +.sp +.if n .RS 4 +.nf +.fam C +char *error = NULL; +const char *user = "root"; +const char *new_user = "notroot"; + +int ret = ll2_rename_user (NULL, user, new_user, &error); +.fam +.fi +.if n .RE +.SH "RETURN VALUE" +.sp +Returns 0 on success, \-ENOMEM or \-1 on other failure. +\fIerror\fP contains an error string if the return value is \-1. +\fIerror\fP is not guaranteed to contain an error string, could also be NULL. +\fIerror\fP should be freed by the caller. +.SH "AUTHORS" +.sp +Thorsten Kukuk (\c +.MTO "kukuk\(atsuse.de" "" ")" +.SH "SEE ALSO" +.sp +\fBlastlog2\fP(3), +\fBll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all\fP(3), +\fBll2_write_entry\fP(3), +\fBll2_read_entry\fP(3), +\fBll2_remove_entry\fP(3), +\fBll2_update_login_time\fP(3), +\fBll2_import_lastlog\fP(3) +.SH "REPORTING BUGS" +.sp +For bug reports, use the issue tracker at \c +.URL "https://github.com/util\-linux/util\-linux/issues" "" "." +.SH "AVAILABILITY" +.sp +The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c +.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." \ No newline at end of file diff --git a/liblastlog2/man/ll2_rename_user.3.adoc b/liblastlog2/man/ll2_rename_user.3.adoc new file mode 100644 index 0000000..2202fe2 --- /dev/null +++ b/liblastlog2/man/ll2_rename_user.3.adoc @@ -0,0 +1,66 @@ +//po4a: entry man manual += ll2_rename_user(3) +:doctype: manpage +:man manual: Programmer's Manual +:man source: util-linux {release-version} +:page-layout: base +:lib: liblastlog2 +:firstversion: 2.40 + +== NAME + +ll2_rename_user - Renames an user entry. + +== SYNOPSIS + +*#include * + +*int ll2_rename_user (struct ll2_context *__context__, const char *__user__, + const char *__newname__, char **__error__);* + +== DESCRIPTION + +Changing user name from _user_ to _newname_ of one entry in +database, which is defined by _context_. All other entries with the user _user_ +will be deleted. +If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_, +will be taken. + +-------------------------------------- +char *error = NULL; +const char *user = "root"; +const char *new_user = "notroot"; + +int ret = ll2_rename_user (NULL, user, new_user, &error); +-------------------------------------- + +== RETURN VALUE + +Returns 0 on success, -ENOMEM or -1 on other failure. +_error_ contains an error string if the return value is -1. +_error_ is not guaranteed to contain an error string, could also be NULL. +_error_ should be freed by the caller. + +== AUTHORS + +Thorsten Kukuk (kukuk@suse.de) + +== SEE ALSO + +*lastlog2*(3), +*ll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all*(3), +*ll2_write_entry*(3), +*ll2_read_entry*(3), +*ll2_remove_entry*(3), +*ll2_update_login_time*(3), +*ll2_import_lastlog*(3) + +include::man-common/bugreports.adoc[] + +include::man-common/footer-lib.adoc[] + +ifdef::translation[] +include::man-common/translation.adoc[] +endif::[] diff --git a/liblastlog2/man/ll2_update_login_time.3 b/liblastlog2/man/ll2_update_login_time.3 new file mode 100644 index 0000000..ce08bc4 --- /dev/null +++ b/liblastlog2/man/ll2_update_login_time.3 @@ -0,0 +1,86 @@ +'\" t +.\" Title: ll2_update_login_time +.\" Author: [see the "AUTHOR(S)" section] +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2024-03-20 +.\" Manual: Programmer's Manual +.\" Source: util-linux 2.40 +.\" Language: English +.\" +.TH "LL2_UPDATE_LOGIN_TIME" "3" "2024-03-20" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +ll2_update_login_time \- Writes an *new* entry with updated login time. +.SH "SYNOPSIS" +.sp +\fB#include \fP +.sp +\fBint ll2_update_login_time (struct ll2_context *\fIcontext\fP, +const char *\fIuser\fP, int64_t \fIll_time\fP, +char **\fIerror\fP);\fP +.SH "DESCRIPTION" +.sp +Writes an \fBnew\fP entry to database, defined in \fIcontext\fP, for user \fIuser\fP. +Time is set by \fIll_time\fP whereas the other values are taken from +an already existing entry. +If \fIcontext\fP is NULL, the default database, defined in \fILL2_DEFAULT_DATABASE\fP, +will be taken. +.sp +.if n .RS 4 +.nf +.fam C +char *error = NULL; +const char *user = "root"; +int64_t login_time = time(0); // Get the system time; + +int ret = ll2_update_login_time (NULL, user, login_time, &error); +.fam +.fi +.if n .RE +.SH "RETURN VALUE" +.sp +Returns 0 on success, \-ENOMEM or \-1 on other failure. +\fIerror\fP contains an error string if the return value is \-1. +\fIerror\fP is not guaranteed to contain an error string. It could also be NULL if the return value is \-1. +\fIerror\fP should be freed by the caller. +.SH "AUTHORS" +.sp +Thorsten Kukuk (\c +.MTO "kukuk\(atsuse.de" "" ")" +.SH "SEE ALSO" +.sp +\fBlastlog2\fP(3), +\fBll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all\fP(3), +\fBll2_write_entry\fP(3), +\fBll2_read_entry\fP(3), +\fBll2_remove_entry\fP(3), +\fBll2_rename_user\fP(3), +\fBll2_import_lastlog\fP(3) +.SH "REPORTING BUGS" +.sp +For bug reports, use the issue tracker at \c +.URL "https://github.com/util\-linux/util\-linux/issues" "" "." +.SH "AVAILABILITY" +.sp +The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c +.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." \ No newline at end of file diff --git a/liblastlog2/man/ll2_update_login_time.3.adoc b/liblastlog2/man/ll2_update_login_time.3.adoc new file mode 100644 index 0000000..9cc43e1 --- /dev/null +++ b/liblastlog2/man/ll2_update_login_time.3.adoc @@ -0,0 +1,67 @@ +//po4a: entry man manual += ll2_update_login_time(3) +:doctype: manpage +:man manual: Programmer's Manual +:man source: util-linux {release-version} +:page-layout: base +:lib: liblastlog2 +:firstversion: 2.40 + +== NAME + +ll2_update_login_time - Writes an *new* entry with updated login time. + +== SYNOPSIS + +*#include * + +*int ll2_update_login_time (struct ll2_context *__context__, + const char *__user__, int64_t __ll_time__, + char **__error__);* + +== DESCRIPTION + +Writes an *new* entry to database, defined in _context_, for user _user_. +Time is set by _ll_time_ whereas the other values are taken from +an already existing entry. +If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_, +will be taken. + +-------------------------------------- +char *error = NULL; +const char *user = "root"; +int64_t login_time = time(0); // Get the system time; + +int ret = ll2_update_login_time (NULL, user, login_time, &error); +-------------------------------------- + +== RETURN VALUE + +Returns 0 on success, -ENOMEM or -1 on other failure. +_error_ contains an error string if the return value is -1. +_error_ is not guaranteed to contain an error string. It could also be NULL if the return value is -1. +_error_ should be freed by the caller. + +== AUTHORS + +Thorsten Kukuk (kukuk@suse.de) + +== SEE ALSO + +*lastlog2*(3), +*ll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all*(3), +*ll2_write_entry*(3), +*ll2_read_entry*(3), +*ll2_remove_entry*(3), +*ll2_rename_user*(3), +*ll2_import_lastlog*(3) + +include::man-common/bugreports.adoc[] + +include::man-common/footer-lib.adoc[] + +ifdef::translation[] +include::man-common/translation.adoc[] +endif::[] diff --git a/liblastlog2/man/ll2_write_entry.3 b/liblastlog2/man/ll2_write_entry.3 new file mode 100644 index 0000000..f16294a --- /dev/null +++ b/liblastlog2/man/ll2_write_entry.3 @@ -0,0 +1,88 @@ +'\" t +.\" Title: ll2_write_entry +.\" Author: [see the "AUTHOR(S)" section] +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2024-03-20 +.\" Manual: Programmer's Manual +.\" Source: util-linux 2.40 +.\" Language: English +.\" +.TH "LL2_WRITE_ENTRY" "3" "2024-03-20" "util\-linux 2.40" "Programmer\*(Aqs Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +ll2_write_entry \- Write a new entry into the database. +.SH "SYNOPSIS" +.sp +\fB#include \fP +.sp +\fBint ll2_write_entry (struct ll2_context *\fIcontext\fP, const char *\fIuser\fP, +int64_t \fIll_time\fP, const char *\fItty\fP, +const char *\fIrhost\fP, const char *\fIpam_service\fP, +char **\fIerror\fP);\fP +.SH "DESCRIPTION" +.sp +Writes an new entry into database, which is defined in \fIcontext\fP. +If \fIcontext\fP is NULL, the default database, defined in \fILL2_DEFAULT_DATABASE\fP, +will be taken. +.sp +.if n .RS 4 +.nf +.fam C +time_t login_time = time(0); // Get the system time +char *error = NULL; +const char *user = "root"; + +int ret = ll2_write_entry (NULL, user, login_time, "pts/0", + "192.168.122.1", NULL, &error); +.fam +.fi +.if n .RE +.sp +\fIpam_service\fP is the service or instance name which has generated the entry (optional). +.SH "RETURN VALUE" +.sp +Returns 0 on success, \-ENOMEM or \-1 on other failure. +\fIerror\fP contains an error string if the return value is \-1. +\fIerror\fP is not guaranteed to contain an error string, could also be NULL. +\fIerror\fP should be freed by the caller. +.SH "AUTHORS" +.sp +Thorsten Kukuk (\c +.MTO "kukuk\(atsuse.de" "" ")" +.SH "SEE ALSO" +.sp +\fBlastlog2\fP(3), +\fBll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all\fP(3), +\fBll2_read_entry\fP(3), +\fBll2_update_login_time\fP(3), +\fBll2_remove_entry\fP(3), +\fBll2_rename_user\fP(3), +\fBll2_import_lastlog\fP(3) +.SH "REPORTING BUGS" +.sp +For bug reports, use the issue tracker at \c +.URL "https://github.com/util\-linux/util\-linux/issues" "" "." +.SH "AVAILABILITY" +.sp +The \fBliblastlog2\fP library is part of the util\-linux package since version 2.40. It can be downloaded from \c +.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "." \ No newline at end of file diff --git a/liblastlog2/man/ll2_write_entry.3.adoc b/liblastlog2/man/ll2_write_entry.3.adoc new file mode 100644 index 0000000..6dca1b5 --- /dev/null +++ b/liblastlog2/man/ll2_write_entry.3.adoc @@ -0,0 +1,70 @@ +//po4a: entry man manual += ll2_write_entry(3) +:doctype: manpage +:man manual: Programmer's Manual +:man source: util-linux {release-version} +:page-layout: base +:lib: liblastlog2 +:firstversion: 2.40 + +== NAME + +ll2_write_entry - Write a new entry into the database. + +== SYNOPSIS + +*#include * + +*int ll2_write_entry (struct ll2_context *__context__, const char *__user__, + int64_t __ll_time__, const char *__tty__, + const char *__rhost__, const char *__pam_service__, + char **__error__);* + +== DESCRIPTION + +Writes an new entry into database, which is defined in _context_. +If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_, +will be taken. + + +-------------------------------------- +time_t login_time = time(0); // Get the system time +char *error = NULL; +const char *user = "root"; + +int ret = ll2_write_entry (NULL, user, login_time, "pts/0", + "192.168.122.1", NULL, &error); +-------------------------------------- + +_pam_service_ is the service or instance name which has generated the entry (optional). + +== RETURN VALUE + +Returns 0 on success, -ENOMEM or -1 on other failure. +_error_ contains an error string if the return value is -1. +_error_ is not guaranteed to contain an error string, could also be NULL. +_error_ should be freed by the caller. + +== AUTHORS + +Thorsten Kukuk (kukuk@suse.de) + +== SEE ALSO + +*lastlog2*(3), +*ll2_new_context(3), +*ll2_unref_context(3), +*ll2_read_all*(3), +*ll2_read_entry*(3), +*ll2_update_login_time*(3), +*ll2_remove_entry*(3), +*ll2_rename_user*(3), +*ll2_import_lastlog*(3) + +include::man-common/bugreports.adoc[] + +include::man-common/footer-lib.adoc[] + +ifdef::translation[] +include::man-common/translation.adoc[] +endif::[] -- cgit v1.2.3