diff options
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 27 |
1 files changed, 1 insertions, 26 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.127 2018/03/12 00:52:01 djm Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.128 2018/06/06 18:29:18 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. |
@@ -1005,31 +1005,6 @@ percent_expand(const char *string, ...) | |||
1005 | #undef EXPAND_MAX_KEYS | 1005 | #undef EXPAND_MAX_KEYS |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | /* | ||
1009 | * Read an entire line from a public key file into a static buffer, discarding | ||
1010 | * lines that exceed the buffer size. Returns 0 on success, -1 on failure. | ||
1011 | */ | ||
1012 | int | ||
1013 | read_keyfile_line(FILE *f, const char *filename, char *buf, size_t bufsz, | ||
1014 | u_long *lineno) | ||
1015 | { | ||
1016 | while (fgets(buf, bufsz, f) != NULL) { | ||
1017 | if (buf[0] == '\0') | ||
1018 | continue; | ||
1019 | (*lineno)++; | ||
1020 | if (buf[strlen(buf) - 1] == '\n' || feof(f)) { | ||
1021 | return 0; | ||
1022 | } else { | ||
1023 | debug("%s: %s line %lu exceeds size limit", __func__, | ||
1024 | filename, *lineno); | ||
1025 | /* discard remainder of line */ | ||
1026 | while (fgetc(f) != '\n' && !feof(f)) | ||
1027 | ; /* nothing */ | ||
1028 | } | ||
1029 | } | ||
1030 | return -1; | ||
1031 | } | ||
1032 | |||
1033 | int | 1008 | int |
1034 | tun_open(int tun, int mode, char **ifname) | 1009 | tun_open(int tun, int mode, char **ifname) |
1035 | { | 1010 | { |