summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-09-09 19:58:12 +0000
committerLaurent Bercot <ska@appnovation.com>2021-09-09 19:58:12 +0000
commit6fdb4834cdb5557d9bd7562f61984da8bd0d9c80 (patch)
treec9ac0c6bc512beed2e550b9aba09eb2af090e6a7 /src/include
parent1f213b642deb1d8e6139d2b7daac8f639c8717e7 (diff)
downloadnsss-6fdb4834cdb5557d9bd7562f61984da8bd0d9c80.tar.xz
Prepare for 0.2.0.0, lots of changes.
- Make _r functions completely thread-safe. - Save a lot of forking by having a persistent nsss_switch_query - Introduce a timeout to make the server expire - Start writing nsss-switch, not working yet. Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nsss/nsss-switch.h31
-rw-r--r--src/include/nsss/nsssd.h4
2 files changed, 24 insertions, 11 deletions
diff --git a/src/include/nsss/nsss-switch.h b/src/include/nsss/nsss-switch.h
index e0ce2dc..9110b13 100644
--- a/src/include/nsss/nsss-switch.h
+++ b/src/include/nsss/nsss-switch.h
@@ -6,10 +6,12 @@
#include <sys/types.h>
#include <limits.h>
#include <unistd.h>
+
#include <skalibs/tai.h>
#include <skalibs/buffer.h>
#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>
+
#include <nsss/pwd-switch.h>
#include <nsss/grp-switch.h>
#include <nsss/shadow-switch.h>
@@ -26,27 +28,38 @@ typedef struct nsss_switch_s nsss_switch_t, *nsss_switch_t_ref ;
struct nsss_switch_s
{
unsigned int held ;
+ char const *path ;
buffer b ;
char buf[NSSS_SWITCH_BUFSIZE] ;
} ;
-#define NSSS_SWITCH_ZERO { .held = 0, .b = BUFFER_ZERO }
+#define NSSS_SWITCH_ZERO { .held = 0, .path = 0, .b = BUFFER_ZERO }
-#define NSSS_SWITCH_PWD 0
-#define NSSS_SWITCH_GRP 1
-#define NSSS_SWITCH_SHADOW 2
+#define NSSS_SWITCH_PWD 1
+#define NSSS_SWITCH_GRP 2
+#define NSSS_SWITCH_SHADOW 4
extern int nsss_switch_start (nsss_switch_t *, unsigned int, char const *, tain const *, tain *) ;
#define nsss_switch_start_g(a, what, s, deadline) nsss_switch_start(a, what, s, (deadline), &STAMP)
+extern int nsss_switch_startf (nsss_switch_t *, unsigned int, char const *const *, tain const *, tain *) ;
+#define nsss_switch_startf_g(a, what, argv, deadline) nsss_switch_startf(a, what, argv, (deadline), &STAMP)
extern void nsss_switch_end (nsss_switch_t *, unsigned int) ;
+ /* Internal management */
+
+#define NSSS_SWITCH_SET_TIMEOUT '\001'
+
+extern int nsss_switch_set_timeout (nsss_switch_t *, unsigned int, tain const *, tain *) ;
+#define nsss_switch_set_timeout_g(a, timeout, deadline) nsss_switch_set_timeout(a, timeout, (deadline), &STAMP)
+
+
/* Password */
-#define NSSS_SWITCH_PWD_END '\0'
-#define NSSS_SWITCH_PWD_REWIND '\001'
-#define NSSS_SWITCH_PWD_GET '\002'
-#define NSSS_SWITCH_PWD_GETBYNAME '\003'
-#define NSSS_SWITCH_PWD_GETBYUID '\004'
+#define NSSS_SWITCH_PWD_END '\010'
+#define NSSS_SWITCH_PWD_REWIND '\011'
+#define NSSS_SWITCH_PWD_GET '\012'
+#define NSSS_SWITCH_PWD_GETBYNAME '\013'
+#define NSSS_SWITCH_PWD_GETBYUID '\014'
extern int nsss_switch_pwd_end (nsss_switch_t *, tain const *, tain *) ;
#define nsss_switch_pwd_end_g(a, deadline) nsss_switch_pwd_end(a, (deadline), &STAMP)
diff --git a/src/include/nsss/nsssd.h b/src/include/nsss/nsssd.h
index b21e6d2..99e93f8 100644
--- a/src/include/nsss/nsssd.h
+++ b/src/include/nsss/nsssd.h
@@ -49,7 +49,7 @@ struct nsssd_spwd_s
/* Functions provided by libnsssd */
-extern int nsssd_main (char const *const *, char const *const *) ;
+extern int nsssd_main (char const *const *) ;
extern void nsssd_passwd_convert (struct passwd *, nsssd_passwd_t const *, char const *) ;
extern void nsssd_group_convert (struct group *, char **, nsssd_group_t const *, char const *, size_t const *) ;
extern void nsssd_spwd_convert (struct spwd *, nsssd_spwd_t const *, char const *) ;
@@ -58,7 +58,7 @@ extern void nsssd_spwd_convert (struct spwd *, nsssd_spwd_t const *, char const
/* Functions that must be provided by the backend */
extern void *nsssd_handle_init (void) ;
-extern int nsssd_handle_start (void *, char const *const *, char const *const *) ;
+extern int nsssd_handle_start (void *, char const *const *) ;
extern void nsssd_handle_end (void *) ;
extern int nsssd_pwd_start (void *) ;