summaryrefslogtreecommitdiff
path: root/kerberosV
diff options
context:
space:
mode:
authorBjorn Sandell <biorn@cvs.openbsd.org>2006-12-18 21:08:29 +0000
committerBjorn Sandell <biorn@cvs.openbsd.org>2006-12-18 21:08:29 +0000
commit64b7703d73ca1172d41b990e67d8b087d23bc8eb (patch)
tree37794e13831dc58962dc847effa6ab39c94a9872 /kerberosV
parent5b01109e67216975b03013730ef80c227432c6db (diff)
Sync with heimdal; clearer and might generet fewer conflicts on next import.
looks ok, beck@ ray@
Diffstat (limited to 'kerberosV')
-rw-r--r--kerberosV/src/kadmin/add-random-users.c5
-rw-r--r--kerberosV/src/kdc/string2key.c6
-rw-r--r--kerberosV/src/kpasswd/kpasswd-generator.c3
-rw-r--r--kerberosV/src/kuser/generate-requests.c3
-rw-r--r--kerberosV/src/lib/kadm5/ipropd_master.c3
-rw-r--r--kerberosV/src/lib/krb5/config_file.c6
-rw-r--r--kerberosV/src/lib/sl/sl.c3
7 files changed, 9 insertions, 20 deletions
diff --git a/kerberosV/src/kadmin/add-random-users.c b/kerberosV/src/kadmin/add-random-users.c
index 3a84de9acc3..bbc035ba8ee 100644
--- a/kerberosV/src/kadmin/add-random-users.c
+++ b/kerberosV/src/kadmin/add-random-users.c
@@ -57,11 +57,8 @@ read_words (const char *filename, char ***ret_w)
while (fgets (buf, sizeof(buf), f) != NULL) {
size_t len;
+ buf[strcspn(buf, "\r\n")] = '\0';
len = strlen(buf);
- if (len != 0 && buf[len - 1] == '\n') {
- buf[len - 1] = '\0';
- --len;
- }
if (n >= alloc) {
alloc = max(alloc + 16, alloc * 2);
w = erealloc (w, alloc * sizeof(char **));
diff --git a/kerberosV/src/kdc/string2key.c b/kerberosV/src/kdc/string2key.c
index 72a9b49c9ed..8a2acb47481 100644
--- a/kerberosV/src/kdc/string2key.c
+++ b/kerberosV/src/kdc/string2key.c
@@ -161,16 +161,14 @@ main(int argc, char **argv)
printf("Kerberos v5 principal: ");
if(fgets(buf, sizeof(buf), stdin) == NULL)
return 1;
- if(buf[0] != '\0' && buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
principal = estrdup(buf);
}
if(afs && cell == NULL){
printf("AFS cell: ");
if(fgets(buf, sizeof(buf), stdin) == NULL)
return 1;
- if(buf[0] != '\0' && buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
cell = estrdup(buf);
}
if(argv[0])
diff --git a/kerberosV/src/kpasswd/kpasswd-generator.c b/kerberosV/src/kpasswd/kpasswd-generator.c
index c080fa708e6..f11ae2d9cd0 100644
--- a/kerberosV/src/kpasswd/kpasswd-generator.c
+++ b/kerberosV/src/kpasswd/kpasswd-generator.c
@@ -48,8 +48,7 @@ read_words (const char *filename, char ***ret_w)
err (1, "cannot open %s", filename);
alloc = n = 0;
while (fgets (buf, sizeof(buf), f) != NULL) {
- if (buf[0] != '\0' && buf[strlen (buf) - 1] == '\n')
- buf[strlen (buf) - 1] = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
if (n >= alloc) {
alloc += 16;
w = erealloc (w, alloc * sizeof(char **));
diff --git a/kerberosV/src/kuser/generate-requests.c b/kerberosV/src/kuser/generate-requests.c
index 70380fae44e..2c2f2849073 100644
--- a/kerberosV/src/kuser/generate-requests.c
+++ b/kerberosV/src/kuser/generate-requests.c
@@ -58,8 +58,7 @@ read_words (const char *filename, char ***ret_w)
err (1, "cannot open %s", filename);
alloc = n = 0;
while (fgets (buf, sizeof(buf), f) != NULL) {
- if (buf[0] != '\0' && buf[strlen (buf) - 1] == '\n')
- buf[strlen (buf) - 1] = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
if (n >= alloc) {
alloc += 16;
w = erealloc (w, alloc * sizeof(char **));
diff --git a/kerberosV/src/lib/kadm5/ipropd_master.c b/kerberosV/src/lib/kadm5/ipropd_master.c
index 4e9e00dd06e..3dd2cebb59a 100644
--- a/kerberosV/src/lib/kadm5/ipropd_master.c
+++ b/kerberosV/src/lib/kadm5/ipropd_master.c
@@ -127,8 +127,7 @@ check_acl (krb5_context context, const char *name)
if (fp == NULL)
return 1;
while (fgets(buf, sizeof(buf), fp) != NULL) {
- if (buf[0] != '\0' && buf[strlen(buf) - 1 ] == '\n')
- buf[strlen(buf) - 1 ] = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
if (strcmp (buf, name) == 0) {
ret = 0;
break;
diff --git a/kerberosV/src/lib/krb5/config_file.c b/kerberosV/src/lib/krb5/config_file.c
index 3c400539ff8..3c2a252b883 100644
--- a/kerberosV/src/lib/krb5/config_file.c
+++ b/kerberosV/src/lib/krb5/config_file.c
@@ -158,8 +158,7 @@ parse_list(struct fileptr *f, unsigned *lineno, krb5_config_binding **parent,
char *p;
++*lineno;
- if (buf[0] != '\0' && buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
p = buf;
while(isspace((unsigned char)*p))
++p;
@@ -255,8 +254,7 @@ krb5_config_parse_debug (struct fileptr *f,
char *p;
++*lineno;
- if(buf[0] != '\0' && buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
p = buf;
while(isspace((unsigned char)*p))
++p;
diff --git a/kerberosV/src/lib/sl/sl.c b/kerberosV/src/lib/sl/sl.c
index fd1125d7ef3..dfe68b946c4 100644
--- a/kerberosV/src/lib/sl/sl.c
+++ b/kerberosV/src/lib/sl/sl.c
@@ -214,8 +214,7 @@ readline(char *prompt)
fflush (stdout);
if(fgets(buf, sizeof(buf), stdin) == NULL)
return NULL;
- if (buf[0] != '\0' && buf[strlen(buf) - 1] == '\n')
- buf[strlen(buf) - 1] = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
return strdup(buf);
}