1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtlogin: fix implicit-function-declaration warnings

This commit is contained in:
Jon Trulson 2021-11-15 11:45:40 -07:00
parent abb408b24f
commit 47348e59de
15 changed files with 124 additions and 71 deletions

View file

@ -64,6 +64,9 @@
#include "rgy_base.h"
#endif
#if defined(HAS_PAM_LIBRARY)
# include <pam_svc.h>
#endif
/***************************************************************************
*
@ -126,9 +129,9 @@ static struct lastlogin last_login;
*
* Account
*
* update utmp/wtmp files.
* update utmp/wtmp files.
***************************************************************************/
void
void
Account( struct display *d, char *user, char *line, pid_t pid,
#if NeedWidePrototypes
int type,
@ -149,7 +152,7 @@ Account( struct display *d, char *user, char *line, pid_t pid,
char buf[32];
char* user_str = user ? user : "NULL";
char* line_str = line ? line : "NULL";
#ifdef __PASSWD_ETC
struct rtmp rtmp;
struct rtmp *r;
@ -158,9 +161,9 @@ Account( struct display *d, char *user, char *line, pid_t pid,
#endif
if (d->utmpId == NULL) return;
switch (type) {
case INIT_PROCESS: strcpy(buf, "INIT_PROCESS"); break;
case LOGIN_PROCESS: strcpy(buf, "LOGIN_PROCESS"); break;
case USER_PROCESS: strcpy(buf, "USER_PROCESS"); break;
@ -172,14 +175,14 @@ Account( struct display *d, char *user, char *line, pid_t pid,
d->utmpId, user_str, line_str, pid, buf);
#ifdef PAM
PamAccounting("dtlogin", d->name, d->utmpId, user,
PamAccounting("dtlogin", d->name, d->utmpId, user,
line, pid, type, exitcode);
#elif defined(HAS_PAM_LIBRARY)
_DtAccounting("dtlogin", d->name, d->utmpId, user,
line, pid, type, exitcode);
#else
# ifdef SUNAUTH
solaris_accounting("dtlogin", d->name, d->utmpId, user,
solaris_accounting("dtlogin", d->name, d->utmpId, user,
line, pid, type, exitcode);
# endif
#endif
@ -195,7 +198,7 @@ Account( struct display *d, char *user, char *line, pid_t pid,
strncpy(utmp.ut_id, d->utmpId, sizeof(u->ut_id) - 1);
utmp.ut_type = LOGIN_PROCESS;
#ifdef HAS_PAM_LIBRARY
setutxent();
if ( (u = getutxid(&utmp)) == NULL ) u = &utmp;
@ -229,7 +232,7 @@ Account( struct display *d, char *user, char *line, pid_t pid,
* determine if restricted user licenses have been exceeded.
* Currently, an unlimited number of foreign displays can log in.
*/
if (user) snprintf(u->ut_user, sizeof(u->ut_user), "%s", user);
if (line) {
#ifdef _AIX
@ -259,7 +262,7 @@ Account( struct display *d, char *user, char *line, pid_t pid,
}
else
snprintf(u->ut_line, sizeof(u->ut_line), "%s", line);
#else
snprintf(u->ut_line, sizeof(u->ut_line), "%s", line);
#endif
@ -285,21 +288,26 @@ Account( struct display *d, char *user, char *line, pid_t pid,
u->ut_addr = 0;
#endif
}
#ifndef HAS_PAM_LIBRARY
if (type == USER_PROCESS)
u->ut_exit.e_exit = (d->displayType.location == Local ? 1 : 0 );
#endif
}
}
#ifdef HAS_PAM_LIBRARY
(void) time(&u->ut_tv);
{
struct timeval tmp_tv;
(void) gettimeofday(&tmp_tv, NULL);
u->ut_tv.tv_sec = (int32_t)tmp_tv.tv_sec;
u->ut_tv.tv_usec = (int32_t)tmp_tv.tv_usec;
}
#else
(void) time(&u->ut_time);
#endif
/*
* write to utmp...
/*
* write to utmp...
*
* (Do not close utmp yet. If "u" points to the static structure, it is
* cleared upon close. This does not bode well for the following write
@ -329,7 +337,7 @@ Account( struct display *d, char *user, char *line, pid_t pid,
/*
* close utmp...
*/
endutent();
#else
endutxent();
@ -380,7 +388,7 @@ Account( struct display *d, char *user, char *line, pid_t pid,
}
Debug("logging lastlogin entry (user=%s)\n",user);
dt_lastlogin(user,&last_login);
dt_lastlogin(user,&last_login);
free(last_login.stty);
free(last_login.shost);
}
@ -400,10 +408,10 @@ Account( struct display *d, char *user, char *line, pid_t pid,
* see if a particular utmp ID is available
*
* return codes: 0 = ID is in use
* 1 = ID is open
* 1 = ID is open
***************************************************************************/
int
int
UtmpIdOpen( char *utmpId )
{
int status = 1; /* return code */
@ -426,7 +434,7 @@ UtmpIdOpen( char *utmpId )
break;
}
}
#ifdef HAS_PAM_LIBRARY
endutxent();
#else
@ -446,8 +454,8 @@ struct lastlogin * llogin;
char *tmp_char;
char *tmp_int;
/*
* We are loading all the lastlogin info into a struct and then dealing
* with that so if the technique of storing the values is redone it
* We are loading all the lastlogin info into a struct and then dealing
* with that so if the technique of storing the values is redone it
* will be easy
*/
/* set id back to root */
@ -503,4 +511,3 @@ struct lastlogin * llogin;
enduserdb();
}
#endif

View file

@ -70,6 +70,11 @@
static char *Print8Address (ARRAY8Ptr Address);
int LoadXloginResources(struct display *d); // session.c
void GetSysParms(char **tzpp, char **fhpp, char **ftpp); // fontpath.c
int GetChooserAddr(char *addr, int *lenp); // socket.c
int NetaddrFamily(XdmcpNetaddr netaddrp); // netaddr.c
static int
FormatBytes (

View file

@ -209,6 +209,12 @@ static int pingTry;
static XdmcpBuffer directBuffer, broadcastBuffer;
static XdmcpBuffer buffer;
// dtchooser.c
void MakeBackground(void);
void MakeButtons(void);
void MakeChooser(void);
/* ARGSUSED */
static void

View file

@ -142,6 +142,9 @@ int TitleLen;
static int parent_pid = -1; /* PID of parent dtlogin process */
void init_session_id(void); // xdmcp.c
void RunChooser(struct display *d); // RunChooser.c
/***************************************************************************/

View file

@ -38,6 +38,7 @@
# include "dm.h"
# include <signal.h>
# include <X11/Xatom.h>
# include <X11/Xmu/Error.h>
# include <setjmp.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8
# include <utmpx.h>
@ -57,6 +58,8 @@ static int PathInPList(char *path, char **fplist, int listlen);
static int PathInZList(char *path, char *fplist, int listlen);
static int SeparateParts( char **path );
void GenerateAuthData(char *auth, int len); // genauth.c
static void
DebugFontPath(char *note, char **path, int nelems)

View file

@ -94,7 +94,6 @@ from the X Consortium.
# include <X11/Xauth.h>
# include <X11/Xos.h>
# include "dm.h"
#include <errno.h>
#ifdef X_NOT_STDC_ENV
@ -131,11 +130,16 @@ static int sumFile (char *name, long sum[2]);
#ifdef HASXDMAUTH
// Most of this comes from XDMCP's Wrap.h header
typedef unsigned char auth_cblock[8]; /* block size */
typedef struct auth_ks_struct { auth_cblock _; } auth_wrapper_schedule[16];
extern void _XdmcpWrapperToOddParity();
void _XdmcpWrapperToOddParity();
void _XdmcpAuthSetup (auth_cblock key, auth_wrapper_schedule schedule);
void _XdmcpAuthDoIt (auth_cblock input, auth_cblock output,
auth_wrapper_schedule schedule, int edflag);
static void
longtochars (long l, unsigned char *c)

View file

@ -92,6 +92,8 @@ from the X Consortium.
static char auth_name[256];
static int auth_name_len;
void GenerateAuthData (char *auth, int len); // genauth.c
#if NeedWidePrototypes
int MitInitAuth (unsigned int name_len, char *name)
#else

View file

@ -57,9 +57,11 @@
# include <string.h>
void CleanUpName( char *src, char *dst, int len) ;
static char * getFullFileName(char *name, int special, char * lang);
extern char * qualifyWithFirst(char *, char *);
void CleanUpName( char *src, char *dst, int len) ;
static char * getFullFileName(char *name, int special, char * lang);
extern char * qualifyWithFirst(char *, char *);
void GetSysParms(char **tzpp, char **fhpp, char **ftpp); // fontpath.c
/* XtOffset() hack for ibmrt BandAidCompiler */

View file

@ -65,6 +65,7 @@
# include "vgmsg.h"
# include <signal.h>
# include <X11/Xatom.h>
# include <X11/Xmu/Error.h>
# include <setjmp.h>
#if defined(__FreeBSD__) && OSMAJORVERSION > 8 || defined(HAS_PAM_LIBRARY)
# include <utmpx.h>
@ -76,6 +77,7 @@
#include <dirent.h>
#include <limits.h>
#include <ctype.h>
#include <grp.h>
#ifdef SIA
#include <sia.h>
@ -110,6 +112,8 @@
#include <PamSvc.h>
#endif
int ApplyFontPathMods(struct display *d, Display *dpy); // fontpath.c
#ifdef SIA
static SIAENTITY *siaHandle = NULL;
@ -221,6 +225,7 @@ static int session_execve(char *path, char *argv[], char *envp[]);
static void LoadAltDtsResources( struct display *d);
char * _ExpandLang(char *string, char *lang);
void freeEnv (char **env); // util.c
/***************************************************************************
@ -265,7 +270,7 @@ catchAlrm( int arg )
#if defined(__STDC__)
static int
FileNameCompare (const char *a, const char *b)
FileNameCompare (const void *a, const void *b)
#else
static int
FileNameCompare (char *a, char *b)

View file

@ -105,6 +105,9 @@ extern int chooserFd;
extern FD_TYPE WellKnownSocketsMask;
extern int WellKnownSocketsMax;
void registerHostname (char *name, int namelen); // xdmcp.c
int
CreateWellKnownSockets (void)
{

View file

@ -86,6 +86,7 @@
#if defined(PAM) || defined(HAS_PAM_LIBRARY)
#include <security/pam_appl.h>
#include "pam_svc.h"
#endif
#ifdef _AIX

View file

@ -59,14 +59,13 @@
#include <string.h>
#include <dirent.h>
#include <Dt/MsgCatP.h>
#include <X11/Xutil.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xmu/SysUtil.h>
#include <Dt/HourGlass.h>
#include <signal.h>
# ifndef NULL
# define NULL 0
# endif
# include "dm.h"
# include "vgmsg.h"
nl_catd nl_fd = (nl_catd)-1; /* message catalog file descriptor */
@ -86,13 +85,13 @@ char languageList[LANGLISTSIZE]; /* global list of languages */
*
***************************************************************************/
static char * makeEnv(
static char * makeEnv(
char *name,
char *value) ;
static SIGVAL MakeLangAbort(
int arg );
static int MatchesFileSuffix(const char *filename, const char *suffix);
static void ScanNLSDir(
@ -134,7 +133,7 @@ ReadCatalog( int set_num, int msg_num, char *def_str )
{
curNlsPath = NULL;
}
/*
* 7 is "NLSPATH"
* 1 is "="
@ -153,7 +152,7 @@ ReadCatalog( int set_num, int msg_num, char *def_str )
}
newNlsPath = malloc(newNlsPathLen); /* placed in environ, do not free */
if (curNlsPath != NULL)
{
sprintf(newNlsPath, "NLSPATH=%s:%s", curNlsPath, NLS_PATH_STRING);
@ -162,12 +161,12 @@ ReadCatalog( int set_num, int msg_num, char *def_str )
{
sprintf(newNlsPath, "NLSPATH=%s", NLS_PATH_STRING);
}
/*
* Store new NLSPATH in environment. Note this memory cannot be freed
* Store new NLSPATH in environment. Note this memory cannot be freed
*/
putenv(newNlsPath);
/*
* Open message catalog. Note, if invalid descriptor returned (ie
* msg catalog could not be opened), subsequent call to catgets() using
@ -186,7 +185,7 @@ printEnv( char **e )
Debug (" %s\n", *e++);
}
static char *
static char *
makeEnv( char *name, char *value )
{
char *result;
@ -208,7 +207,7 @@ makeEnv( char *name, char *value )
return result;
}
char *
char *
getEnv( char **e, char *name )
{
int l = strlen (name);
@ -224,7 +223,7 @@ getEnv( char **e, char *name )
return 0;
}
char **
char **
setEnv( char **e, char *name, char *value )
{
char **new, **old;
@ -282,7 +281,7 @@ freeEnv (char **env)
# define isblank(c) ((c) == ' ' || c == '\t')
char **
char **
parseArgs( char **argv, char *string )
{
char *word;
@ -357,26 +356,26 @@ CleanUpChild( void )
CloseOnFork ();
}
char * *
char * *
parseEnv( char **e, char *string )
{
char *s1, *s2, *t1, *t2;
s1 = s2 = strdup(string);
while ((t1 = strtok(s1," \t")) != NULL ) {
if ( (t2 = strchr(t1,'=')) != NULL ) {
*t2++ = '\0';
e = setEnv(e, t1, t2);
}
s1 = NULL;
}
free(s2);
return (e);
}
}
/*************************************<->*************************************
*
@ -392,7 +391,7 @@ parseEnv( char **e, char *string )
* ------
* dpy = display
* w = window
*
*
* Outputs:
* -------
* None
@ -400,16 +399,16 @@ parseEnv( char **e, char *string )
* Comments:
* --------
* None. (None doesn't count as a comment)
*
*
*************************************<->***********************************/
void
void
SetHourGlassCursor( Display *dpy, Window w )
{
Cursor cursor;
XUndefineCursor(dpy, w);
cursor = _DtGetHourGlassCursor(dpy);
XDefineCursor(dpy, w, cursor);
@ -424,7 +423,7 @@ SetHourGlassCursor( Display *dpy, Window w )
*
* Generate the list of languages installed on the host.
* Result is stored the global array "languageList"
*
*
***************************************************************************/
#define DELIM " \t" /* delimiters in language list */
@ -451,7 +450,7 @@ MakeLangList( void )
/*
* build language list from set of languages installed on the host...
* Wrap a timer around it so it doesn't hang things up too long.
* langListTimeout resource by default is 30 seconds to scan NLS dir.
* langListTimeout resource by default is 30 seconds to scan NLS dir.
*/
p = languageList;
@ -512,7 +511,7 @@ MakeLangList( void )
free(savelist);
}
}
static int
@ -521,7 +520,7 @@ MatchesFileSuffix(const char *filename, const char *suffix)
int retval = 0;
#if defined(_AIX) || defined(SVR4) || defined(__linux__) || defined(CSRG_BASED)
int different = 1;
/*
* The assumption here is that the use of strrstr is
* to determine if "dp->d_name" ends in ".cat".
@ -543,7 +542,7 @@ MatchesFileSuffix(const char *filename, const char *suffix)
* Scan a directory structure to see if it contains an installed language.
* If so, the name of the language is appended to a global list of languages.
*
* Scan method and scan directory will vary by platform.
* Scan method and scan directory will vary by platform.
*
***************************************************************************/
@ -610,7 +609,7 @@ ScanNLSDir(char *dirname)
struct stat statb;
char buf[1024];
/*
* Scan input directory, looking for a LOCALE file. If a sub-directory
* is found, recurse down into it...
@ -664,7 +663,7 @@ ScanNLSDir(char *dirname)
continue;
}
/*
* if this file is a directory, scan it also...
*/
@ -687,12 +686,12 @@ ScanNLSDir(char *dirname)
{
DIR *dirp;
struct dirent *dp;
char* locale;
char* locale;
char locale_path[MAXPATHLEN];
struct stat locale_stat;
int retval;
/*
/*
* To determin the fully installed locale list, check several locations.
*/
if(NULL != (dirp = opendir(dirname)))
@ -789,8 +788,8 @@ setLang( struct display *d, char **env , char *langptr)
int s = 0;
char *element = NULL;
int set_def_lang = FALSE;
if (NULL != langptr)
Debug("setLang(): langlist = %s\n", langptr);
else
@ -811,13 +810,13 @@ setLang( struct display *d, char **env , char *langptr)
}
else
set_def_lang = TRUE;
s += strlen(element) +1;
element = strtok(langlist+s, DELIM);
}
} else
set_def_lang = TRUE;
if (set_def_lang) {
env = setEnv(env, "LANG", "C");
d->language = strdup("C");
@ -838,4 +837,3 @@ localHostname (void)
}
return localHostbuf;
}

View file

@ -67,6 +67,8 @@
#include <Xm/TextFP.h>
#include <Xm/PushBG.h>
#include <Xm/ToggleBG.h>
#include <Xm/RowColumn.h>
#include <X11/Xlib.h>
#include <Dt/IconFile.h>
#include <Dt/Icon.h>
#include <pwd.h>
@ -1069,7 +1071,7 @@ PostMenuCB( Widget w, XtPointer client_data, XtPointer call_data )
if (p->reason == XmCR_ARM &&
p->event->type == ButtonPress) {
XmMenuPosition(options_menu, p->event);
XmMenuPosition(options_menu, (XButtonPressedEvent *)p->event);
XtManageChild(options_menu);
}
}

View file

@ -94,6 +94,8 @@ from the X Consortium.
static char auth_name[256];
static int auth_name_len;
void GenerateAuthData(char *auth, int len); // genauth.c
void
XdmPrintDataHex(const char *s, const char *a, int l)
{

View file

@ -141,6 +141,16 @@ int WellKnownSocketsMax;
#define pS(s) ((s) ? ((char *) (s)) : "empty string")
/* choose.c */
int RememberIndirectClient(ARRAY8Ptr clientAddress, CARD16 connectionType);
void ForgetIndirectClient(ARRAY8Ptr clientAddress, CARD16 connectionType);
int IsIndirectClient(ARRAY8Ptr clientAddress, CARD16 connectionType);
ARRAY8Ptr IndirectChoice(ARRAY8Ptr clientAddress, CARD16 connectionType);
int ProcessChooserSocket(int fd);
void RunChooser(struct display *d);
void LoadDMResources(void); // resource.c
void
DestroyWellKnownSockets (void)
{