- BCOPY(apasswd, passwd, passwdlen);
- passwd[passwdlen] = '\0';
- BCOPY(auser, user, userlen);
- user[userlen] = '\0';
- *msg = (char *) 0;
+ slprintf(passwd, sizeof(passwd), "%.*v", passwdlen, apasswd);
+ slprintf(user, sizeof(user), "%.*v", userlen, auser);
+ *msg = "";
+
+ /*
+ * Check if a plugin wants to handle this.
+ */
+ if (pap_auth_hook) {
+ ret = (*pap_auth_hook)(user, passwd, msg, &addrs, &opts);
+ if (ret >= 0) {
+ if (ret)
+ set_allowed_addrs(unit, addrs, opts);
+ BZERO(passwd, sizeof(passwd));
+ return ret? UPAP_AUTHACK: UPAP_AUTHNAK;
+ }
+ }