Skip to content

Commit 442f4d9

Browse files
Fix bug in ocrc.c#combinecredentials
where a null user+pwd generates garbage. This in turn interferes with using .netrc because the garbage user+pwd can (sometimes) override the .netrc. Not entirely sure what is going on because it works as is under e.g. cygwin. In any case it needs fixing.
1 parent ceb3b4b commit 442f4d9

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

libdap4/d4rc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ storedump(char* msg, NClist* triples)
519519
for(i=0;i<nclistlength(triples);i++) {
520520
NCD4triple* t = (NCD4triple*)nclistget(triples,i);
521521
fprintf(stderr,"\t%s\t%s\t%s\n",
522-
(strlen(t->host)==0?"--":t->host),t->key,t->value);
522+
((t->host==NULL || strlen(t->host)==0)?"--":t->host),t->key,t->value);
523523
}
524524
fflush(stderr);
525525
}

oc2/ocrc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ combinecredentials(const char* user, const char* pwd)
9191
int userPassSize;
9292
char *userPassword;
9393

94-
if(user == NULL) user = "";
95-
if(pwd == NULL) pwd = "";
96-
94+
if(user == NULL || pwd == NULL)
95+
return NULL;
9796
userPassSize = strlen(user) + strlen(pwd) + 2;
9897
userPassword = malloc(sizeof(char) * userPassSize);
9998
if (!userPassword) {

0 commit comments

Comments
 (0)