summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2020-05-30 11:06:57 +0200
committerDaiki Ueno <ueno@gnu.org>2020-05-30 11:10:12 +0200
commit14e2203ce5d7a6bbe050861a1206873a040674e3 (patch)
tree11e6dc0698f3d4840dc01c2c537064acf79ad685
parent1976600876a3f0724b52c61d96998560dc4c0acb (diff)
downloadgnutls-tmp-fileio.tar.gz
build: write "FILE *fp" instead of "FILE *fd"tmp-fileio
This makes it clear that "fd" is not a file descriptor but a FILE pointer. Suggested by Tim Rühsen. Signed-off-by: Daiki Ueno <ueno@gnu.org>
-rw-r--r--doc/examples/ex-pkcs12.c10
-rw-r--r--lib/auth/psk_passwd.c12
-rw-r--r--lib/auth/srp_passwd.c22
-rw-r--r--lib/file.c8
-rw-r--r--lib/verify-tofu.c34
-rw-r--r--src/certtool-common.c24
-rw-r--r--src/psk.c46
-rw-r--r--src/serv.c10
-rw-r--r--src/srptool.c98
-rw-r--r--tests/srp.c18
10 files changed, 141 insertions, 141 deletions
diff --git a/doc/examples/ex-pkcs12.c b/doc/examples/ex-pkcs12.c
index 7890518f94..0e2b64ee1c 100644
--- a/doc/examples/ex-pkcs12.c
+++ b/doc/examples/ex-pkcs12.c
@@ -28,7 +28,7 @@ write_pkcs12(const gnutls_datum_t * cert,
gnutls_pkcs12_bag_t bag, key_bag;
char pkcs12_struct[10 * 1024];
size_t pkcs12_struct_size;
- FILE *fd;
+ FILE *fp;
/* A good idea might be to use gnutls_x509_privkey_get_key_id()
* to obtain a unique ID.
@@ -116,13 +116,13 @@ write_pkcs12(const gnutls_datum_t * cert,
return 1;
}
- fd = fopen(OUTFILE, "w");
- if (fd == NULL) {
+ fp = fopen(OUTFILE, "w");
+ if (fp == NULL) {
fprintf(stderr, "cannot open file\n");
return 1;
}
- fwrite(pkcs12_struct, 1, pkcs12_struct_size, fd);
- fclose(fd);
+ fwrite(pkcs12_struct, 1, pkcs12_struct_size, fp);
+ fclose(fp);
gnutls_pkcs12_bag_deinit(bag);
gnutls_pkcs12_bag_deinit(key_bag);
diff --git a/lib/auth/psk_passwd.c b/lib/auth/psk_passwd.c
index 7384703bc7..9a9d68c488 100644
--- a/lib/auth/psk_passwd.c
+++ b/lib/auth/psk_passwd.c
@@ -155,7 +155,7 @@ _gnutls_psk_pwd_find_entry(gnutls_session_t session,
gnutls_datum_t * psk)
{
gnutls_psk_server_credentials_t cred;
- FILE *fd;
+ FILE *fp;
char *line = NULL;
size_t line_size = 0;
int ret;
@@ -203,13 +203,13 @@ _gnutls_psk_pwd_find_entry(gnutls_session_t session,
/* Open the selected password file.
*/
- fd = fopen(cred->password_file, "re");
- if (fd == NULL) {
+ fp = fopen(cred->password_file, "re");
+ if (fp == NULL) {
gnutls_assert();
return GNUTLS_E_SRP_PWD_ERROR;
}
- while (getline(&line, &line_size, fd) > 0) {
+ while (getline(&line, &line_size, fp) > 0) {
if (username_matches(&username_datum, line, line_size)) {
ret = pwd_put_values(psk, line);
if (ret < 0) {
@@ -231,8 +231,8 @@ _gnutls_psk_pwd_find_entry(gnutls_session_t session,
ret = 0;
cleanup:
- if (fd != NULL)
- fclose(fd);
+ if (fp != NULL)
+ fclose(fp);
zeroize_key(line, line_size);
free(line);
diff --git a/lib/auth/srp_passwd.c b/lib/auth/srp_passwd.c
index 78848cdf10..49039a66e7 100644
--- a/lib/auth/srp_passwd.c
+++ b/lib/auth/srp_passwd.c
@@ -193,7 +193,7 @@ static int parse_tpasswd_conf_values(SRP_PWD_ENTRY * entry, char *str)
static int
pwd_read_conf(const char *pconf_file, SRP_PWD_ENTRY * entry, int idx)
{
- FILE *fd;
+ FILE *fp;
char *line = NULL;
size_t line_size = 0;
unsigned i, len;
@@ -202,14 +202,14 @@ pwd_read_conf(const char *pconf_file, SRP_PWD_ENTRY * entry, int idx)
snprintf(indexstr, sizeof(indexstr), "%u", (unsigned int) idx);
- fd = fopen(pconf_file, "re");
- if (fd == NULL) {
+ fp = fopen(pconf_file, "re");
+ if (fp == NULL) {
gnutls_assert();
return GNUTLS_E_FILE_ERROR;
}
len = strlen(indexstr);
- while (getline(&line, &line_size, fd) > 0) {
+ while (getline(&line, &line_size, fp) > 0) {
/* move to first ':' */
i = 0;
while ((i < line_size) && (line[i] != ':')
@@ -234,7 +234,7 @@ pwd_read_conf(const char *pconf_file, SRP_PWD_ENTRY * entry, int idx)
cleanup:
zeroize_key(line, line_size);
free(line);
- fclose(fd);
+ fclose(fp);
return ret;
}
@@ -244,7 +244,7 @@ _gnutls_srp_pwd_read_entry(gnutls_session_t state, char *username,
SRP_PWD_ENTRY ** _entry)
{
gnutls_srp_server_credentials_t cred;
- FILE *fd = NULL;
+ FILE *fp = NULL;
char *line = NULL;
size_t line_size = 0;
unsigned i, len;
@@ -308,15 +308,15 @@ _gnutls_srp_pwd_read_entry(gnutls_session_t state, char *username,
/* Open the selected password file.
*/
- fd = fopen(cred->password_file, "re");
- if (fd == NULL) {
+ fp = fopen(cred->password_file, "re");
+ if (fp == NULL) {
gnutls_assert();
ret = GNUTLS_E_SRP_PWD_ERROR;
goto cleanup;
}
len = strlen(username);
- while (getline(&line, &line_size, fd) > 0) {
+ while (getline(&line, &line_size, fp) > 0) {
/* move to first ':' */
i = 0;
while ((i < line_size) && (line[i] != '\0')
@@ -372,8 +372,8 @@ found:
zeroize_key(line, line_size);
free(line);
}
- if (fd)
- fclose(fd);
+ if (fp)
+ fclose(fp);
return ret;
}
diff --git a/lib/file.c b/lib/file.c
index ed044ff842..3ded84913b 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -27,13 +27,13 @@
int _gnutls_file_exists(const char *file)
{
- FILE *fd;
+ FILE *fp;
- fd = fopen(file, "re");
- if (fd == NULL)
+ fp = fopen(file, "re");
+ if (fp == NULL)
return -1;
- fclose(fd);
+ fclose(fp);
return 0;
}
diff --git a/lib/verify-tofu.c b/lib/verify-tofu.c
index 8baebaa011..5cedeed118 100644
--- a/lib/verify-tofu.c
+++ b/lib/verify-tofu.c
@@ -326,7 +326,7 @@ static int verify_pubkey(const char *file,
const char *host, const char *service,
const gnutls_datum_t * pubkey)
{
- FILE *fd;
+ FILE *fp;
char *line = NULL;
size_t line_size = 0;
int ret, l2, mismatch = 0;
@@ -343,14 +343,14 @@ static int verify_pubkey(const char *file,
if (service != NULL)
service_len = strlen(service);
- fd = fopen(file, "rbe");
- if (fd == NULL) {
+ fp = fopen(file, "rbe");
+ if (fp == NULL) {
ret = gnutls_assert_val(GNUTLS_E_FILE_ERROR);
goto cleanup;
}
do {
- l2 = getline(&line, &line_size, fd);
+ l2 = getline(&line, &line_size, fp);
if (l2 > 0) {
ret =
parse_line(line, host, host_len, service,
@@ -371,8 +371,8 @@ static int verify_pubkey(const char *file,
cleanup:
free(line);
- if (fd != NULL)
- fclose(fd);
+ if (fp != NULL)
+ fclose(fp);
gnutls_free(b64key.data);
return ret;
@@ -400,7 +400,7 @@ int store_pubkey(const char *db_name, const char *host,
const char *service, time_t expiration,
const gnutls_datum_t * pubkey)
{
- FILE *fd = NULL;
+ FILE *fp = NULL;
gnutls_datum_t b64key = { NULL, 0 };
int ret;
@@ -414,8 +414,8 @@ int store_pubkey(const char *db_name, const char *host,
goto cleanup;
}
- fd = fopen(db_name, "abe+");
- if (fd == NULL) {
+ fp = fopen(db_name, "abe+");
+ if (fp == NULL) {
ret = gnutls_assert_val(GNUTLS_E_FILE_ERROR);
goto cleanup;
}
@@ -425,14 +425,14 @@ int store_pubkey(const char *db_name, const char *host,
if (host == NULL)
host = "*";
- fprintf(fd, "|g0|%s|%s|%lu|%.*s\n", host, service,
+ fprintf(fp, "|g0|%s|%s|%lu|%.*s\n", host, service,
(unsigned long) expiration, b64key.size, b64key.data);
ret = 0;
cleanup:
- if (fd != NULL)
- fclose(fd);
+ if (fp != NULL)
+ fclose(fp);
gnutls_mutex_unlock(&_gnutls_file_mutex);
gnutls_free(b64key.data);
@@ -446,11 +446,11 @@ int store_commitment(const char *db_name, const char *host,
gnutls_digest_algorithm_t hash_algo,
const gnutls_datum_t * hash)
{
- FILE *fd;
+ FILE *fp;
char buffer[MAX_HASH_SIZE * 2 + 1];
- fd = fopen(db_name, "abe+");
- if (fd == NULL)
+ fp = fopen(db_name, "abe+");
+ if (fp == NULL)
return gnutls_assert_val(GNUTLS_E_FILE_ERROR);
if (service == NULL)
@@ -458,12 +458,12 @@ int store_commitment(const char *db_name, const char *host,
if (host == NULL)
host = "*";
- fprintf(fd, "|c0|%s|%s|%lu|%u|%s\n", host, service,
+ fprintf(fp, "|c0|%s|%s|%lu|%u|%s\n", host, service,
(unsigned long) expiration, (unsigned) hash_algo,
_gnutls_bin2hex(hash->data, hash->size, buffer,
sizeof(buffer), NULL));
- fclose(fd);
+ fclose(fp);
return 0;
}
diff --git a/src/certtool-common.c b/src/certtool-common.c
index ade6b1b569..3af2d08080 100644
--- a/src/certtool-common.c
+++ b/src/certtool-common.c
@@ -389,7 +389,7 @@ gnutls_x509_crt_t load_cert(int mand, common_info_st * info)
gnutls_x509_crt_t *load_cert_list(int mand, size_t * crt_size,
common_info_st * info)
{
- FILE *fd;
+ FILE *fp;
static gnutls_x509_crt_t *crt;
int ret;
gnutls_datum_t dat;
@@ -409,18 +409,18 @@ gnutls_x509_crt_t *load_cert_list(int mand, size_t * crt_size,
return NULL;
}
- fd = fopen(info->cert, "r");
- if (fd == NULL) {
+ fp = fopen(info->cert, "r");
+ if (fp == NULL) {
fprintf(stderr, "Could not open %s\n", info->cert);
app_exit(1);
}
- fix_lbuffer(file_size(fd));
+ fix_lbuffer(file_size(fp));
- size = fread(lbuffer, 1, lbuffer_size - 1, fd);
+ size = fread(lbuffer, 1, lbuffer_size - 1, fp);
lbuffer[size] = 0;
- fclose(fd);
+ fclose(fp);
dat.data = (void *) lbuffer;
dat.size = size;
@@ -448,7 +448,7 @@ gnutls_x509_crt_t *load_cert_list(int mand, size_t * crt_size,
gnutls_x509_crl_t *load_crl_list(int mand, size_t * crl_size,
common_info_st * info)
{
- FILE *fd;
+ FILE *fp;
static gnutls_x509_crl_t *crl;
unsigned int crl_max;
int ret;
@@ -467,18 +467,18 @@ gnutls_x509_crl_t *load_crl_list(int mand, size_t * crl_size,
return NULL;
}
- fd = fopen(info->crl, "r");
- if (fd == NULL) {
+ fp = fopen(info->crl, "r");
+ if (fp == NULL) {
fprintf(stderr, "Could not open %s\n", info->crl);
app_exit(1);
}
- fix_lbuffer(file_size(fd));
+ fix_lbuffer(file_size(fp));
- size = fread(lbuffer, 1, lbuffer_size - 1, fd);
+ size = fread(lbuffer, 1, lbuffer_size - 1, fp);
lbuffer[size] = 0;
- fclose(fd);
+ fclose(fp);
dat.data = (void *) lbuffer;
dat.size = size;
diff --git a/src/psk.c b/src/psk.c
index 775d8f80c9..6f77c6f285 100644
--- a/src/psk.c
+++ b/src/psk.c
@@ -141,35 +141,35 @@ int main(int argc, char **argv)
static int filecopy(const char *src, const char *dst)
{
- FILE *fd, *fd2;
+ FILE *fp, *fp2;
char line[5 * 1024];
char *p;
- fd = fopen(dst, "w");
- if (fd == NULL) {
+ fp = fopen(dst, "w");
+ if (fp == NULL) {
fprintf(stderr, "Cannot open '%s' for write\n", dst);
return -1;
}
- fd2 = fopen(src, "r");
- if (fd2 == NULL) {
+ fp2 = fopen(src, "r");
+ if (fp2 == NULL) {
/* empty file */
- fclose(fd);
+ fclose(fp);
return 0;
}
line[sizeof(line) - 1] = 0;
do {
- p = fgets(line, sizeof(line) - 1, fd2);
+ p = fgets(line, sizeof(line) - 1, fp2);
if (p == NULL)
break;
- fputs(line, fd);
+ fputs(line, fp);
}
while (1);
- fclose(fd);
- fclose(fd2);
+ fclose(fp);
+ fclose(fp2);
return 0;
}
@@ -178,7 +178,7 @@ static int
write_key(const char *username, const char *key, int key_size,
const char *passwd_file)
{
- FILE *fd;
+ FILE *fp;
char line[5 * 1024];
char *p, *pp;
char tmpname[1024];
@@ -186,7 +186,7 @@ write_key(const char *username, const char *key, int key_size,
/* delete previous entry */
struct stat st;
- FILE *fd2;
+ FILE *fp2;
int put;
if (strlen(passwd_file) + 5 > sizeof(tmpname)) {
@@ -207,25 +207,25 @@ write_key(const char *username, const char *key, int key_size,
return -1;
}
- fd = fopen(passwd_file, "w");
- if (fd == NULL) {
+ fp = fopen(passwd_file, "w");
+ if (fp == NULL) {
fprintf(stderr, "Cannot open '%s' for write\n",
passwd_file);
(void)remove(tmpname);
return -1;
}
- fd2 = fopen(tmpname, "r");
- if (fd2 == NULL) {
+ fp2 = fopen(tmpname, "r");
+ if (fp2 == NULL) {
fprintf(stderr, "Cannot open '%s' for read\n", tmpname);
(void)remove(tmpname);
- fclose(fd);
+ fclose(fp);
return -1;
}
put = 0;
do {
- p = fgets(line, sizeof(line) - 1, fd2);
+ p = fgets(line, sizeof(line) - 1, fp2);
if (p == NULL)
break;
@@ -237,19 +237,19 @@ write_key(const char *username, const char *key, int key_size,
MAX(strlen(username),
(unsigned int) (pp - p))) == 0) {
put = 1;
- fprintf(fd, "%s:%s\n", username, key);
+ fprintf(fp, "%s:%s\n", username, key);
} else {
- fputs(line, fd);
+ fputs(line, fp);
}
}
while (1);
if (put == 0) {
- fprintf(fd, "%s:%s\n", username, key);
+ fprintf(fp, "%s:%s\n", username, key);
}
- fclose(fd);
- fclose(fd2);
+ fclose(fp);
+ fclose(fp2);
(void)remove(tmpname);
diff --git a/src/serv.c b/src/serv.c
index 414cd0546b..57304bc9d3 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -219,7 +219,7 @@ static void read_dh_params(void)
char tmpdata[2048];
int size;
gnutls_datum_t params;
- FILE *fd;
+ FILE *fp;
if (gnutls_dh_params_init(&dh_params) < 0) {
fprintf(stderr, "Error in dh parameter initialization\n");
@@ -228,15 +228,15 @@ static void read_dh_params(void)
/* read the params file
*/
- fd = fopen(dh_params_file, "r");
- if (fd == NULL) {
+ fp = fopen(dh_params_file, "r");
+ if (fp == NULL) {
fprintf(stderr, "Could not open %s\n", dh_params_file);
exit(1);
}
- size = fread(tmpdata, 1, sizeof(tmpdata) - 1, fd);
+ size = fread(tmpdata, 1, sizeof(tmpdata) - 1, fp);
tmpdata[size] = 0;
- fclose(fd);
+ fclose(fp);
params.data = (unsigned char *) tmpdata;
params.size = size;
diff --git a/src/srptool.c b/src/srptool.c
index 27821be238..7939f6bfab 100644
--- a/src/srptool.c
+++ b/src/srptool.c
@@ -74,14 +74,14 @@ static void print_num(const char *msg, const gnutls_datum_t * num)
static int generate_create_conf(const char *tpasswd_conf)
{
- FILE *fd;
+ FILE *fp;
char line[5 * 1024];
int index = 1, srp_idx;
gnutls_datum_t g, n;
gnutls_datum_t str_g, str_n;
- fd = fopen(tpasswd_conf, "w");
- if (fd == NULL) {
+ fp = fopen(tpasswd_conf, "w");
+ if (fp == NULL) {
fprintf(stderr, "Cannot open file '%s'\n", tpasswd_conf);
return -1;
}
@@ -119,13 +119,13 @@ static int generate_create_conf(const char *tpasswd_conf)
if (gnutls_srp_base64_encode_alloc(&n, &str_n) < 0) {
fprintf(stderr, "Could not encode\n");
- fclose(fd);
+ fclose(fp);
return -1;
}
if (gnutls_srp_base64_encode_alloc(&g, &str_g) < 0) {
fprintf(stderr, "Could not encode\n");
- fclose(fd);
+ fclose(fp);
return -1;
}
@@ -134,11 +134,11 @@ static int generate_create_conf(const char *tpasswd_conf)
gnutls_free(str_n.data);
gnutls_free(str_g.data);
- fwrite(line, 1, strlen(line), fd);
+ fwrite(line, 1, strlen(line), fp);
}
- fclose(fd);
+ fclose(fp);
return 0;
@@ -211,35 +211,35 @@ _verify_passwd_int(const char *username, const char *passwd,
static int filecopy(const char *src, const char *dst)
{
- FILE *fd, *fd2;
+ FILE *fp, *fp2;
char line[5 * 1024];
char *p;
- fd = fopen(dst, "w");
- if (fd == NULL) {
+ fp = fopen(dst, "w");
+ if (fp == NULL) {
fprintf(stderr, "Cannot open '%s' for write\n", dst);
return -1;
}
- fd2 = fopen(src, "r");
- if (fd2 == NULL) {
+ fp2 = fopen(src, "r");
+ if (fp2 == NULL) {
/* empty file */
- fclose(fd);
+ fclose(fp);
return 0;
}
line[sizeof(line) - 1] = 0;
do {
- p = fgets(line, sizeof(line) - 1, fd2);
+ p = fgets(line, sizeof(line) - 1, fp2);
if (p == NULL)
break;
- fputs(line, fd);
+ fputs(line, fp);
}
while (1);
- fclose(fd);
- fclose(fd2);
+ fclose(fp);
+ fclose(fp2);
return 0;
}
@@ -247,18 +247,18 @@ static int filecopy(const char *src, const char *dst)
/* accepts password file */
static int find_strchr(const char *username, const char *file)
{
- FILE *fd;
+ FILE *fp;
char *pos;
char line[5 * 1024];
unsigned int i;
- fd = fopen(file, "r");
- if (fd == NULL) {
+ fp = fopen(file, "r");
+ if (fp == NULL) {
fprintf(stderr, "Cannot open file '%s'\n", file);
return -1;
}
- while (fgets(line, sizeof(line), fd) != NULL) {
+ while (fgets(line, sizeof(line), fp) != NULL) {
/* move to first ':' */
i = 0;
while ((line[i] != ':') && (line[i] != '\0')
@@ -269,12 +269,12 @@ static int find_strchr(const char *username, const char *file)
/* find the index */
pos = strrchr(line, ':');
pos++;
- fclose(fd);
+ fclose(fp);
return atoi(pos);
}
}
- fclose(fd);
+ fclose(fp);
return -1;
}
@@ -285,7 +285,7 @@ static int
verify_passwd(const char *conffile, const char *tpasswd,
const char *username, const char *passwd)
{
- FILE *fd;
+ FILE *fp;
char line[5 * 1024];
unsigned int i;
gnutls_datum_t g, n;
@@ -299,14 +299,14 @@ verify_passwd(const char *conffile, const char *tpasswd,
return -1;
}
- fd = fopen(conffile, "r");
- if (fd == NULL) {
+ fp = fopen(conffile, "r");
+ if (fp == NULL) {
fprintf(stderr, "Cannot find %s\n", conffile);
return -1;
}
do {
- p = fgets(line, sizeof(line) - 1, fd);
+ p = fgets(line, sizeof(line) - 1, fp);
}
while (p != NULL && atoi(p) != iindex);
@@ -316,20 +316,20 @@ verify_passwd(const char *conffile, const char *tpasswd,
}
line[sizeof(line) - 1] = 0;
- fclose(fd);
+ fclose(fp);
if ((iindex = read_conf_values(&g, &n, line)) < 0) {
fprintf(stderr, "Cannot parse conf file '%s'\n", conffile);
return -1;
}
- fd = fopen(tpasswd, "r");
- if (fd == NULL) {
+ fp = fopen(tpasswd, "r");
+ if (fp == NULL) {
fprintf(stderr, "Cannot open file '%s'\n", tpasswd);
return -1;
}
- while (fgets(line, sizeof(line), fd) != NULL) {
+ while (fgets(line, sizeof(line), fp) != NULL) {
/* move to first ':'
* This is the actual verifier.
*/
@@ -342,7 +342,7 @@ verify_passwd(const char *conffile, const char *tpasswd,
char *verifier_pos, *salt_pos;
pos = strchr(line, ':');
- fclose(fd);
+ fclose(fp);
if (pos == NULL) {
fprintf(stderr,
"Cannot parse conf file '%s'\n",
@@ -369,7 +369,7 @@ verify_passwd(const char *conffile, const char *tpasswd,
}
}
- fclose(fd);
+ fclose(fp);
return -1;
}
@@ -511,7 +511,7 @@ int
crypt_int(const char *username, const char *passwd, int salt_size,
const char *tpasswd_conf, const char *tpasswd, int uindex)
{
- FILE *fd;
+ FILE *fp;
char *cr;
gnutls_datum_t g, n;
char line[5 * 1024];
@@ -519,14 +519,14 @@ crypt_int(const char *username, const char *passwd, int salt_size,
int iindex;
char tmpname[1024];
- fd = fopen(tpasswd_conf, "r");
- if (fd == NULL) {
+ fp = fopen(tpasswd_conf, "r");
+ if (fp == NULL) {
fprintf(stderr, "Cannot find %s\n", tpasswd_conf);
return -1;
}
do { /* find the specified uindex in file */
- p = fgets(line, sizeof(line) - 1, fd);
+ p = fgets(line, sizeof(line) - 1, fp);
}
while (p != NULL && (iindex = atoi(p)) != uindex);
@@ -536,7 +536,7 @@ crypt_int(const char *username, const char *passwd, int salt_size,
}
line[sizeof(line) - 1] = 0;
- fclose(fd);
+ fclose(fp);
if ((iindex = read_conf_values(&g, &n, line)) < 0) {
fprintf(stderr, "Cannot parse conf file '%s'\n",
tpasswd_conf);
@@ -550,7 +550,7 @@ crypt_int(const char *username, const char *passwd, int salt_size,
} else {
/* delete previous entry */
struct stat st;
- FILE *fd2;
+ FILE *fp2;
int put;
if (strlen(tpasswd) + 5 > sizeof(tmpname)) {
@@ -572,16 +572,16 @@ crypt_int(const char *username, const char *passwd, int salt_size,
return -1;
}
- fd = fopen(tpasswd, "w");
- if (fd == NULL) {
+ fp = fopen(tpasswd, "w");
+ if (fp == NULL) {
fprintf(stderr, "Cannot open '%s' for write\n",
tpasswd);
(void)remove(tmpname);
return -1;
}
- fd2 = fopen(tmpname, "r");
- if (fd2 == NULL) {
+ fp2 = fopen(tmpname, "r");
+ if (fp2 == NULL) {
fprintf(stderr, "Cannot open '%s' for read\n",
tmpname);
(void)remove(tmpname);
@@ -590,7 +590,7 @@ crypt_int(const char *username, const char *passwd, int salt_size,
put = 0;
do {
- p = fgets(line, sizeof(line) - 1, fd2);
+ p = fgets(line, sizeof(line) - 1, fp2);
if (p == NULL)
break;
@@ -602,20 +602,20 @@ crypt_int(const char *username, const char *passwd, int salt_size,
MAX(strlen(username),
(unsigned int) (pp - p))) == 0) {
put = 1;
- fprintf(fd, "%s:%s:%u\n", username, cr,
+ fprintf(fp, "%s:%s:%u\n", username, cr,
iindex);
} else {
- fputs(line, fd);
+ fputs(line, fp);
}
}
while (1);
if (put == 0) {
- fprintf(fd, "%s:%s:%u\n", username, cr, iindex);
+ fprintf(fp, "%s:%s:%u\n", username, cr, iindex);
}
- fclose(fd);
- fclose(fd2);
+ fclose(fp);
+ fclose(fp2);
(void)remove(tmpname);
diff --git a/tests/srp.c b/tests/srp.c
index c927e877be..607e52ae46 100644
--- a/tests/srp.c
+++ b/tests/srp.c
@@ -329,21 +329,21 @@ const char *tpasswd_conf_file =
void doit(void)
{
- FILE *fd;
+ FILE *fp;
- fd = fopen("tpasswd.conf", "w");
- if (fd == NULL)
+ fp = fopen("tpasswd.conf", "w");
+ if (fp == NULL)
exit(1);
- fwrite(tpasswd_conf_file, 1, strlen(tpasswd_conf_file), fd);
- fclose(fd);
+ fwrite(tpasswd_conf_file, 1, strlen(tpasswd_conf_file), fp);
+ fclose(fp);
- fd = fopen("tpasswd", "w");
- if (fd == NULL)
+ fp = fopen("tpasswd", "w");
+ if (fp == NULL)
exit(1);
- fwrite(tpasswd_file, 1, strlen(tpasswd_file), fd);
- fclose(fd);
+ fwrite(tpasswd_file, 1, strlen(tpasswd_file), fp);
+ fclose(fp);
start("tls1.2 srp-1024", "NORMAL:-VERS-ALL:+VERS-TLS1.2:-KX-ALL:+SRP", "test", "test", 0);
start("tls1.2 srp-1536", "NORMAL:-VERS-ALL:+VERS-TLS1.2:-KX-ALL:+SRP", "test2", "test2", 0);