* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $OpenBSD: auth.h,v 1.14 2001/03/28 22:43:31 markus Exp $
+ * $OpenBSD: auth.h,v 1.18 2001/06/23 00:20:58 markus Exp $
*/
#ifndef AUTH_H
#define AUTH_H
+#include "key.h"
+#include "hostfile.h"
#include <openssl/rsa.h>
#ifdef HAVE_LOGIN_CAP
#endif
typedef struct Authctxt Authctxt;
+typedef struct KbdintDevice KbdintDevice;
+
struct Authctxt {
int success;
int postponed;
char *service;
struct passwd *pw;
char *style;
+ void *kbdintctxt;
#ifdef BSD_AUTH
auth_session_t *as;
#endif
};
+/*
+ * Keyboard interactive device:
+ * init_ctx returns: non NULL upon success
+ * query returns: 0 - success, otherwise failure
+ * respond returns: 0 - success, 1 - need further interaction,
+ * otherwise - failure
+ */
+struct KbdintDevice
+{
+ const char *name;
+ void* (*init_ctx) __P((Authctxt*));
+ int (*query) __P((void *ctx, char **name, char **infotxt,
+ u_int *numprompts, char ***prompts,
+ u_int **echo_on));
+ int (*respond) __P((void *ctx, u_int numresp, char **responses));
+ void (*free_ctx) __P((void *ctx));
+};
+
/*
* Tries to authenticate the user using the .rhosts file. Returns true if
* authentication succeeds. If ignore_rhosts is non-zero, this will not
*/
int auth_rhosts(struct passwd * pw, const char *client_user);
+/* extended interface similar to auth_rhosts() */
+int
+auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname,
+ const char *ipaddr);
+
/*
* Tries to authenticate the user using the .rhosts file and the host using
* its host key. Returns true if authentication succeeds.
int allowed_user(struct passwd * pw);
-char *get_challenge(Authctxt *authctxt, char *devs);
-int verify_response(Authctxt *authctxt, char *response);
+char *get_challenge(Authctxt *authctxt);
+int verify_response(Authctxt *authctxt, const char *response);
struct passwd * auth_get_user(void);
+/* expand a filename - return buffer is allocated by xmalloc */
+char *expand_filename(const char *template, struct passwd *pw);
+char *authorized_keys_file(struct passwd *pw);
+char *authorized_keys_file2(struct passwd *pw);
+
+/* check a file and the path to it */
+int
+secure_filename(FILE *f, const char *file, uid_t u, char *err, size_t errlen);
+
+/* helper for hostbased auth */
+HostStatus
+check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host,
+ const char *sysfile, const char *userfile);
+
#define AUTH_FAIL_MAX 6
#define AUTH_FAIL_LOG (AUTH_FAIL_MAX/2)
#define AUTH_FAIL_MSG "Too many authentication failures for %.100s"