mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-01 00:54:24 +03:00
* ftpfs.c: Replace bzero and bcopy with memset and memcpy.
* mcfs.c: Likewise. * mcserv.c: Likewise. * smbfs.c: Likewise. * tar.c: Likewise.
This commit is contained in:
parent
7db8a05550
commit
7978b33a9d
@ -1,3 +1,11 @@
|
|||||||
|
2002-07-15 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* ftpfs.c: Replace bzero and bcopy with memset and memcpy.
|
||||||
|
* mcfs.c: Likewise.
|
||||||
|
* mcserv.c: Likewise.
|
||||||
|
* smbfs.c: Likewise.
|
||||||
|
* tar.c: Likewise.
|
||||||
|
|
||||||
2002-07-14 Pavel Roskin <proski@gnu.org>
|
2002-07-14 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* fish.c (open_archive_int): Don't combine "export" and
|
* fish.c (open_archive_int): Don't combine "export" and
|
||||||
|
14
vfs/ftpfs.c
14
vfs/ftpfs.c
@ -560,17 +560,17 @@ setup_source_route (int socket, int dest)
|
|||||||
|
|
||||||
if (!source_route)
|
if (!source_route)
|
||||||
return;
|
return;
|
||||||
bzero (buffer, sizeof (buffer));
|
memset (buffer, 0, sizeof (buffer));
|
||||||
*ptr++ = IPOPT_LSRR;
|
*ptr++ = IPOPT_LSRR;
|
||||||
*ptr++ = 3 + 8;
|
*ptr++ = 3 + 8;
|
||||||
*ptr++ = 4; /* pointer */
|
*ptr++ = 4; /* pointer */
|
||||||
|
|
||||||
/* First hop */
|
/* First hop */
|
||||||
bcopy ((char *) &source_route, ptr, sizeof (int));
|
memcpy (ptr, (char *) &source_route, sizeof (int));
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
|
|
||||||
/* Second hop (ie, final destination) */
|
/* Second hop (ie, final destination) */
|
||||||
bcopy ((char *) &dest, ptr, sizeof (int));
|
memcpy (ptr, (char *) &dest, sizeof (int));
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
while ((ptr - buffer) & 3)
|
while ((ptr - buffer) & 3)
|
||||||
ptr++;
|
ptr++;
|
||||||
@ -715,7 +715,7 @@ ftpfs_open_socket (vfs *me, vfs_s_super *super)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get host address */
|
/* Get host address */
|
||||||
bzero ((char *) &server_address, sizeof (server_address));
|
memset ((char *) &server_address, 0, sizeof (server_address));
|
||||||
server_address.sin_family = AF_INET;
|
server_address.sin_family = AF_INET;
|
||||||
server_address.sin_addr.s_addr = inet_addr (host);
|
server_address.sin_addr.s_addr = inet_addr (host);
|
||||||
if (server_address.sin_addr.s_addr != -1)
|
if (server_address.sin_addr.s_addr != -1)
|
||||||
@ -732,7 +732,7 @@ ftpfs_open_socket (vfs *me, vfs_s_super *super)
|
|||||||
server_address.sin_family = hp->h_addrtype;
|
server_address.sin_family = hp->h_addrtype;
|
||||||
|
|
||||||
/* We copy only 4 bytes, we can not trust hp->h_length, as it comes from the DNS */
|
/* We copy only 4 bytes, we can not trust hp->h_length, as it comes from the DNS */
|
||||||
bcopy ((char *) hp->h_addr, (char *) &server_address.sin_addr, 4);
|
memcpy ((char *) &server_address.sin_addr, (char *) hp->h_addr, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
server_address.sin_port = htons (port);
|
server_address.sin_port = htons (port);
|
||||||
@ -951,8 +951,8 @@ setup_passive (vfs *me, vfs_s_super *super, int my_socket, struct sockaddr_in *s
|
|||||||
n [4] = (unsigned char) xe;
|
n [4] = (unsigned char) xe;
|
||||||
n [5] = (unsigned char) xf;
|
n [5] = (unsigned char) xf;
|
||||||
|
|
||||||
bcopy ((void *)n, &(sa->sin_addr.s_addr), 4);
|
memcpy (&(sa->sin_addr.s_addr), (void *)n, 4);
|
||||||
bcopy ((void *)&n[4], &(sa->sin_port), 2);
|
memcpy (&(sa->sin_port), (void *)&n[4], 2);
|
||||||
setup_source_route (my_socket, sa->sin_addr.s_addr);
|
setup_source_route (my_socket, sa->sin_addr.s_addr);
|
||||||
if (connect (my_socket, (struct sockaddr *) sa, sizeof (struct sockaddr_in)) < 0)
|
if (connect (my_socket, (struct sockaddr *) sa, sizeof (struct sockaddr_in)) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
10
vfs/mcfs.c
10
vfs/mcfs.c
@ -218,20 +218,20 @@ open_tcp_link (char *host, int *port, int *version, char *caller)
|
|||||||
if (!*host)
|
if (!*host)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bzero ((char *) &server_address, sizeof (server_address));
|
memset ((char *) &server_address, 0, sizeof (server_address));
|
||||||
server_address.sin_family = AF_INET;
|
server_address.sin_family = AF_INET;
|
||||||
|
|
||||||
/* Try to use the dotted decimal number */
|
/* Try to use the dotted decimal number */
|
||||||
if ((inaddr = inet_addr (host)) != -1)
|
if ((inaddr = inet_addr (host)) != -1)
|
||||||
bcopy ((char *) &inaddr, (char *) &server_address.sin_addr,
|
memcpy ((char *) &server_address.sin_addr, (char *) &inaddr,
|
||||||
sizeof (inaddr));
|
sizeof (inaddr));
|
||||||
else {
|
else {
|
||||||
if ((hp = gethostbyname (host)) == NULL){
|
if ((hp = gethostbyname (host)) == NULL){
|
||||||
message_2s (1, caller, _(" Cannot locate hostname: %s "), host);
|
message_2s (1, caller, _(" Cannot locate hostname: %s "), host);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
bcopy ((char *) hp->h_addr, (char *) &server_address.sin_addr,
|
memcpy ((char *) &server_address.sin_addr, (char *) hp->h_addr,
|
||||||
hp->h_length);
|
hp->h_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to contact a remote portmapper to obtain the listening port */
|
/* Try to contact a remote portmapper to obtain the listening port */
|
||||||
|
@ -776,7 +776,7 @@ static int do_ftp_auth (char *username, char *password)
|
|||||||
int my_socket;
|
int my_socket;
|
||||||
char answer [4];
|
char answer [4];
|
||||||
|
|
||||||
bzero ((char *) &local_address, sizeof (local_address));
|
memset ((char *) &local_address, 0, sizeof (local_address));
|
||||||
|
|
||||||
local_address.sin_family = AF_INET;
|
local_address.sin_family = AF_INET;
|
||||||
/* FIXME: extract the ftp port with the proper function */
|
/* FIXME: extract the ftp port with the proper function */
|
||||||
@ -784,8 +784,8 @@ static int do_ftp_auth (char *username, char *password)
|
|||||||
|
|
||||||
/* Convert localhost to usable format */
|
/* Convert localhost to usable format */
|
||||||
if ((inaddr = inet_addr ("127.0.0.1")) != -1)
|
if ((inaddr = inet_addr ("127.0.0.1")) != -1)
|
||||||
bcopy ((char *) &inaddr, (char *) &local_address.sin_addr,
|
memcpy ((char *) &local_address.sin_addr, (char *) &inaddr,
|
||||||
sizeof (inaddr));
|
sizeof (inaddr));
|
||||||
|
|
||||||
if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0){
|
if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0){
|
||||||
if (!isDaemon) fprintf (stderr, "do_auth: can't create socket\n");
|
if (!isDaemon) fprintf (stderr, "do_auth: can't create socket\n");
|
||||||
@ -1126,7 +1126,7 @@ static char *get_client (int portnum)
|
|||||||
if (hp == 0)
|
if (hp == 0)
|
||||||
return "hp = 0!";
|
return "hp = 0!";
|
||||||
|
|
||||||
bzero ((char *) &server_address, sizeof (server_address));
|
memset ((char *) &server_address, 0, sizeof (server_address));
|
||||||
server_address.sin_family = hp->h_addrtype;
|
server_address.sin_family = hp->h_addrtype;
|
||||||
server_address.sin_addr.s_addr = htonl (INADDR_ANY);
|
server_address.sin_addr.s_addr = htonl (INADDR_ANY);
|
||||||
server_address.sin_port = htons (portnum);
|
server_address.sin_port = htons (portnum);
|
||||||
|
@ -982,7 +982,7 @@ free_bucket (smbfs_connection *bucket)
|
|||||||
g_free (bucket->user);
|
g_free (bucket->user);
|
||||||
wipe_password (bucket->password);
|
wipe_password (bucket->password);
|
||||||
if (bucket->home) g_free (bucket->home);
|
if (bucket->home) g_free (bucket->home);
|
||||||
bzero (bucket, sizeof (smbfs_connection));
|
memset (bucket, 0, sizeof (smbfs_connection));
|
||||||
}
|
}
|
||||||
|
|
||||||
static smbfs_connection *
|
static smbfs_connection *
|
||||||
@ -1380,7 +1380,7 @@ get_stat_info (smbfs_connection *sc, char *path, struct stat *buf)
|
|||||||
if ((p = strrchr(mydir, '/')))
|
if ((p = strrchr(mydir, '/')))
|
||||||
mydir = p + 1; /* advance util last '/' */
|
mydir = p + 1; /* advance util last '/' */
|
||||||
if (strcmp(mydir, mypath) == 0) { /* fake a stat for ".." */
|
if (strcmp(mydir, mypath) == 0) { /* fake a stat for ".." */
|
||||||
bzero(buf, sizeof(struct stat));
|
memset(buf, 0, sizeof(struct stat));
|
||||||
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
|
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
|
||||||
memcpy(&single_entry->my_stat, buf, sizeof(struct stat));
|
memcpy(&single_entry->my_stat, buf, sizeof(struct stat));
|
||||||
g_free(mdp);
|
g_free(mdp);
|
||||||
@ -1400,7 +1400,7 @@ get_stat_info (smbfs_connection *sc, char *path, struct stat *buf)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strcmp(mypath, dnp) == 0) {
|
if (strcmp(mypath, dnp) == 0) {
|
||||||
bzero(buf, sizeof(struct stat));
|
memset(buf, 0, sizeof(struct stat));
|
||||||
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
|
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
|
||||||
memcpy(&single_entry->my_stat, buf, sizeof(struct stat));
|
memcpy(&single_entry->my_stat, buf, sizeof(struct stat));
|
||||||
DEBUG(1, (" CURRENT:found in %s\n", current_info->dirname));
|
DEBUG(1, (" CURRENT:found in %s\n", current_info->dirname));
|
||||||
@ -1522,7 +1522,7 @@ smbfs_stat (vfs *me, char *path, struct stat *buf)
|
|||||||
if (strcmp(sp, pp) == 0) {
|
if (strcmp(sp, pp) == 0) {
|
||||||
/* make server name appear as directory */
|
/* make server name appear as directory */
|
||||||
DEBUG(1, ("smbfs_stat: showing server as directory\n"));
|
DEBUG(1, ("smbfs_stat: showing server as directory\n"));
|
||||||
bzero(buf, sizeof(struct stat));
|
memset(buf, 0, sizeof(struct stat));
|
||||||
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
|
buf->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user