Пример #1
0
int
auth_sia_password(Authctxt *authctxt, char *pass)
{
	int ret;
	SIAENTITY *ent = NULL;
	const char *host;

	host = get_canonical_hostname(options.verify_reverse_mapping);

	if (!authctxt->user || !pass || pass[0] == '\0')
		return(0);

	if (sia_ses_init(&ent, saved_argc, saved_argv, host, authctxt->user,
	    NULL, 0, NULL) != SIASUCCESS)
		return(0);

	if ((ret = sia_ses_authent(NULL, pass, ent)) != SIASUCCESS) {
		error("Couldn't authenticate %s from %s", authctxt->user,
		    host);
		if (ret & SIASTOP)
			sia_ses_release(&ent);
		return(0);
	}

	sia_ses_release(&ent);

	return(1);
}
Пример #2
0
int
my_sia_validate_user(sia_collect_func_t *collect, /* communication routine */
                     int argc,
                     char **argv,
                     char *hostname,    /* remote host (or user@host) info */
                     char *username,
                     char *tty,         /* ttyname() or X display (if any) */
                     int colinput,      /* can call collect() for input */
                     char *gssapi,
                     char *passphrase)  /* pre-gathered passphrase (bad) */
{
  SIAENTITY *ent = NULL;
  int status;

  status = sia_ses_init(&ent, argc, argv,
                        hostname, username, tty, colinput, gssapi);
  if (status != SIASUCCESS || !ent)
    return SIAFAIL;

  status = sia_ses_authent(collect, passphrase, ent);
  (void) sia_ses_release(&ent);
  return status;
}