summaryrefslogtreecommitdiff
path: root/map_common.h
diff options
context:
space:
mode:
authorDave Olson <olson@cumulusnetworks.com>2017-06-15 12:47:29 -0700
committerDave Olson <olson@cumulusnetworks.com>2017-06-15 19:48:50 -0700
commite3408e0814517e6ad898c525125cf62aad40d60b (patch)
treed2e5f6eaca0ae5c2cfbce17024da7415743e0260 /map_common.h
downloadlibnss-mapuser-e3408e0814517e6ad898c525125cf62aad40d60b.tar.gz
libnss-mapuser-e3408e0814517e6ad898c525125cf62aad40d60b.zip
Initial version of libnss-mapuser package
See README for details
Diffstat (limited to 'map_common.h')
-rw-r--r--map_common.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/map_common.h b/map_common.h
new file mode 100644
index 0000000..b4213a5
--- /dev/null
+++ b/map_common.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 Cumulus Networks, Inc.
+ * All rights reserved.
+ * Author: Dave Olson <olson@cumulusnetworks.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program - see the file COPYING.
+ */
+
+/*
+ * This is the header file for the common code used by the nss_mapuser and
+ * nss_mapuid NSS plugin library. None of it's symbols are public, they are
+ * stripped during the linking phase (made internal only).
+ */
+
+
+#include <string.h>
+#include <syslog.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <pwd.h>
+#include <errno.h>
+#include <ctype.h>
+#include <nss.h>
+
+
+/*
+ * pwbuf is used to reduce number of arguments passed around; the strings in
+ * the passwd struct need to point into this buffer.
+ */
+struct pwbuf {
+ char *name;
+ char *buf;
+ struct passwd *pw;
+ int *errnop;
+ size_t buflen;
+};
+
+/* configuration variables. */
+extern char *exclude_users;
+extern char *mappeduser;
+extern uid_t min_uid;
+extern int debug;
+
+extern int nss_mapuser_config(int *errnop, const char *lname);
+extern int pwcopy(char *buf, size_t len, struct passwd *srcpw, struct passwd *destpw,
+ const char *usename);
+extern int get_pw_mapuser(const char *name, struct pwbuf *pb);
+