*/
#include "includes.h"
-RCSID("$OpenBSD: auth2-none.c,v 1.2 2002/05/31 11:35:15 markus Exp $");
+RCSID("$OpenBSD: auth2-none.c,v 1.7 2004/05/11 19:01:43 deraadt Exp $");
#include "auth.h"
#include "xmalloc.h"
{
struct stat st;
char *banner = NULL;
- off_t len, n;
+ size_t len, n;
int fd;
if ((fd = open(options.banner, O_RDONLY)) == -1)
close(fd);
return (NULL);
}
- len = st.st_size;
+ if (st.st_size > 1*1024*1024) {
+ close(fd);
+ return (NULL);
+ }
+
+ len = (size_t)st.st_size; /* truncate */
banner = xmalloc(len + 1);
n = atomicio(read, fd, banner, len);
close(fd);
if (n != len) {
- free(banner);
+ xfree(banner);
return (NULL);
}
banner[n] = '\0';
-
+
return (banner);
}
done:
if (banner)
xfree(banner);
- return;
}
static int
if (check_nt_auth(1, authctxt->pw) == 0)
return(0);
#endif
- return (authctxt->valid ? PRIVSEP(auth_password(authctxt, "")) : 0);
+ if (options.password_authentication)
+ return (PRIVSEP(auth_password(authctxt, "")));
+ return (0);
}
Authmethod method_none = {