From 5bb7065c734d427cfc3f9156c930d08ddbf4b05a Mon Sep 17 00:00:00 2001 From: Dante Catalfamo Date: Fri, 30 Oct 2020 00:39:35 -0400 Subject: _auth_next_arg and more on auth_call --- .../WIP-how-bsd-authentication-works/index.org | 34 +++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'content/posts/WIP-how-bsd-authentication-works/index.org') diff --git a/content/posts/WIP-how-bsd-authentication-works/index.org b/content/posts/WIP-how-bsd-authentication-works/index.org index 3e2d76f..c06596b 100644 --- a/content/posts/WIP-how-bsd-authentication-works/index.org +++ b/content/posts/WIP-how-bsd-authentication-works/index.org @@ -406,8 +406,6 @@ =auth_call= is responsible for setting up the environment, calling the modules, and communicating with them. - First, the variable arguments are placed in =as->ap0=. - An array of char pointers called =argv= is allocated to hold the arguments for the auth module. @@ -415,18 +413,19 @@ char *argv[64]; /* 64 args should be more than enough */ #+END_SRC - - =auth_next_arg= - #+BEGIN_SRC c - static char * _auth_next_arg(auth_session_t *as) - #+END_SRC + First, the variable arguments are placed in =as->ap0=. - First goes through =as->ap0=, returning one argument at a time - until it hits the =NULL= character pointer. At which point it - calls =va_end(as->ap0)= and =explicit_bzero='s it. + =_auth_next_arg= is called once, with the result being set as the + first element in =argv=. If =as->fd= is set, add =-v= and =fd=4= to + =argv=. - Moves on to do the same thing for =as->ap=. + Then it loops through the =optlist= and appends =-v= followed the + option for each of them. - Finally when it's gone through both lists, returns =NULL= + After that the rest of the arguments are retrieved from + =_auth_next_arg= and added to the end of =argv=. + + If there are any extra options left over <> @@ -588,6 +587,19 @@ after reading both the man page and source. --- +** _auth_next_arg + #+BEGIN_SRC c + static char * _auth_next_arg(auth_session_t *as) + #+END_SRC + + First goes through =as->ap0=, returning one argument at a time + until it hits the =NULL= character pointer. At which point it + calls =va_end(as->ap0)= and =explicit_bzero='s it. + + Moves on to do the same thing for =as->ap=. + + Finally when it's gone through both lists, returns =NULL= + ** _auth_spool ** _recv_fd -- cgit v1.2.3