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.org73
1 files changed, 68 insertions, 5 deletions
diff --git a/content/posts/WIP-how-bsd-authentication-works/index.org b/content/posts/WIP-how-bsd-authentication-works/index.org
index 70fc635..60d84b8 100644
--- a/content/posts/WIP-how-bsd-authentication-works/index.org
+++ b/content/posts/WIP-how-bsd-authentication-works/index.org
@@ -52,11 +52,8 @@
:CUSTOM_ID: why
:END:
- This one is pretty difficult, since there seems to be very little
- information about how BSD Auth works apart from the source code
- itself and the man pages, which intentionally keep the internals
- opaque. This is my best attempt to understand and describe the flow
- of BSD Auth.
+ I was curious about how the internals of BSD Auth worked, and I
+ figured someone else might be too :-).
* Documentation
:PROPERTIES:
@@ -673,6 +670,72 @@
=BI_UNSETENV= from =as->spool=. This is explained under the
=auth_call= section.
+** auth_clroption
+ :PROPERTIES:
+ :CUSTOM_ID: auth_clroption
+ :END:
+
+ @@html: <details> <summary> @@
+ #+begin_src c
+ void auth_clroption(auth_session_t *as, char *option)
+ #+end_src
+ @@html: </summary> @@
+ #+begin_src c
+ {
+ struct authopts *opt, *oopt;
+ size_t len;
+
+ len = strlen(option);
+
+ if ((opt = as->optlist) == NULL)
+ return;
+
+ if (strncmp(opt->opt, option, len) == 0 &&
+ (opt->opt[len] == '=' || opt->opt[len] == '\0')) {
+ as->optlist = opt->next;
+ free(opt);
+ return;
+ }
+
+ while ((oopt = opt->next) != NULL) {
+ if (strncmp(oopt->opt, option, len) == 0 &&
+ (oopt->opt[len] == '=' || oopt->opt[len] == '\0')) {
+ opt->next = oopt->next;
+ free(oopt);
+ return;
+ }
+ opt = oopt;
+ }
+ }
+ #+end_src
+ @@html: </details> @@
+
+ =auth_clroption= removes the option named =option= from =as=.
+
+** auth_clroptions
+ :PROPERTIES:
+ :CUSTOM_ID: auth_clroptions
+ :END:
+
+ @@html: <details> <summary> @@
+ #+begin_src c
+ void auth_clroptions(auth_session_t *as)
+ #+end_src
+ @@html: </summary> @@
+ #+begin_src c
+ {
+ struct authopts *opt;
+
+ while ((opt = as->optlist) != NULL) {
+ as->optlist = opt->next;
+ free(opt);
+ }
+ }
+ #+end_src
+ @@html: </details> @@
+
+ =auth_clroptions= clears all options from =as=.
+
** auth_setenv
:PROPERTIES:
:CUSTOM_ID: auth_setenv