From 363cc28c833ba2373fb4fddd17848d6abd616bad Mon Sep 17 00:00:00 2001
From: Dante Catalfamo
Date: Fri, 30 Oct 2020 02:38:40 -0400
Subject: More on auth_call

---
 .../WIP-how-bsd-authentication-works/index.org     | 23 ++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

(limited to 'content/posts/WIP-how-bsd-authentication-works')

diff --git a/content/posts/WIP-how-bsd-authentication-works/index.org b/content/posts/WIP-how-bsd-authentication-works/index.org
index c9dd17f..a0c8407 100644
--- a/content/posts/WIP-how-bsd-authentication-works/index.org
+++ b/content/posts/WIP-how-bsd-authentication-works/index.org
@@ -431,7 +431,7 @@
 
   The process now calls =fork()=.
 
-  Here two constants are set for the "back channel" and optional
+  Here two constants are set for the back channel and optional
   authentication file descriptors.
 
   #+begin_src c
@@ -439,7 +439,7 @@
   #define	AUTH_FD	4
   #+end_src
 
-  In the child process, the "back channel" is set to file descriptor
+  In the child process, the back channel is set to file descriptor
   3, or =COMM_FD= using =dup2(3)=. If =as->fd=, is not =-1=, it is set
   to file descriptor 4, or =AUTH_FD=, also using =dup2(3)=. The
   remainder of the file descriptors are closed using either
@@ -470,12 +470,23 @@
   #define	_PATH_BSHELL	"/bin/sh"
   #+END_SRC
 
+  In the parent process, the child's end of the back channel is
+  closed, and so is the parent's copy of =as->fd= if it exists.
 
-  The =exec='d process then listens on FD 3, which is one half of the
-  =sockpair= that was created earlier.
+  The data from =as->data= is then written to the back channel
+  sequentially, zeroed, and freed.
 
-  In the non-exec'd process, first the contents of the auth session's
-  =*data= are read in one at a time.
+  Next =as->index= is set to =0=.
+
+  The response from the authentication module is then put into
+  =as->spool= with an optional received file descriptor placed in
+  =as->fd=, using =_auth_spool=.
+
+  #+begin_src c
+  _auth_spool(as, pfd[0]);
+  #+end_src
+
+  <<here>>
 
   The data received through the back channel is then put into the
   =spool= of the auth session using =_auth_spool(as, pfd[0])=. After
-- 
cgit v1.2.3