2008-04-27 06:10:09 +05:30
|
|
|
/*
|
2021-12-05 21:05:27 +05:30
|
|
|
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
|
|
|
|
* SPDX-FileCopyrightText: 1996 - 2000, Marek Michałkiewicz
|
|
|
|
* SPDX-FileCopyrightText: 2001 , Michał Moskal
|
|
|
|
* SPDX-FileCopyrightText: 2005 , Tomasz Kłoczko
|
|
|
|
* SPDX-FileCopyrightText: 2007 - 2013, Nicolas François
|
2008-04-27 06:10:09 +05:30
|
|
|
*
|
2021-12-05 21:05:27 +05:30
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2008-04-27 06:10:09 +05:30
|
|
|
*/
|
2007-10-07 17:14:02 +05:30
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef SHADOWGRP
|
|
|
|
|
2007-11-11 05:16:11 +05:30
|
|
|
#ident "$Id$"
|
2007-10-07 17:17:01 +05:30
|
|
|
|
2007-10-07 17:14:02 +05:30
|
|
|
#include "prototypes.h"
|
|
|
|
#include "defines.h"
|
|
|
|
#include "commonio.h"
|
2016-12-06 03:45:29 +05:30
|
|
|
#include "getdef.h"
|
2007-10-07 17:14:02 +05:30
|
|
|
#include "sgroupio.h"
|
|
|
|
|
* libmisc/xgetXXbyYY.c, libmisc/myname.c, libmisc/getgr_nam_gid.c,
libmisc/salt.c, libmisc/list.c, libmisc/cleanup.c, src/login.c,
lib/getdef.h, lib/groupio.c, lib/getlong.c, lib/gshadow_.h,
lib/sgroupio.c, lib/shadowio.c, lib/pwio.c, lib/commonio.h,
lib/fputsx.c, lib/prototypes.h: Added splint annotations.
* lib/groupio.c: Avoid implicit conversion of pointers to
booleans.
* lib/groupio.c: Free allocated buffers in case of failure.
2009-04-23 15:27:03 +05:30
|
|
|
/*@null@*/ /*@only@*/struct sgrp *__sgr_dup (const struct sgrp *sgent)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
|
|
|
struct sgrp *sg;
|
|
|
|
int i;
|
|
|
|
|
2008-05-26 14:16:41 +05:30
|
|
|
sg = (struct sgrp *) malloc (sizeof *sg);
|
|
|
|
if (NULL == sg) {
|
2007-10-07 17:14:02 +05:30
|
|
|
return NULL;
|
2008-05-26 14:16:41 +05:30
|
|
|
}
|
2013-08-06 20:00:38 +05:30
|
|
|
/* Do the same as the other _dup function, even if we know the
|
|
|
|
* structure. */
|
|
|
|
memset (sg, 0, sizeof *sg);
|
2013-08-13 22:43:45 +05:30
|
|
|
/*@-mustfreeonly@*/
|
2008-05-26 14:16:41 +05:30
|
|
|
sg->sg_name = strdup (sgent->sg_name);
|
2013-08-13 22:43:45 +05:30
|
|
|
/*@=mustfreeonly@*/
|
2008-05-26 14:16:41 +05:30
|
|
|
if (NULL == sg->sg_name) {
|
2009-04-25 05:02:52 +05:30
|
|
|
free (sg);
|
2007-10-07 17:14:02 +05:30
|
|
|
return NULL;
|
2008-05-26 14:16:41 +05:30
|
|
|
}
|
2013-08-13 22:43:45 +05:30
|
|
|
/*@-mustfreeonly@*/
|
2008-05-26 14:16:41 +05:30
|
|
|
sg->sg_passwd = strdup (sgent->sg_passwd);
|
2013-08-13 22:43:45 +05:30
|
|
|
/*@=mustfreeonly@*/
|
2008-05-26 14:16:41 +05:30
|
|
|
if (NULL == sg->sg_passwd) {
|
2009-04-25 05:02:52 +05:30
|
|
|
free (sg->sg_name);
|
|
|
|
free (sg);
|
2007-10-07 17:14:02 +05:30
|
|
|
return NULL;
|
2008-05-26 14:16:41 +05:30
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
|
2008-05-26 14:16:41 +05:30
|
|
|
for (i = 0; NULL != sgent->sg_adm[i]; i++);
|
2013-08-13 22:43:45 +05:30
|
|
|
/*@-mustfreeonly@*/
|
2007-10-07 17:16:07 +05:30
|
|
|
sg->sg_adm = (char **) malloc ((i + 1) * sizeof (char *));
|
2013-08-13 22:43:45 +05:30
|
|
|
/*@=mustfreeonly@*/
|
2008-05-26 14:16:41 +05:30
|
|
|
if (NULL == sg->sg_adm) {
|
2009-04-25 05:02:52 +05:30
|
|
|
free (sg->sg_passwd);
|
|
|
|
free (sg->sg_name);
|
|
|
|
free (sg);
|
2007-10-07 17:14:02 +05:30
|
|
|
return NULL;
|
2008-05-26 14:16:41 +05:30
|
|
|
}
|
|
|
|
for (i = 0; NULL != sgent->sg_adm[i]; i++) {
|
2007-10-07 17:16:07 +05:30
|
|
|
sg->sg_adm[i] = strdup (sgent->sg_adm[i]);
|
2008-05-26 14:16:41 +05:30
|
|
|
if (NULL == sg->sg_adm[i]) {
|
2009-04-25 05:02:52 +05:30
|
|
|
for (i = 0; NULL != sg->sg_adm[i]; i++) {
|
|
|
|
free (sg->sg_adm[i]);
|
|
|
|
}
|
|
|
|
free (sg->sg_adm);
|
|
|
|
free (sg->sg_passwd);
|
|
|
|
free (sg->sg_name);
|
|
|
|
free (sg);
|
2007-10-07 17:14:02 +05:30
|
|
|
return NULL;
|
2008-05-26 14:16:41 +05:30
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
sg->sg_adm[i] = NULL;
|
|
|
|
|
2008-05-26 14:16:41 +05:30
|
|
|
for (i = 0; NULL != sgent->sg_mem[i]; i++);
|
2013-08-13 22:43:45 +05:30
|
|
|
/*@-mustfreeonly@*/
|
2007-10-07 17:16:07 +05:30
|
|
|
sg->sg_mem = (char **) malloc ((i + 1) * sizeof (char *));
|
2013-08-13 22:43:45 +05:30
|
|
|
/*@=mustfreeonly@*/
|
2008-05-26 14:16:41 +05:30
|
|
|
if (NULL == sg->sg_mem) {
|
2009-04-25 05:02:52 +05:30
|
|
|
for (i = 0; NULL != sg->sg_adm[i]; i++) {
|
|
|
|
free (sg->sg_adm[i]);
|
|
|
|
}
|
|
|
|
free (sg->sg_adm);
|
|
|
|
free (sg->sg_passwd);
|
|
|
|
free (sg->sg_name);
|
|
|
|
free (sg);
|
2007-10-07 17:14:02 +05:30
|
|
|
return NULL;
|
2008-05-26 14:16:41 +05:30
|
|
|
}
|
|
|
|
for (i = 0; NULL != sgent->sg_mem[i]; i++) {
|
2007-10-07 17:16:07 +05:30
|
|
|
sg->sg_mem[i] = strdup (sgent->sg_mem[i]);
|
2008-05-26 14:16:41 +05:30
|
|
|
if (NULL == sg->sg_mem[i]) {
|
2009-04-25 05:02:52 +05:30
|
|
|
for (i = 0; NULL != sg->sg_mem[i]; i++) {
|
|
|
|
free (sg->sg_mem[i]);
|
|
|
|
}
|
|
|
|
free (sg->sg_mem);
|
|
|
|
for (i = 0; NULL != sg->sg_adm[i]; i++) {
|
|
|
|
free (sg->sg_adm[i]);
|
|
|
|
}
|
|
|
|
free (sg->sg_adm);
|
|
|
|
free (sg->sg_passwd);
|
|
|
|
free (sg->sg_name);
|
|
|
|
free (sg);
|
2007-10-07 17:14:02 +05:30
|
|
|
return NULL;
|
2008-05-26 14:16:41 +05:30
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
sg->sg_mem[i] = NULL;
|
|
|
|
|
|
|
|
return sg;
|
|
|
|
}
|
|
|
|
|
* libmisc/xgetXXbyYY.c, libmisc/myname.c, libmisc/getgr_nam_gid.c,
libmisc/salt.c, libmisc/list.c, libmisc/cleanup.c, src/login.c,
lib/getdef.h, lib/groupio.c, lib/getlong.c, lib/gshadow_.h,
lib/sgroupio.c, lib/shadowio.c, lib/pwio.c, lib/commonio.h,
lib/fputsx.c, lib/prototypes.h: Added splint annotations.
* lib/groupio.c: Avoid implicit conversion of pointers to
booleans.
* lib/groupio.c: Free allocated buffers in case of failure.
2009-04-23 15:27:03 +05:30
|
|
|
static /*@null@*/ /*@only@*/void *gshadow_dup (const void *ent)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
|
|
|
const struct sgrp *sg = ent;
|
2007-10-07 17:16:07 +05:30
|
|
|
|
|
|
|
return __sgr_dup (sg);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
* libmisc/utmp.c, libmisc/age.c, libmisc/shell.c, lib/groupio.c,
lib/groupio.h, lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c,
lib/pwio.c, lib/commonio.c, lib/shadowio.h, lib/pwio.h,
lib/commonio.h, lib/prototypes.h: Added splint annotations.
2009-04-23 02:51:14 +05:30
|
|
|
static void gshadow_free (/*@out@*/ /*@only@*/void *ent)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
|
|
|
struct sgrp *sg = ent;
|
|
|
|
|
2009-04-22 03:44:10 +05:30
|
|
|
sgr_free (sg);
|
|
|
|
}
|
|
|
|
|
* libmisc/utmp.c, libmisc/age.c, libmisc/shell.c, lib/groupio.c,
lib/groupio.h, lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c,
lib/pwio.c, lib/commonio.c, lib/shadowio.h, lib/pwio.h,
lib/commonio.h, lib/prototypes.h: Added splint annotations.
2009-04-23 02:51:14 +05:30
|
|
|
void sgr_free (/*@out@*/ /*@only@*/struct sgrp *sgent)
|
2009-04-22 03:44:10 +05:30
|
|
|
{
|
2009-09-08 00:38:10 +05:30
|
|
|
size_t i;
|
2009-04-22 03:44:10 +05:30
|
|
|
free (sgent->sg_name);
|
2009-09-08 00:38:10 +05:30
|
|
|
if (NULL != sgent->sg_passwd) {
|
2022-09-17 21:26:49 +05:30
|
|
|
strzero (sgent->sg_passwd);
|
2009-09-08 00:38:10 +05:30
|
|
|
free (sgent->sg_passwd);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
2009-09-08 00:38:10 +05:30
|
|
|
for (i = 0; NULL != sgent->sg_adm[i]; i++) {
|
|
|
|
free (sgent->sg_adm[i]);
|
|
|
|
}
|
|
|
|
free (sgent->sg_adm);
|
|
|
|
for (i = 0; NULL != sgent->sg_mem[i]; i++) {
|
|
|
|
free (sgent->sg_mem[i]);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
2009-09-08 00:38:10 +05:30
|
|
|
free (sgent->sg_mem);
|
2009-04-22 03:44:10 +05:30
|
|
|
free (sgent);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
static const char *gshadow_getname (const void *ent)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
|
|
|
const struct sgrp *gr = ent;
|
2007-10-07 17:16:07 +05:30
|
|
|
|
2007-10-07 17:14:02 +05:30
|
|
|
return gr->sg_name;
|
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
static void *gshadow_parse (const char *line)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return (void *) sgetsgent (line);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
static int gshadow_put (const void *ent, FILE * file)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
|
|
|
const struct sgrp *sg = ent;
|
2007-10-07 17:16:07 +05:30
|
|
|
|
2011-02-17 02:02:16 +05:30
|
|
|
if ( (NULL == sg)
|
|
|
|
|| (valid_field (sg->sg_name, ":\n") == -1)
|
|
|
|
|| (valid_field (sg->sg_passwd, ":\n") == -1)) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: fail also if sg->sg_adm == NULL ?*/
|
|
|
|
if (NULL != sg->sg_adm) {
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; NULL != sg->sg_adm[i]; i++) {
|
|
|
|
if (valid_field (sg->sg_adm[i], ",:\n") == -1) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: fail also if sg->sg_mem == NULL ?*/
|
|
|
|
if (NULL != sg->sg_mem) {
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; NULL != sg->sg_mem[i]; i++) {
|
|
|
|
if (valid_field (sg->sg_mem[i], ",:\n") == -1) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
return (putsgent (sg, file) == -1) ? -1 : 0;
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
static struct commonio_ops gshadow_ops = {
|
|
|
|
gshadow_dup,
|
|
|
|
gshadow_free,
|
|
|
|
gshadow_getname,
|
|
|
|
gshadow_parse,
|
|
|
|
gshadow_put,
|
|
|
|
fgetsx,
|
2007-11-23 05:37:59 +05:30
|
|
|
fputsx,
|
|
|
|
NULL, /* open_hook */
|
|
|
|
NULL /* close_hook */
|
2007-10-07 17:14:02 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
static struct commonio_db gshadow_db = {
|
2007-10-07 17:16:07 +05:30
|
|
|
SGROUP_FILE, /* filename */
|
|
|
|
&gshadow_ops, /* ops */
|
|
|
|
NULL, /* fp */
|
2007-11-20 01:55:36 +05:30
|
|
|
#ifdef WITH_SELINUX
|
|
|
|
NULL, /* scontext */
|
|
|
|
#endif
|
2015-02-27 21:56:57 +05:30
|
|
|
0400, /* st_mode */
|
|
|
|
0, /* st_uid */
|
|
|
|
0, /* st_gid */
|
2007-10-07 17:16:07 +05:30
|
|
|
NULL, /* head */
|
|
|
|
NULL, /* tail */
|
|
|
|
NULL, /* cursor */
|
2008-05-26 14:16:41 +05:30
|
|
|
false, /* changed */
|
|
|
|
false, /* isopen */
|
|
|
|
false, /* locked */
|
2019-05-02 18:03:06 +05:30
|
|
|
false, /* readonly */
|
|
|
|
false /* setname */
|
2007-10-07 17:14:02 +05:30
|
|
|
};
|
|
|
|
|
* lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h,
lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/shadowio.h:
Added *_dbname() functions to retrieve the name of the databases.
* lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h,
lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/shadowio.h:
*_name() functions renamed *setname().
* src/grpck.c, src/pwck.c: Likewise.
* lib/groupio.h, lib/pwio.h, lib/sgroupio.h, lib/shadowio.h: Added
the name of the arguments to the prototypes.
* src/chage, src/chfn.c, src/chgpasswd.c, src/chpasswd.c,
src/chsh.c, src/gpasswd.c, src/groupadd.c, src/groupdel.c,
src/groupmod.c, src/grpck.c, src/grpconv.c, src/grpunconv.c,
src/newusers.c, src/passwd.c, src/pwck.c, src/pwconv.c,
src/pwunconv.c, src/useradd.c, src/userdel.c, src/usermod.c:
Harmonize the erro & syslog messages in case of failure of the
*_lock(), *_open(), *_close(), *_unlock(), *_remove() functions.
* src/chgpasswd.c, src/chpasswd.c, src/usermod.c: Avoid
capitalized messages.
* src/chpasswd.c, src/useradd.c, src/usermod.c: Harmonize messages
in case of inexistent entries.
* src/usermod.c: Harmonize messages in case of already existing
entries.
* src/newusers.c, src/useradd.c: Simplify PAM error handling.
* src/useradd.c: Report failures to unlock files (stderr, syslog,
and audit). But do not fail (continue).
* src/useradd.c (open_files): Do not report to syslog & audit
failures to lock or open the databases. This might be harmless,
and the logs were not already informed that a change was
requested.
* src/usermod.c: It's not the account which is unlocked, but its
password.
2008-08-06 21:27:31 +05:30
|
|
|
int sgr_setdbname (const char *filename)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_setname (&gshadow_db, filename);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
* libmisc/utmp.c, libmisc/age.c, libmisc/shell.c, lib/groupio.c,
lib/groupio.h, lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c,
lib/pwio.c, lib/commonio.c, lib/shadowio.h, lib/pwio.h,
lib/commonio.h, lib/prototypes.h: Added splint annotations.
2009-04-23 02:51:14 +05:30
|
|
|
/*@observer@*/const char *sgr_dbname (void)
|
* lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h,
lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/shadowio.h:
Added *_dbname() functions to retrieve the name of the databases.
* lib/groupio.c, lib/groupio.h, lib/pwio.c, lib/pwio.h,
lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c, lib/shadowio.h:
*_name() functions renamed *setname().
* src/grpck.c, src/pwck.c: Likewise.
* lib/groupio.h, lib/pwio.h, lib/sgroupio.h, lib/shadowio.h: Added
the name of the arguments to the prototypes.
* src/chage, src/chfn.c, src/chgpasswd.c, src/chpasswd.c,
src/chsh.c, src/gpasswd.c, src/groupadd.c, src/groupdel.c,
src/groupmod.c, src/grpck.c, src/grpconv.c, src/grpunconv.c,
src/newusers.c, src/passwd.c, src/pwck.c, src/pwconv.c,
src/pwunconv.c, src/useradd.c, src/userdel.c, src/usermod.c:
Harmonize the erro & syslog messages in case of failure of the
*_lock(), *_open(), *_close(), *_unlock(), *_remove() functions.
* src/chgpasswd.c, src/chpasswd.c, src/usermod.c: Avoid
capitalized messages.
* src/chpasswd.c, src/useradd.c, src/usermod.c: Harmonize messages
in case of inexistent entries.
* src/usermod.c: Harmonize messages in case of already existing
entries.
* src/newusers.c, src/useradd.c: Simplify PAM error handling.
* src/useradd.c: Report failures to unlock files (stderr, syslog,
and audit). But do not fail (continue).
* src/useradd.c (open_files): Do not report to syslog & audit
failures to lock or open the databases. This might be harmless,
and the logs were not already informed that a change was
requested.
* src/usermod.c: It's not the account which is unlocked, but its
password.
2008-08-06 21:27:31 +05:30
|
|
|
{
|
|
|
|
return gshadow_db.filename;
|
|
|
|
}
|
|
|
|
|
2008-05-26 14:16:41 +05:30
|
|
|
bool sgr_file_present (void)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2015-02-27 19:48:56 +05:30
|
|
|
if (getdef_bool ("FORCE_SHADOW"))
|
|
|
|
return true;
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_present (&gshadow_db);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
int sgr_lock (void)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_lock (&gshadow_db);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
int sgr_open (int mode)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_open (&gshadow_db, mode);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2009-04-25 05:02:52 +05:30
|
|
|
/*@observer@*/ /*@null@*/const struct sgrp *sgr_locate (const char *name)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_locate (&gshadow_db, name);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
int sgr_update (const struct sgrp *sg)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_update (&gshadow_db, (const void *) sg);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
int sgr_remove (const char *name)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_remove (&gshadow_db, name);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
int sgr_rewind (void)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_rewind (&gshadow_db);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
* libmisc/utmp.c, libmisc/age.c, libmisc/shell.c, lib/groupio.c,
lib/groupio.h, lib/sgroupio.c, lib/sgroupio.h, lib/shadowio.c,
lib/pwio.c, lib/commonio.c, lib/shadowio.h, lib/pwio.h,
lib/commonio.h, lib/prototypes.h: Added splint annotations.
2009-04-23 02:51:14 +05:30
|
|
|
/*@null@*/const struct sgrp *sgr_next (void)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_next (&gshadow_db);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
int sgr_close (void)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_close (&gshadow_db);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
int sgr_unlock (void)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_unlock (&gshadow_db);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
void __sgr_set_changed (void)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2008-05-26 14:16:41 +05:30
|
|
|
gshadow_db.changed = true;
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
|
|
|
|
2009-04-25 05:02:52 +05:30
|
|
|
/*@dependent@*/ /*@null@*/struct commonio_entry *__sgr_get_head (void)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
|
|
|
return gshadow_db.head;
|
|
|
|
}
|
|
|
|
|
2007-10-07 17:16:07 +05:30
|
|
|
void __sgr_del_entry (const struct commonio_entry *ent)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
commonio_del_entry (&gshadow_db, ent);
|
2007-10-07 17:14:02 +05:30
|
|
|
}
|
2007-10-07 17:14:51 +05:30
|
|
|
|
|
|
|
/* Sort with respect to group ordering. */
|
2007-10-07 17:16:07 +05:30
|
|
|
int sgr_sort ()
|
2007-10-07 17:14:51 +05:30
|
|
|
{
|
2007-10-07 17:16:07 +05:30
|
|
|
return commonio_sort_wrt (&gshadow_db, __gr_get_db ());
|
2007-10-07 17:14:51 +05:30
|
|
|
}
|
2007-10-07 17:14:02 +05:30
|
|
|
#else
|
2007-10-07 17:16:07 +05:30
|
|
|
extern int errno; /* warning: ANSI C forbids an empty source file */
|
2007-10-07 17:14:02 +05:30
|
|
|
#endif
|