diff options
Diffstat (limited to 'src/libstrongswan/plugins/pem/pem_builder.c')
-rw-r--r-- | src/libstrongswan/plugins/pem/pem_builder.c | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/src/libstrongswan/plugins/pem/pem_builder.c b/src/libstrongswan/plugins/pem/pem_builder.c index e9d55f3b8..254b1951b 100644 --- a/src/libstrongswan/plugins/pem/pem_builder.c +++ b/src/libstrongswan/plugins/pem/pem_builder.c @@ -455,46 +455,11 @@ static void *load_from_file(char *file, credential_type_t type, int subtype, } /** - * load the credential from a file descriptor - */ -static void *load_from_fd(int fd, credential_type_t type, int subtype, - identification_t *subject, x509_flag_t flags) -{ - char buf[8096]; - char *pos = buf; - ssize_t len, total = 0; - - while (TRUE) - { - len = read(fd, pos, buf + sizeof(buf) - pos); - if (len < 0) - { - DBG1(DBG_LIB, "reading from file descriptor failed: %s", - strerror(errno)); - return NULL; - } - if (len == 0) - { - break; - } - total += len; - if (total == sizeof(buf)) - { - DBG1(DBG_LIB, "buffer too small to read from file descriptor"); - return NULL; - } - } - return load_from_blob(chunk_create(buf, total), type, subtype, - subject, flags); -} - -/** * Load all kind of PEM encoded credentials. */ static void *pem_load(credential_type_t type, int subtype, va_list args) { char *file = NULL; - int fd = -1; chunk_t pem = chunk_empty; identification_t *subject = NULL; int flags = 0; @@ -506,9 +471,7 @@ static void *pem_load(credential_type_t type, int subtype, va_list args) case BUILD_FROM_FILE: file = va_arg(args, char*); continue; - case BUILD_FROM_FD: - fd = va_arg(args, int); - continue; + case BUILD_BLOB: case BUILD_BLOB_PEM: pem = va_arg(args, chunk_t); continue; @@ -534,10 +497,6 @@ static void *pem_load(credential_type_t type, int subtype, va_list args) { return load_from_file(file, type, subtype, subject, flags); } - if (fd != -1) - { - return load_from_fd(fd, type, subtype, subject, flags); - } return NULL; } |