Skip to content
Snippets Groups Projects
Commit e9ae96e1 authored by Steven Murray's avatar Steven Murray
Browse files

CASTOR-5083 Remove hardcoded "castorns" from send2nsd.c

Fixed.
parent 7a179c7c
Branches
Tags
No related merge requests found
......@@ -202,6 +202,7 @@ const char *sys_nserrlist[ENSMAXERR-ENSBASEOFF+2] =
"File class does not allow a copy on tape",
"Too many copies on tape",
"Cannot overwrite valid segment when replacing",
"CNS HOST not set",
"BAD ERROR NUMBER"
};
......
......@@ -216,7 +216,8 @@
#define ENSCLASSNOSEGS ENSBASEOFF+5 /* File class does not allow a copy on tape */
#define ENSTOOMANYSEGS ENSBASEOFF+6 /* Too many copies on tape */
#define ENSOVERWHENREP ENSBASEOFF+7 /* Cannot overwrite valid segment when replacing */
#define ENSMAXERR ENSBASEOFF+7
#define ENHOSTNOTSET ENSBASEOFF+8 /* CNS HOST not set */
#define ENSMAXERR ENSBASEOFF+8
/*
*------------------------------------------------------------------------
......
......@@ -502,6 +502,10 @@ The following error values are returned only by the name server package:
.TP
.B ENSTOOMANYSEGS
(1406) Too many copies on tape
.B ENSOVERWHENREP
(1407) Cannot overwrite valid segment when replacing
.B ENHOSTNOTSET
(1408) CNS HOST not set
.SH RFIO ERRORS
The following error values are returned only by the remote file I/O package:
......
......@@ -35,6 +35,7 @@ Cns_apiinit(struct Cns_api_thread_info **thip)
(*thip)->defserver[0] = '\0';
if ((p = getenv (CNS_HOST_ENV)) || (p = getconfent (CNS_SCE, "HOST", 0))) {
strncpy((*thip)->defserver, p, sizeof((*thip)->defserver));
(*thip)->defserver[sizeof((*thip)->defserver) - 1] = '\0';
}
}
return (0);
......
......@@ -34,7 +34,6 @@ int send2nsdx(int *socketp,
int actual_replen = 0;
int alloced = 0;
int c;
char Cnshost[CA_MAXHOSTNAMELEN+1];
Csec_context_t ctx;
int errflag = 0;
char func[16];
......@@ -70,14 +69,19 @@ int send2nsdx(int *socketp,
} else if (socketp == NULL && thip->fd >= 0) {
s = thip->fd; /* connection opened by Cns_starttrans */
} else { /* connection not yet opened */
char Cnshost[CA_MAXHOSTNAMELEN+1];
sin.sin_family = AF_INET;
sin.sin_port = 0;
if (host && *host)
strcpy (Cnshost, host);
else if ((p = getenv (CNS_HOST_ENV)) || (p = getconfent (CNS_SCE, "HOST", 0)))
strcpy (Cnshost, p);
else {
strcpy (Cnshost, "castorns");
if (host && *host) {
strncpy (Cnshost, host, sizeof(Cnshost));
Cnshost[sizeof(Cnshost) - 1] = '\0';
} else if ((p = getenv (CNS_HOST_ENV)) || (p = getconfent (CNS_SCE, "HOST", 0))) {
strncpy (Cnshost, p, sizeof(Cnshost));
Cnshost[sizeof(Cnshost) - 1] = '\0';
} else {
serrno = ENHOSTNOTSET;
return (-1);
}
/* If the user has decided to enable the security mode then the port can not be set
* via host:port but with the specific SECURITY_PORT options
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment