summaryrefslogtreecommitdiffstats
path: root/content/posts/WIP-how-bsd-authentication-works/index.org
diff options
context:
space:
mode:
Diffstat (limited to 'content/posts/WIP-how-bsd-authentication-works/index.org')
-rw-r--r--content/posts/WIP-how-bsd-authentication-works/index.org21
1 files changed, 19 insertions, 2 deletions
diff --git a/content/posts/WIP-how-bsd-authentication-works/index.org b/content/posts/WIP-how-bsd-authentication-works/index.org
index 9b17953..5bc90b7 100644
--- a/content/posts/WIP-how-bsd-authentication-works/index.org
+++ b/content/posts/WIP-how-bsd-authentication-works/index.org
@@ -635,10 +635,27 @@
#+end_src
=_auth_spool='s job is to read data from =fd= and place it in
- =as->spool=, and to update =as->index= to the length of the data on
- the spool.
+ =as->spool=, and to update =as->index= with the length of the data
+ on the spool. While spooling it converts newlines to =NUL='s in
+ order to parse the output more easily. It also handles any file
+ descriptors passed through the back channel by sending them to
+ =_recv_fd=.
+
+ #+begin_src c
+ // [...]
+ if (strcasecmp(s, BI_FDPASS) == 0)
+ _recv_fd(as, fd);
+ #+end_src
+
** _recv_fd
+ #+begin_src c
+ static void _recv_fd(auth_session_t *as, int fd)
+ #+end_src
+ =_recv_fd= reads control messages, also called ancillary data, from
+ =fd= and tried to receive a file descriptor. If it receives one and
+ =as->fd= is equal to =-1=, it sets it to the received file
+ descriptor. Otherwise it closes the received file descriptor.
* auth_close
=auth_close= is the function responsible for cleaning up the session
and taking care of the values returned though the back channel.