From 57f1ee12382f2beed8a60fecca3863f4656dd691 Mon Sep 17 00:00:00 2001 From: Dante Catalfamo Date: Sat, 31 Oct 2020 14:15:50 -0400 Subject: auth_close --- .../WIP-how-bsd-authentication-works/index.org | 43 +++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) (limited to 'content') diff --git a/content/posts/WIP-how-bsd-authentication-works/index.org b/content/posts/WIP-how-bsd-authentication-works/index.org index f24693d..898b634 100644 --- a/content/posts/WIP-how-bsd-authentication-works/index.org +++ b/content/posts/WIP-how-bsd-authentication-works/index.org @@ -303,6 +303,10 @@ =auth_setenv= scans through =as->spool=, modifying the environment according to =BI_SETENV= and =BI_UNSETENV= instructions. + +** auth_getvalue + + <> * auth_open #+begin_src c @@ -733,17 +737,38 @@ removing any files requested by the authentication module, and freeing =as=. - First it saves the state in a variable =s= + First it saves the allow state of =as->state= in a variable =s=. -<> + #+begin_src c + s = as->state & AUTH_ALLOW; + #+end_src + + If =s= is equal to =0=, =as->index= is set to =0=, truncating + =as->spool= so that no further functions will be able to read from + it. + + It then modifies the environment using =auth_setenv= + + #+begin_src c + auth_setenv(as); + #+end_src + + All =as->rmlist= structs are checked. If =s= is equal to =0=, the + files are deleted. All =rmlist= structs are then freed. + + All =as->optlist= structs are freed. + + All =as->data= structs are =explicit_bzero='d and then freed. + + =as->pwd= is =explicit_bzero='d and freed. - It first sets the environment variables returned through the back - channel by passing the auth session to =auth_setenv=. It then goes - through the =rmlist= of the session, deleting the files if the - session reported a failure. It then zeroes out all sensitive - information, and frees the various structs associated with the current - =auth_session_t=, and then the session itself. Finally it returns - the session's state =&='ed with =AUTH_ALLOW=. + All remaining structs referenced by =as= are freed. + + =as= is freed. + + =s= is returned. + +<> * grapgh? # Setting env on auth_close(as) # partual rewrite below -- cgit v1.2.3