summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBalint Reczey <balint.reczey@canonical.com>2017-08-10 18:26:45 -0400
committerBalint Reczey <balint.reczey@canonical.com>2017-08-10 18:26:45 -0400
commit589f97ade4610b98cc532c8142343d4c33694e72 (patch)
tree38890f681daa26c57e865b4feca10d0ca53e1046 /lib
parent365658d0f3a51814626afbb70aa2dd7b5e82ac36 (diff)
downloadshadow-589f97ade4610b98cc532c8142343d4c33694e72.tar.gz
New upstream version 4.5upstream/4.5
Diffstat (limited to 'lib')
-rw-r--r--lib/commonio.c13
-rw-r--r--lib/commonio.h4
-rw-r--r--lib/getdef.c1
-rw-r--r--lib/groupio.c3
-rw-r--r--lib/prototypes.h3
-rw-r--r--lib/sgroupio.c1
-rw-r--r--lib/shadowio.c1
-rw-r--r--lib/shadowio.h4
8 files changed, 16 insertions, 14 deletions
diff --git a/lib/commonio.c b/lib/commonio.c
index 2e2f7785..31edbaaf 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
@@ -301,15 +301,12 @@ static int create_backup (const char *backup, FILE * fp)
struct utimbuf ub;
FILE *bkfp;
int c;
- mode_t mask;
if (fstat (fileno (fp), &sb) != 0) {
return -1;
}
- mask = umask (077);
- bkfp = fopen (backup, "w");
- (void) umask (mask);
+ bkfp = fopen_set_perms (backup, "w", &sb);
if (NULL == bkfp) {
return -1;
}
@@ -754,16 +751,16 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
for (ptr = db->head;
(NULL != ptr)
#if KEEP_NIS_AT_END
- && (NULL != ptr->line)
- && ( ('+' != ptr->line[0])
- && ('-' != ptr->line[0]))
+ && ((NULL == ptr->line)
+ || (('+' != ptr->line[0])
+ && ('-' != ptr->line[0])))
#endif
;
ptr = ptr->next) {
n++;
}
#if KEEP_NIS_AT_END
- if ((NULL != ptr) && (NULL != ptr->line)) {
+ if (NULL != ptr) {
nis = ptr;
}
#endif
diff --git a/lib/commonio.h b/lib/commonio.h
index cb4e9616..40e5708f 100644
--- a/lib/commonio.h
+++ b/lib/commonio.h
@@ -31,8 +31,8 @@
*/
/* $Id$ */
-#ifndef _COMMONIO_H
-#define _COMMONIO_H
+#ifndef COMMONIO_H
+#define COMMONIO_H
#ifdef WITH_SELINUX
#include <selinux/selinux.h>
diff --git a/lib/getdef.c b/lib/getdef.c
index bea28129..a181cc2b 100644
--- a/lib/getdef.c
+++ b/lib/getdef.c
@@ -148,6 +148,7 @@ static struct itemdef knowndef_table[] = {
#ifdef USE_PAM
PAMDEFS
#endif
+ {NULL, NULL}
};
#ifndef LOGINDEFS
diff --git a/lib/groupio.c b/lib/groupio.c
index 3ad4736b..ae2302b5 100644
--- a/lib/groupio.c
+++ b/lib/groupio.c
@@ -338,8 +338,7 @@ static /*@null@*/struct commonio_entry *merge_group_entries (
errno = ENOMEM;
return NULL;
}
- snprintf(new_line, new_line_len, "%s\n%s", gr1->line, gr2->line);
- new_line[new_line_len] = '\0';
+ snprintf(new_line, new_line_len + 1, "%s\n%s", gr1->line, gr2->line);
/* Concatenate the 2 list of members */
for (i=0; NULL != gptr1->gr_mem[i]; i++);
diff --git a/lib/prototypes.h b/lib/prototypes.h
index 7aaf1a63..4808d5d9 100644
--- a/lib/prototypes.h
+++ b/lib/prototypes.h
@@ -179,6 +179,9 @@ extern int getrange (char *range,
unsigned long *min, bool *has_min,
unsigned long *max, bool *has_max);
+/* gettime.c */
+extern time_t gettime ();
+
/* get_uid.c */
extern int get_uid (const char *uidstr, uid_t *uid);
diff --git a/lib/sgroupio.c b/lib/sgroupio.c
index f2685779..5423626a 100644
--- a/lib/sgroupio.c
+++ b/lib/sgroupio.c
@@ -40,6 +40,7 @@
#include "prototypes.h"
#include "defines.h"
#include "commonio.h"
+#include "getdef.h"
#include "sgroupio.h"
/*@null@*/ /*@only@*/struct sgrp *__sgr_dup (const struct sgrp *sgent)
diff --git a/lib/shadowio.c b/lib/shadowio.c
index 6e44ab24..5fa3d312 100644
--- a/lib/shadowio.c
+++ b/lib/shadowio.c
@@ -40,6 +40,7 @@
#include <shadow.h>
#include <stdio.h>
#include "commonio.h"
+#include "getdef.h"
#include "shadowio.h"
#ifdef WITH_TCB
#include <tcb.h>
diff --git a/lib/shadowio.h b/lib/shadowio.h
index 229dfdb4..5384b1dd 100644
--- a/lib/shadowio.h
+++ b/lib/shadowio.h
@@ -31,8 +31,8 @@
*/
/* $Id$ */
-#ifndef _SHADOWIO_H
-#define _SHADOWIO_H
+#ifndef SHADOWIO_H
+#define SHADOWIO_H
#include "defines.h"