summaryrefslogtreecommitdiffstats
path: root/content/posts/WIP-how-bsd-authentication-works
diff options
context:
space:
mode:
authorDante Catalfamo2020-10-30 15:34:58 -0400
committerDante Catalfamo2020-10-30 15:34:58 -0400
commitdba2288e0c8e54b3187c32a74ab59cb4854061a7 (patch)
treed2a6e28dc707869cf016b12493e534be0b8d620d /content/posts/WIP-how-bsd-authentication-works
parent5963705b935b89785e2f050512f701a2248372e8 (diff)
downloadblog-dba2288e0c8e54b3187c32a74ab59cb4854061a7.tar.gz
blog-dba2288e0c8e54b3187c32a74ab59cb4854061a7.tar.bz2
blog-dba2288e0c8e54b3187c32a74ab59cb4854061a7.zip
Talk about _recv_fd
Diffstat (limited to 'content/posts/WIP-how-bsd-authentication-works')
-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.