Update of /cvsroot/linux-decnet/dnprogs/apps
In directory usw-pr-cvs1:/tmp/cvs-serv20903/apps
Modified Files:
dnmount.c dnping.c sethost.c
Log Message:
Use cuserid rather than getlogin to get the username
Index: dnmount.c
===================================================================
RCS file: /cvsroot/linux-decnet/dnprogs/apps/dnmount.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** dnmount.c 2000/04/26 08:22:03 1.1.1.1
--- dnmount.c 2001/10/21 14:24:00 1.2
***************
*** 2,6 ****
/******************************************************************************
(c) 1995-1998 E.M. Serrat ems...@ge...
!
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 2,6 ----
/******************************************************************************
(c) 1995-1998 E.M. Serrat ems...@ge...
!
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 39,43 ****
#endif
#include <linux/dap_fs.h>
!
/* DECnet phase IV limits */
#define MAX_NODE 6
--- 39,43 ----
#endif
#include <linux/dap_fs.h>
!
/* DECnet phase IV limits */
#define MAX_NODE 6
***************
*** 81,85 ****
int i;
char *local_user;
!
state = NODE; /* Node is mandatory */
--- 81,85 ----
int i;
char *local_user;
!
state = NODE; /* Node is mandatory */
***************
*** 91,95 ****
if (fname[n0] != ':' && fname[n0] != '\"' && fname[n0] != '\'')
{
! if (n1 >= MAX_NODE ||
fname[n0] == ' ' || fname[n0] == '\n')
{
--- 91,95 ----
if (fname[n0] != ':' && fname[n0] != '\"' && fname[n0] != '\'')
{
! if (n1 >= MAX_NODE ||
fname[n0] == ' ' || fname[n0] == '\n')
{
***************
*** 214,218 ****
directory (node::[patrick]) is provided. Logical names must end with
a colon for this to happen or we will not be able to distinguish it
! from a filename
EMS: Changed wildcard to *.*;0 so we only get the last version of
--- 214,218 ----
directory (node::[patrick]) is provided. Logical names must end with
a colon for this to happen or we will not be able to distinguish it
! from a filename
EMS: Changed wildcard to *.*;0 so we only get the last version of
***************
*** 225,229 ****
// Try very hard to get the local username
! local_user = getlogin();
if (!local_user || local_user == (char *)0xffffffff)
local_user = getenv("LOGNAME");
--- 225,229 ----
// Try very hard to get the local username
! local_user = cuserid(NULL);
if (!local_user || local_user == (char *)0xffffffff)
local_user = getenv("LOGNAME");
***************
*** 252,256 ****
{
int sockfd;
! if ((sockfd=socket(AF_DECnet,SOCK_STREAM,DNPROTO_NSP)) == -1)
{
perror("socket");
--- 252,256 ----
{
int sockfd;
! if ((sockfd=socket(AF_DECnet,SOCK_STREAM,DNPROTO_NSP)) == -1)
{
perror("socket");
***************
*** 258,272 ****
}
!
if (setsockopt(sockfd,DNPROTO_NSP,SO_CONACCESS,&accessdata,
! sizeof(accessdata)) < 0)
{
perror("setsockopt");
exit(-1);
}
!
! if (connect(sockfd, (struct sockaddr *)&sockaddr,
! sizeof(sockaddr)) < 0)
{
perror("socket");
--- 258,272 ----
}
!
if (setsockopt(sockfd,DNPROTO_NSP,SO_CONACCESS,&accessdata,
! sizeof(accessdata)) < 0)
{
perror("setsockopt");
exit(-1);
}
!
! if (connect(sockfd, (struct sockaddr *)&sockaddr,
! sizeof(sockaddr)) < 0)
{
perror("socket");
***************
*** 295,309 ****
0x7C /* WildCrds/Ren/Seg Msgs */
};
!
if ((er=write(sockfd,confmsg,sizeof(confmsg))) < 0)
{
perror("Send DAP config msg");
exit(-1);
! }
if ((er=read(sockfd,buf,sizeof(buf))) < 0)
{
perror("Recv DAP config msg");
exit(-1);
! }
/* Assume that Peer Supports the minimal characteristis we
setup here
--- 295,309 ----
0x7C /* WildCrds/Ren/Seg Msgs */
};
!
if ((er=write(sockfd,confmsg,sizeof(confmsg))) < 0)
{
perror("Send DAP config msg");
exit(-1);
! }
if ((er=read(sockfd,buf,sizeof(buf))) < 0)
{
perror("Recv DAP config msg");
exit(-1);
! }
/* Assume that Peer Supports the minimal characteristis we
setup here
***************
*** 336,341 ****
mount_entry.mnt_freq = 0;
mount_entry.mnt_passno = 0;
-
if ( (MFD = open (MOUNTED "~", O_RDWR | O_CREAT | O_EXCL, 0600)) < 0)
--- 336,341 ----
mount_entry.mnt_freq = 0;
mount_entry.mnt_passno = 0;
+
if ( (MFD = open (MOUNTED "~", O_RDWR | O_CREAT | O_EXCL, 0600)) < 0)
***************
*** 343,347 ****
perror("opening /etc/mtab file");
exit(-1);
! }
close(MFD);
if ( (mtab = setmntent(MOUNTED, "a+")) == NULL)
--- 343,347 ----
perror("opening /etc/mtab file");
exit(-1);
! }
close(MFD);
if ( (mtab = setmntent(MOUNTED, "a+")) == NULL)
***************
*** 377,381 ****
struct group *grp;
char opt;
!
memset(&vms_directory,0,sizeof(vms_directory));
memset(&mount_point,0,sizeof(mount_point));
--- 377,381 ----
struct group *grp;
char opt;
!
memset(&vms_directory,0,sizeof(vms_directory));
memset(&mount_point,0,sizeof(mount_point));
***************
*** 449,453 ****
exit(2);
}
! if ( (getuid() != 0) && ((getuid() != st.st_uid) ||
((st.st_mode & S_IRWXU) != S_IRWXU)))
{
--- 449,453 ----
exit(2);
}
! if ( (getuid() != 0) && ((getuid() != st.st_uid) ||
((st.st_mode & S_IRWXU) != S_IRWXU)))
{
Index: dnping.c
===================================================================
RCS file: /cvsroot/linux-decnet/dnprogs/apps/dnping.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** dnping.c 2001/03/14 19:41:06 1.2
--- dnping.c 2001/10/21 14:24:00 1.3
***************
*** 3,7 ****
Username/Password additions by David G North 1999
Optarg additions by Rob Davies - Feb 2000
!
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- 3,7 ----
Username/Password additions by David G North 1999
Optarg additions by Rob Davies - Feb 2000
!
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
***************
*** 80,92 ****
! void init_accdata( char *user, char *password,
struct accessdata_dn *accessdata)
{
! char *local_user = getlogin();
char *cp;
if ((options & DNF_DEBUG) && (local_user))
{
! printf("getlogin() - LOCAL USER: %s\n",local_user);
}
--- 80,92 ----
! void init_accdata( char *user, char *password,
struct accessdata_dn *accessdata)
{
! char *local_user = cuserid(NULL);
char *cp;
if ((options & DNF_DEBUG) && (local_user))
{
! printf("cuserid() - LOCAL USER: %s\n",local_user);
}
***************
*** 98,102 ****
! /* If the password is "-" and fd 0 is a tty then
prompt for a password */
if (password[0] == '-' && password[1] == '\0' && isatty(0))
--- 98,102 ----
! /* If the password is "-" and fd 0 is a tty then
prompt for a password */
if (password[0] == '-' && password[1] == '\0' && isatty(0))
***************
*** 108,114 ****
return;
}
!
}
!
memcpy(accessdata->acc_pass, password, MIN(strlen(password),DN_MAXACCL));
accessdata->acc_pass[DN_MAXACCL-1] = '\0';
--- 108,114 ----
return;
}
!
}
!
memcpy(accessdata->acc_pass, password, MIN(strlen(password),DN_MAXACCL));
accessdata->acc_pass[DN_MAXACCL-1] = '\0';
***************
*** 122,130 ****
if ((options & DNF_DEBUG) && (local_user))
{
! printf("getenv(LOGNAME) - LOCAL USER: %s\n",local_user);
}
}
!
if (!local_user)
{
--- 122,130 ----
if ((options & DNF_DEBUG) && (local_user))
{
! printf("getenv(LOGNAME) - LOCAL USER: %s\n",local_user);
}
}
!
if (!local_user)
{
***************
*** 133,137 ****
if ((options & DNF_DEBUG) && (local_user))
{
! printf("getenv(USER) - LOCAL USER: %s\n",local_user);
}
--- 133,137 ----
if ((options & DNF_DEBUG) && (local_user))
{
! printf("getenv(USER) - LOCAL USER: %s\n",local_user);
}
***************
*** 140,144 ****
if (local_user)
{
! strncpy((char *)accessdata->acc_acc, local_user,
MIN(strlen(local_user),DN_MAXACCL));
accessdata->acc_acc[DN_MAXACCL-1] = '\0';
--- 140,144 ----
if (local_user)
{
! strncpy((char *)accessdata->acc_acc, local_user,
MIN(strlen(local_user),DN_MAXACCL));
accessdata->acc_acc[DN_MAXACCL-1] = '\0';
***************
*** 152,156 ****
if (options & DNF_DEBUG)
{
! printf("LOCAL USER: NULL\n");
}
--- 152,156 ----
if (options & DNF_DEBUG)
{
! printf("LOCAL USER: NULL\n");
}
***************
*** 188,192 ****
while ((ch = getopt(argc, argv, "c:di:qs:u:p:vt")) != EOF)
{
! switch(ch)
{
case 'c': /* number of packets to send */
--- 188,192 ----
while ((ch = getopt(argc, argv, "c:di:qs:u:p:vt")) != EOF)
{
! switch(ch)
{
case 'c': /* number of packets to send */
***************
*** 272,276 ****
}
! if ((sockfd=socket(AF_DECnet,SOCK_SEQPACKET,DNPROTO_NSP)) == -1)
{
if ( (options & DNF_QUIET) == 0 )
--- 272,276 ----
}
! if ((sockfd=socket(AF_DECnet,SOCK_SEQPACKET,DNPROTO_NSP)) == -1)
{
if ( (options & DNF_QUIET) == 0 )
***************
*** 281,285 ****
}
! if ((((options & DNF_USERNAME) == 0) && ((options & DNF_PASSWORD) != 0)) ||
(((options & DNF_USERNAME) != 0) && ((options & DNF_PASSWORD) == 0)))
{
--- 281,285 ----
}
! if ((((options & DNF_USERNAME) == 0) && ((options & DNF_PASSWORD) != 0)) ||
(((options & DNF_USERNAME) != 0) && ((options & DNF_PASSWORD) == 0)))
{
***************
*** 290,294 ****
exit(-1);
}
!
if ( ((options & (DNF_USERNAME|DNF_PASSWORD) ) == 0) && (argc > 2) )
{
--- 290,294 ----
exit(-1);
}
!
if ( ((options & (DNF_USERNAME|DNF_PASSWORD) ) == 0) && (argc > 2) )
{
***************
*** 305,309 ****
printf("USERNAME: %s\nPASSWORD: %s\n", username, password);
}
!
init_accdata(username, password, &accessdata);
if (setsockopt(sockfd, DNPROTO_NSP, SO_CONACCESS, &accessdata,
--- 305,309 ----
printf("USERNAME: %s\nPASSWORD: %s\n", username, password);
}
!
init_accdata(username, password, &accessdata);
if (setsockopt(sockfd, DNPROTO_NSP, SO_CONACCESS, &accessdata,
***************
*** 336,341 ****
memcpy(sockaddr.sdn_add.a_addr, np->n_addr,2);
! if (connect(sockfd, (struct sockaddr *)&sockaddr,
! sizeof(sockaddr)) < 0)
{
if ( (options & DNF_QUIET) == 0 )
--- 336,341 ----
memcpy(sockaddr.sdn_add.a_addr, np->n_addr,2);
! if (connect(sockfd, (struct sockaddr *)&sockaddr,
! sizeof(sockaddr)) < 0)
{
if ( (options & DNF_QUIET) == 0 )
***************
*** 352,356 ****
obuf[0]=0x00;
! cmplen = (datalen - 1) -
(options & DNF_TIMESTAMPS)?sizeof(struct timeval):0;
if (options & DNF_DEBUG)
--- 352,356 ----
obuf[0]=0x00;
! cmplen = (datalen - 1) -
(options & DNF_TIMESTAMPS)?sizeof(struct timeval):0;
if (options & DNF_DEBUG)
***************
*** 365,369 ****
}
! snd=0;
rcv=0;
--- 365,369 ----
}
! snd=0;
rcv=0;
***************
*** 383,387 ****
exit(-1);
}
! if (options & (DNF_DEBUG|DNF_VERBOSE))
{
printf("PKT: %-4d WRITE: %d ",i+1,num);
--- 383,387 ----
exit(-1);
}
! if (options & (DNF_DEBUG|DNF_VERBOSE))
{
printf("PKT: %-4d WRITE: %d ",i+1,num);
***************
*** 406,410 ****
}
! if (memcmp(&obuf[offset],&ibuf[offset],cmplen) != 0)
{
if ( (options & (DNF_QUIET|DNF_DEBUG|DNF_VERBOSE)) == 0 )
--- 406,410 ----
}
! if (memcmp(&obuf[offset],&ibuf[offset],cmplen) != 0)
{
if ( (options & (DNF_QUIET|DNF_DEBUG|DNF_VERBOSE)) == 0 )
Index: sethost.c
===================================================================
RCS file: /cvsroot/linux-decnet/dnprogs/apps/sethost.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** sethost.c 2001/06/19 10:49:18 1.3
--- sethost.c 2001/10/21 14:24:00 1.4
***************
*** 445,449 ****
// Try very hard to get the local username
! local_user = getlogin();
if (!local_user || local_user == (char *)0xffffffff)
local_user = getenv("LOGNAME");
--- 445,449 ----
// Try very hard to get the local username
! local_user = cuserid(NULL);
if (!local_user || local_user == (char *)0xffffffff)
local_user = getenv("LOGNAME");
|