(main): check the return value from fgets
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6967 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -140,20 +140,25 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if(version5 && principal == NULL){
|
if(version5 && principal == NULL){
|
||||||
printf("Kerberos v5 principal: ");
|
printf("Kerberos v5 principal: ");
|
||||||
fgets(buf, sizeof(buf), stdin);
|
if(fgets(buf, sizeof(buf), stdin) == NULL)
|
||||||
buf[strlen(buf) - 1] = 0;
|
return 1;
|
||||||
principal = strdup(buf);
|
if(buf[strlen(buf) - 1] == '\n')
|
||||||
|
buf[strlen(buf) - 1] = '\0';
|
||||||
|
principal = estrdup(buf);
|
||||||
}
|
}
|
||||||
if(afs && cell == NULL){
|
if(afs && cell == NULL){
|
||||||
printf("AFS cell: ");
|
printf("AFS cell: ");
|
||||||
fgets(buf, sizeof(buf), stdin);
|
if(fgets(buf, sizeof(buf), stdin) == NULL)
|
||||||
buf[strlen(buf) - 1] = 0;
|
return 1;
|
||||||
cell = strdup(buf);
|
if(buf[strlen(buf) - 1] == '\n')
|
||||||
|
buf[strlen(buf) - 1] = '\0';
|
||||||
|
cell = estrdup(buf);
|
||||||
}
|
}
|
||||||
if(argv[0])
|
if(argv[0])
|
||||||
password = argv[0];
|
password = argv[0];
|
||||||
if(password == NULL){
|
if(password == NULL){
|
||||||
des_read_pw_string(buf, sizeof(buf), "Password: ", 0);
|
if(des_read_pw_string(buf, sizeof(buf), "Password: ", 0))
|
||||||
|
return 1;
|
||||||
password = buf;
|
password = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user