X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/ddf5b0259b7246c0d3207ceb22ea72379ae64e89..1e03ea3338cc5ccd9ddf4feaaacfeda1998689cc:/sbr/ruserpass.c diff --git a/sbr/ruserpass.c b/sbr/ruserpass.c index 1e43571e..55694c82 100644 --- a/sbr/ruserpass.c +++ b/sbr/ruserpass.c @@ -21,8 +21,12 @@ * distribution for complete copyright information. */ -#include -#include +#include "h/mh.h" +#include "getpass.h" +#include "ruserpass.h" +#include "credentials.h" +#include "error.h" +#include "h/utils.h" #include static FILE *cfile; @@ -64,7 +68,7 @@ static int token(char *); void ruserpass(const char *host, char **aname, char **apass, int flags) { - int t, usedefault = 0; + int t; struct stat stb; init_credentials_file (); @@ -77,10 +81,11 @@ ruserpass(const char *host, char **aname, char **apass, int flags) char tokval[MAX_TOKVAL_SIZE]; tokval[0] = '\0'; + bool usedefault = false; while ((t = token(tokval))) { switch(t) { case DEFAULT: - usedefault = 1; + usedefault = true; /* FALLTHRU */ case MACH: @@ -110,7 +115,7 @@ ruserpass(const char *host, char **aname, char **apass, int flags) user to correct it. */ inform("group or other permissions, %#o, " "forbidden: %s", stb.st_mode, credentials_file); - adios(NULL, "Remove password or correct file " + die("Remove password or correct file " "permissions."); } if (token(tokval) && *apass == 0) @@ -210,7 +215,7 @@ token(char *tokval) *cp++ = c; if (cp - tokval > MAX_TOKVAL_SIZE-1) { - adios(NULL, "credential tokens restricted to length %d", + die("credential tokens restricted to length %d", MAX_TOKVAL_SIZE - 1); } } @@ -218,7 +223,7 @@ token(char *tokval) for (t = toktabs; t->tokstr; t++) if (!strcmp(t->tokstr, tokval)) - return (t->tval); + return t->tval; - return (ID); + return ID; }