Use strcspn to convert the newline to NUL in fgets results.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11462 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2002-09-16 Jacques Vidrine <nectar@kth.se>
|
||||||
|
|
||||||
|
* lib/krb5/kuserok.c, lib/krb5/prompter_posix.c: use strcspn
|
||||||
|
to convert the newline to NUL in fgets results.
|
||||||
|
|
||||||
2002-09-13 Johan Danielsson <joda@pdc.kth.se>
|
2002-09-13 Johan Danielsson <joda@pdc.kth.se>
|
||||||
|
|
||||||
* kuser/kinit.1: remove unneeded Ns
|
* kuser/kinit.1: remove unneeded Ns
|
||||||
|
@@ -88,9 +88,7 @@ krb5_kuserok (krb5_context context,
|
|||||||
while (fgets (buf, sizeof(buf), f) != NULL) {
|
while (fgets (buf, sizeof(buf), f) != NULL) {
|
||||||
krb5_principal tmp;
|
krb5_principal tmp;
|
||||||
|
|
||||||
if(buf[strlen(buf) - 1] == '\n')
|
buf[strcspn(buf, "\n")] = '\0';
|
||||||
buf[strlen(buf) - 1] = '\0';
|
|
||||||
|
|
||||||
ret = krb5_parse_name (context, buf, &tmp);
|
ret = krb5_parse_name (context, buf, &tmp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
@@ -65,8 +65,7 @@ krb5_prompter_posix (krb5_context context,
|
|||||||
prompts[i].reply->length,
|
prompts[i].reply->length,
|
||||||
stdin) == NULL)
|
stdin) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
if(s[strlen(s) - 1] == '\n')
|
s[strcspn(s, "\n")] = '\0';
|
||||||
s[strlen(s) - 1] = '\0';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user