Util-Linux package development
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: Sami Kerola <kerolasa@iki.fi>
Subject: [PATCH 1/9] chfn, chsh: merge auth.h, islocal.h and libuser.h to ch-common.h
Date: Mon, 31 Jul 2017 20:55:00 +0100	[thread overview]
Message-ID: <20170731195508.11661-2-kerolasa@iki.fi> (raw)
In-Reply-To: <20170731195508.11661-1-kerolasa@iki.fi>

Merging header files is fine.  Merging sources files ch-common.c is
bad idea due linking needs, and differences in licences.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 login-utils/Makemodule.am |  7 ++-----
 login-utils/auth.c        |  2 +-
 login-utils/auth.h        | 13 -------------
 login-utils/ch-common.h   | 17 +++++++++++++++++
 login-utils/chfn.c        |  4 ----
 login-utils/chsh.c        |  4 ----
 login-utils/islocal.c     |  2 +-
 login-utils/islocal.h     |  1 -
 login-utils/libuser.c     |  3 +--
 login-utils/libuser.h     | 14 --------------
 10 files changed, 22 insertions(+), 45 deletions(-)
 delete mode 100644 login-utils/auth.h
 delete mode 100644 login-utils/islocal.h
 delete mode 100644 login-utils/libuser.h

diff --git a/login-utils/Makemodule.am b/login-utils/Makemodule.am
index 67a0c98ec..2cc91b658 100644
--- a/login-utils/Makemodule.am
+++ b/login-utils/Makemodule.am
@@ -90,20 +90,17 @@ if HAVE_LINUXPAM
 chfn_chsh_ldadd += -lpam_misc
 endif
 chfn_chsh_sources += \
-	login-utils/auth.c \
-	login-utils/auth.h
+	login-utils/auth.c
 endif # CHFN_CHSH_PASSWORD
 
 if HAVE_USER
 chfn_chsh_ldflags += $(LIBUSER_LIBS)
 chfn_chsh_cflags += $(LIBUSER_CFLAGS)
 chfn_chsh_sources+= \
-	login-utils/libuser.c \
-	login-utils/libuser.h
+	login-utils/libuser.c
 else
 chfn_chsh_sources += \
 	login-utils/islocal.c \
-	login-utils/islocal.h \
 	login-utils/setpwnam.c \
 	login-utils/setpwnam.h
 endif
diff --git a/login-utils/auth.c b/login-utils/auth.c
index aaf6c536b..68d4ea3b0 100644
--- a/login-utils/auth.c
+++ b/login-utils/auth.c
@@ -7,7 +7,7 @@
  *   there is no warranty.
  *
  */
-#include "auth.h"
+#include "ch-common.h"
 #include "pamfail.h"
 
 int auth_pam(const char *service_name, uid_t uid, const char *username)
diff --git a/login-utils/auth.h b/login-utils/auth.h
deleted file mode 100644
index bf7c36924..000000000
--- a/login-utils/auth.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- *   auth.h -- PAM authorization code, common between chsh and chfn
- *   (c) 2012 by Cody Maloney <cmaloney@theoreticalchaos.com>
- *
- *   this program is free software.  you can redistribute it and
- *   modify it under the terms of the gnu general public license.
- *   there is no warranty.
- *
- */
-
-#include <sys/types.h>
-
-extern int auth_pam(const char *service_name, uid_t uid, const char *username);
diff --git a/login-utils/ch-common.h b/login-utils/ch-common.h
index 7f70e50e1..e2b402cc2 100644
--- a/login-utils/ch-common.h
+++ b/login-utils/ch-common.h
@@ -1,6 +1,23 @@
 #ifndef UTIL_LINUX_CH_COMMON_H
 #define UTIL_LINUX_CH_COMMON_H
 
+#include <sys/types.h>
+
 extern int illegal_passwd_chars(const char *str);
+extern int is_local(const char *user);
+
+/*
+ *   Utilize libuser to set a user attribute
+ *   (c) 2012 by Cody Maloney <cmaloney@theoreticalchaos.com>
+ */
+
+extern int set_value_libuser(const char *service_name, const char *username,
+                        uid_t uid, const char *attr, const char *val);
+
+/*
+ *   PAM authorization code, common between chsh and chfn
+ *   (c) 2012 by Cody Maloney <cmaloney@theoreticalchaos.com>
+ */
+extern int auth_pam(const char *service_name, uid_t uid, const char *username);
 
 #endif	/* UTIL_LINUX_CH_COMMON */
diff --git a/login-utils/chfn.c b/login-utils/chfn.c
index c5312fa0c..d7d0d03f2 100644
--- a/login-utils/chfn.c
+++ b/login-utils/chfn.c
@@ -35,7 +35,6 @@
 #include "c.h"
 #include "env.h"
 #include "closestream.h"
-#include "islocal.h"
 #include "nls.h"
 #include "setpwnam.h"
 #include "strutils.h"
@@ -51,9 +50,6 @@
 
 #ifdef HAVE_LIBUSER
 # include <libuser/user.h>
-# include "libuser.h"
-#elif CHFN_CHSH_PASSWORD
-# include "auth.h"
 #endif
 
 #ifdef HAVE_LIBREADLINE
diff --git a/login-utils/chsh.c b/login-utils/chsh.c
index 4721c870e..cdbfbc405 100644
--- a/login-utils/chsh.c
+++ b/login-utils/chsh.c
@@ -35,7 +35,6 @@
 #include "c.h"
 #include "env.h"
 #include "closestream.h"
-#include "islocal.h"
 #include "nls.h"
 #include "pathnames.h"
 #include "setpwnam.h"
@@ -52,9 +51,6 @@
 
 #ifdef HAVE_LIBUSER
 # include <libuser/user.h>
-# include "libuser.h"
-#elif CHFN_CHSH_PASSWORD
-# include "auth.h"
 #endif
 
 #ifdef HAVE_LIBREADLINE
diff --git a/login-utils/islocal.c b/login-utils/islocal.c
index 7c4e775c1..5bfe61982 100644
--- a/login-utils/islocal.c
+++ b/login-utils/islocal.c
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 
 #include "closestream.h"
-#include "islocal.h"
+#include "ch-common.h"
 #include "nls.h"
 #include "pathnames.h"
 
diff --git a/login-utils/islocal.h b/login-utils/islocal.h
deleted file mode 100644
index 2c5879906..000000000
--- a/login-utils/islocal.h
+++ /dev/null
@@ -1 +0,0 @@
-extern int is_local(const char *user);
diff --git a/login-utils/libuser.c b/login-utils/libuser.c
index b11fadc1c..65538d7d4 100644
--- a/login-utils/libuser.c
+++ b/login-utils/libuser.c
@@ -8,13 +8,12 @@
  *
  */
 
-#include "libuser.h"
+#include "ch-common.h"
 
 #include <grp.h>
 #include <libuser/user.h>
 #include <unistd.h>
 
-#include "auth.h"
 #include "c.h"
 #include "nls.h"
 
diff --git a/login-utils/libuser.h b/login-utils/libuser.h
deleted file mode 100644
index 7454b997e..000000000
--- a/login-utils/libuser.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- *   libuser.h -- Utilize libuser to set a user attribute
- *   (c) 2012 by Cody Maloney <cmaloney@theoreticalchaos.com>
- *
- *   this program is free software.  you can redistribute it and
- *   modify it under the terms of the gnu general public license.
- *   there is no warranty.
- *
- */
-
-#include <sys/types.h>
-
-extern int set_value_libuser(const char *service_name, const char *username,
-			uid_t uid, const char *attr, const char *val);
-- 
2.13.3


  reply	other threads:[~2017-07-31 19:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-31 19:54 [PATCH 0/9] pull: various removals and few fixes Sami Kerola
2017-07-31 19:55 ` Sami Kerola [this message]
2017-08-01  9:27   ` [PATCH 1/9] chfn, chsh: merge auth.h, islocal.h and libuser.h to ch-common.h Karel Zak
2017-08-05 16:33     ` Sami Kerola
2017-07-31 19:55 ` [PATCH 2/9] include: move pamfail.h to auth.c Sami Kerola
2017-07-31 19:55 ` [PATCH 3/9] vipw: use explicit_bzero() to clear buffer after copy Sami Kerola
2017-07-31 19:55 ` [PATCH 4/9] uuidparse: nil uuid have all bits set to zero Sami Kerola
2017-07-31 19:55 ` [PATCH 5/9] libuuid: use access(2) when checking /dev/random availability Sami Kerola
2017-07-31 19:55 ` [PATCH 6/9] bash-completion: look for look completions Sami Kerola
2017-07-31 19:55 ` [PATCH 7/9] agetty: remove dead DO_DEVFS_FIDDLING code segment Sami Kerola
2017-07-31 19:55 ` [PATCH 8/9] agetty: add --compile-time option Sami Kerola
2017-08-01  9:41   ` Karel Zak
2017-08-05 16:44     ` Sami Kerola
2017-07-31 19:55 ` [PATCH 9/9] agetty: fix invalid usage crash Sami Kerola
2017-08-01  9:42   ` Karel Zak
2017-08-05 16:34     ` Sami Kerola
2017-08-07  7:54 ` [PATCH 0/9] pull: various removals and few fixes Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170731195508.11661-2-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox