if (type == LOGIN_PROCESS && d->displayType.location != Local ) {
#ifndef SVR4
- strncpy(u->ut_host, d->name, sizeof(u->ut_host));
+ snprintf(u->ut_host, sizeof(u->ut_host), "%s", d->name);
#endif
#ifdef __hpux
u->ut_addr = 0;
#endif
#ifdef TCPCONN
fd = socket (AF_INET, SOCK_STREAM, 0);
- DefineSelf (fd, file, auth);
- close (fd);
+ if(fd != -1) {
+ DefineSelf (fd, file, auth);
+ close (fd);
+ }
#endif
#ifdef DNETCONN
fd = socket (AF_DECnet, SOCK_STREAM, 0);
home = getEnv (verify->userEnviron, "HOME");
lockStatus = LOCK_ERROR;
if (home) {
- strcpy (home_name, home);
+ snprintf(home_name, sizeof(home_name), "%s", home);
if (home[strlen(home) - 1] != '/')
- strcat (home_name, "/");
- strcat (home_name, ".Xauthority");
+ snprintf(home_name, sizeof(home_name), "%s/", home_name);
+ snprintf(home_name, sizeof(home_name), "%s.Xauthority", home_name);
Debug ("XauLockAuth %s\n", home_name);
lockStatus = XauLockAuth (home_name, 1, 2, 10);
Debug ("Lock is %d\n", lockStatus);
if (!home)
return;
Debug ("RemoveUserAuthorization\n");
- strcpy (name, home);
+ snprintf(name, sizeof(name), "%s", home);
if (home[strlen(home) - 1] != '/')
- strcat (name, "/");
- strcat (name, ".Xauthority");
+ snprintf(name, sizeof(name), "%s/", name);
+ snprintf(name, sizeof(name), "%s.Xauthority", name);
Debug ("XauLockAuth %s\n", name);
lockStatus = XauLockAuth (name, 1, 2, 10);
Debug ("Lock is %d\n", lockStatus);
env = setEnv(env, LANGLIST, d->langList);
#if !defined (ENABLE_DYNAMIC_LANGLIST)
else
- if (languageList && strlen(languageList) > 0 )
+ if ( strlen(languageList) > 0 )
env = setEnv(env, LANGLIST, languageList);
#endif /* ENABLE_DYNAMIC_LANGLIST */
if ( d->setup)
bkup[0] = '\0';
if (d->authFile)
- strcpy(bkup ,d->authFile);
+ snprintf(bkup, sizeof(bkup), "%s", d->authFile);
LoadDisplayResources (d);
* open it Read/Write. This will be transparent to HP-UX.
*/
pidFd = creat (pidFile, 0644);
- close( pidFd );
+ if(pidFd != -1) {
+ close( pidFd );
+ }
pidFd = open (pidFile, 2);
}
if (pidFd == -1 || !(pidFilePtr = fdopen (pidFd, "r+")))
if (quiet) return;
- strcpy(buf,"/dev/");
- strcat(buf,d->gettyLine);
+ snprintf(buf, sizeof(buf), "/dev/%s", d->gettyLine);
if ( (tf = fopen (buf, "a")) != NULL) {
fprintf (tf,
/******************************* version.c **************************/
/******************************* xdmauth.c **************************/
#ifdef HASXDMAUTH
-extern int XdmInitAuth(
+extern void XdmInitAuth(
#if NeedWidePrototypes
unsigned int name_len,
#else
int width;
- FILE *fp, *fopen();
+ FILE *fp = NULL, *fopen();
char buffer[128];
char *str;
}
}
- fclose(fp);
+ if(fp) {
+ fclose(fp);
+ }
XtSetArg(argt[i], XmNmessageString, xmstr ); i++;
w = XmCreateInformationDialog(tlev, "copyright_msg", argt, i);
extern void _XdmcpWrapperToOddParity();
-static
-longtochars (l, c)
- long l;
- unsigned char *c;
+static void
+longtochars (long l, unsigned char *c)
{
c[0] = (l >> 24) & 0xff;
c[1] = (l >> 16) & 0xff;
if ( XrmGetResource(XresourceDB,
"Dtlogin*altDts", "Dtlogin*AltDts",
&rmtype, &rmvalue ) ) {
- strcpy(tempbuf,rmvalue.addr);
+ snprintf(tempbuf, sizeof(tempbuf), "%s", rmvalue.addr);
i = atoi(tempbuf);
}
Debug("\t %s.\n", strerror(errno));
}
else
- strcpy(dirname[j], resources);
+ snprintf(dirname[j], sizeof(dirname[j]), "%s", resources);
}
else {
- strcpy(dirname[j],resources);
+ snprintf(dirname[j], sizeof(dirname[j]), "%s", resources);
Debug("LoadAltDtsResources- found resource dir %s\n", dirname[j]);
}
- if (resources)
- {
- free (resources);
- resources = NULL;
- }
+ free (resources);
+ resources = NULL;
}
}
if (file_count == 0) {
- file_list = malloc (list_incr * sizeof(char **));
+ file_list = malloc (list_incr * sizeof(char *));
num_allocated += list_incr;
}
if (file_count + 1 > num_allocated) {
num_allocated += list_incr;
file_list = realloc (file_list,
- num_allocated * sizeof(char **));
+ num_allocated * sizeof(char *));
}
file_list[file_count] = strdup (res_file);
file_count++;
* remove the trailing spaces
*/
if(strchr(rmvalue.addr,' '))
- strcpy(tempbuf, strtok(rmvalue.addr," "));
+ snprintf(tempbuf, sizeof(tempbuf), "%s", strtok(rmvalue.addr," "));
else
- strcpy(tempbuf, rmvalue.addr);
+ snprintf(tempbuf, sizeof(tempbuf), "%s", rmvalue.addr);
if ((strcmp(tempbuf, "True") == 0) ||
(strcmp(tempbuf, "TRUE") == 0)) {
if ( d->langList && strlen(d->langList) > 0 )
env = setEnv(env, LANGLIST, d->langList);
#if !defined (ENABLE_DYNAMIC_LANGLIST)
- else if (languageList && strlen(languageList) > 0 )
+ else if (strlen(languageList) > 0 )
env = setEnv(env, LANGLIST, languageList);
#endif /* ENABLE_DYNAMIC_LANGLIST */
* figure out path to dtgreet...
*/
- strcpy(msg, progName);
+ snprintf(msg, sizeof(msg), "%s", progName);
if ((p = (char *) strrchr(msg, '/')) == NULL)
strcpy(msg,"./");
*/
- if ((p->pw_gid < 0) ||
- (setgid(p->pw_gid) == -1)) {
+ if (setgid(p->pw_gid) == -1) {
Audit(p, " attempted to login - bad group id", 1);
return(VF_BAD_GID);
}
- if ((p->pw_uid < 0) ||
- (seteuid(p->pw_uid) == -1)) {
+ if (seteuid(p->pw_uid) == -1) {
Audit(p, " attempted to login - bad user id", 1);
return(VF_BAD_UID);
return 0;
}
- if (value && *value) {
+ if (*value) {
sprintf (result, "%s=%s", name, value);
}
else {
Debug("setLang(): langlist = NULL\n");
if (langptr)
- strcpy(langlist, langptr);
+ snprintf(langlist, sizeof(langlist), "%s", langptr);
else
- strcpy(langlist, getEnv(env, "LANGLIST"));
+ snprintf(langlist, sizeof(langlist), "%s", getEnv(env, "LANGLIST"));
- if (langlist && (int) strlen(langlist) > 0) {
+ if (strlen(langlist) > 0) {
element = strtok(langlist, DELIM);
while(element) {
set_def_lang = FALSE;
}
break;
case NOTIFY_LAST_DT:
- strcpy(last_sess,home);
- strcat(last_sess,LAST_SESSION_FILE);
+ snprintf(last_sess, sizeof(last_sess), "%s%s", home, LAST_SESSION_FILE);
if((lastsession = fopen(last_sess,"r")) == NULL) {
/*
if (d->language && strlen(d->language) > 0)
langlist = d->language;
#else
- else if (languageList && strlen(languageList) > 0 )
+ else if ( strlen(languageList) > 0 )
langlist = languageList;
#endif /* ENABLE_DYNAMIC_LANGLIST */
else if (d->language && strlen(d->language) > 0 )
langlist = d->language;
#else
- else if (languageList && strlen(languageList) > 0 )
+ else if ( strlen(languageList) > 0 )
langlist = languageList;
#endif /* ENABLE_DYNAMIC_LANGLIST */
if (cbs->text->ptr)
{
- strcpy(s, cbs->text->ptr);
+ snprintf(s, sizeof(buffer) - (s - buffer), "%s", cbs->text->ptr);
s += cbs->text->length;
}
else
/** beginning of main. **/
char buff[128];
if (XmToggleButtonGadgetGetState(w)) {
- strcpy(buff, "LANG=");
- strcat(buff, client);
+ snprintf(buff, sizeof(buff), "LANG=%s", (char *) client);
putenv(buff);
execv(orig_argv[0], orig_argv);
}
char *host;
host = GetDisplayName();
- strcpy(temp, host);
- strcat(temp, " - ");
- strcat(temp, rmvalue.addr + strlen(DISPLAYNAME));
+ snprintf(temp, sizeof(temp), "%s - %s", host, rmvalue.addr + strlen(DISPLAYNAME));
xmstr = XmStringCreateLocalized(temp);
}
else {
static char auth_name[256];
static int auth_name_len;
-XdmPrintDataHex (s, a, l)
- char *s;
- char *a;
- int l;
+void
+XdmPrintDataHex(const char *s, const char *a, int l)
{
int i;
#endif
#ifdef XDMCP
-XdmPrintArray8Hex (s, a)
- char *s;
- ARRAY8Ptr a;
+void
+XdmPrintArray8Hex(const char *s, ARRAY8Ptr a)
{
XdmPrintDataHex (s, (char *) a->data, a->length);
}
#endif
+void
XdmInitAuth (name_len, name)
#if NeedWidePrototypes
unsigned int name_len;