From a2bd1bf8ffb76c24dba06e58fce43b9c8aae9080 Mon Sep 17 00:00:00 2001 From: Dante Catalfamo Date: Sun, 30 May 2021 01:27:34 -0400 Subject: bsd-auth: Rearrange helper function --- .../WIP-how-bsd-authentication-works/index.org | 63 +++++++++++----------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/content/posts/WIP-how-bsd-authentication-works/index.org b/content/posts/WIP-how-bsd-authentication-works/index.org index 352a353..01919e8 100644 --- a/content/posts/WIP-how-bsd-authentication-works/index.org +++ b/content/posts/WIP-how-bsd-authentication-works/index.org @@ -2127,37 +2127,6 @@ Interestingly, this function will return =0= if an account doesn't exist, instead of =-1=. - <> - -* _auth_validuser - :PROPERTIES: - :CUSTOM_ID: _auth_validuser - :END: - - @@html:
@@ - #+begin_src c - int _auth_validuser(const char *name) - #+end_src - @@html: @@ - #+begin_src c - { - /* User name must be specified and may not start with a '-'. */ - if (*name == '\0' || *name == '-') { - syslog(LOG_ERR, "invalid user name %s", name); - return 0; - } - return 1; - } - #+end_src - @@html:
@@ - - =_auth_validuser= is a small helper function used to check if a - username passes some very basic validity criteria. Those being that - it must not be an empty sting, and that it doesn't start with a - hyphen. - - If a username is invalid, it is logged in the syslog. - * auth_approval :PROPERTIES: :CUSTOM_ID: auth_approval @@ -2303,10 +2272,40 @@ #+end_src @@html: @@ - =auth_approval= is + =auth_approval= is used to check user =name= against approval script + for service =type=. <> +* _auth_validuser + :PROPERTIES: + :CUSTOM_ID: _auth_validuser + :END: + + @@html:
@@ + #+begin_src c + int _auth_validuser(const char *name) + #+end_src + @@html: @@ + #+begin_src c + { + /* User name must be specified and may not start with a '-'. */ + if (*name == '\0' || *name == '-') { + syslog(LOG_ERR, "invalid user name %s", name); + return 0; + } + return 1; + } + #+end_src + @@html:
@@ + + =_auth_validuser= is a small helper function used to check if a + username passes some very basic validity criteria. Those being that + it must not be an empty sting, and that it doesn't start with a + hyphen. + + If a username is invalid, it is logged in the syslog. + * COMMENT note :noexport: --- -- cgit v1.2.3