From 10f699ef7001d4c74917484fe1864d43a0e51873 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 1 Mar 2001 14:59:11 +0000 Subject: [PATCH] Various patches to fix errors when using the newest glibc, replaced use of insecure tempnam() function and to remove warnings etc. --- avmb1/avmcapictrl.c | 11 ++++-- capi20/capi20.c | 11 ++++-- capi20/capidyn.c | 8 ++++- capi20/convert.c | 11 ++++-- capifax/data.c | 9 +++-- capifax/id.c | 9 +++-- eicon/eiconctrl.c | 27 ++++++++------ eurofile/src/eft/access.c | 3 +- eurofile/src/eft/eft_client.c | 9 ++--- eurofile/src/eft/eft_tmpfile.c | 26 +++++--------- eurofile/src/eft/fileheader.c | 9 ++--- eurofile/src/eft/tdu.c | 3 +- eurofile/src/eft/tdu_log.c | 3 +- eurofile/src/eftd/eftd.c | 6 ++-- eurofile/src/wuauth/divfunc.c | 1 + ipppd/main.c | 4 +-- isdnctrl/isdn_dwabclib.c | 14 +++++--- isdnctrl/isdnctrl.c | 9 +++-- isdnlog/tools/isdnrate.c | 9 +++-- vbox/src/libvbox.c | 3 +- vbox/src/vbox.c | 16 ++++----- vbox/src/vboxconvert.c | 64 ++++++++++------------------------ xisdnload/xisdnload.c | 7 ++-- 23 files changed, 146 insertions(+), 126 deletions(-) diff --git a/avmb1/avmcapictrl.c b/avmb1/avmcapictrl.c index 25220651..2f0f7360 100644 --- a/avmb1/avmcapictrl.c +++ b/avmb1/avmcapictrl.c @@ -1,11 +1,16 @@ /* - * $Id: avmcapictrl.c,v 1.15 2000/03/08 13:40:33 calle Exp $ + * $Id: avmcapictrl.c,v 1.16 2001/03/01 14:59:11 paul Exp $ * * AVM-B1-ISDN driver for Linux. (Control-Utility) * * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: avmcapictrl.c,v $ + * Revision 1.16 2001/03/01 14:59:11 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.15 2000/03/08 13:40:33 calle * check for /dev/isdn/capi20 if /dev/capi20 doesn't exist. * @@ -644,8 +649,8 @@ int main(int argc, char **argv) if (ac >= 5) { s = argv[arg_ofs + 1]; if (strlen(s) > sizeof(carddef.driver)) { - fprintf(stderr, "%s: driver name > %d\n", - cmd, sizeof(carddef.driver)); + fprintf(stderr, "%s: driver name > %lu\n", + cmd, (unsigned long)sizeof(carddef.driver)); exit(1); } strncpy(carddef.driver, s, sizeof(carddef.driver)); diff --git a/capi20/capi20.c b/capi20/capi20.c index 0f23abb9..165e3178 100644 --- a/capi20/capi20.c +++ b/capi20/capi20.c @@ -1,7 +1,12 @@ /* - * $Id: capi20.c,v 1.18 2000/11/12 16:06:41 kai Exp $ + * $Id: capi20.c,v 1.19 2001/03/01 14:59:11 paul Exp $ * * $Log: capi20.c,v $ + * Revision 1.19 2001/03/01 14:59:11 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.18 2000/11/12 16:06:41 kai * fix backwards compatibility in capi20 library, small other changes * @@ -284,7 +289,7 @@ capi20_put_message (unsigned ApplID, unsigned char *Msg) if (len >= 30) { /* 64Bit CAPI-extention */ u_int64_t data64; memcpy(&data64,Msg+22, sizeof(u_int64_t)); - if (data64 != 0) dataptr = (void *)data64; + if (data64 != 0) dataptr = (void *)(unsigned long)data64; else dataptr = Msg + len; /* Assume data after message */ } else { dataptr = Msg + len; /* Assume data after message */ @@ -292,7 +297,7 @@ capi20_put_message (unsigned ApplID, unsigned char *Msg) } else { u_int32_t data; memcpy(&data,Msg+12, sizeof(u_int32_t)); - if (data != 0) dataptr = (void *)data; + if (data != 0) dataptr = (void *)(unsigned long)data; else dataptr = Msg + len; /* Assume data after message */ } memcpy(sndbuf+len, dataptr, datalen); diff --git a/capi20/capidyn.c b/capi20/capidyn.c index 80cfe69e..db1af152 100644 --- a/capi20/capidyn.c +++ b/capi20/capidyn.c @@ -1,7 +1,12 @@ /* - * $Id: capidyn.c,v 1.1 2000/05/18 15:21:37 calle Exp $ + * $Id: capidyn.c,v 1.2 2001/03/01 14:59:11 paul Exp $ * * $Log: capidyn.c,v $ + * Revision 1.2 2001/03/01 14:59:11 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.1 2000/05/18 15:21:37 calle * static CAPI2.0 library that loads libcapi20.so dynamicly. * @@ -9,6 +14,7 @@ #include #include +#include #include "capi20.h" #include diff --git a/capi20/convert.c b/capi20/convert.c index bb5c0d2f..1c59e955 100644 --- a/capi20/convert.c +++ b/capi20/convert.c @@ -1,7 +1,12 @@ /* - * $Id: convert.c,v 1.10 2000/05/18 15:02:26 calle Exp $ + * $Id: convert.c,v 1.11 2001/03/01 14:59:11 paul Exp $ * * $Log: convert.c,v $ + * Revision 1.11 2001/03/01 14:59:11 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.10 2000/05/18 15:02:26 calle * Updated _cmsg handling added new functions need by "capiconn". * @@ -540,7 +545,7 @@ unsigned capi_cmsg2message(_cmsg * cmsg, _cbyte * msg) cmsg->Data64 = 0; } else { cmsg->Data32 = 0; - cmsg->Data64 = (_cqword) cmsg->Data; + cmsg->Data64 = (_cqword)(unsigned long)cmsg->Data; } } @@ -621,7 +626,7 @@ unsigned capi_message2cmsg(_cmsg * cmsg, _cbyte * msg) if (sizeof(void *) == 4) { cmsg->Data = (void *) cmsg->Data32; } else { - cmsg->Data = (void *) cmsg->Data64; + cmsg->Data = (void *)(unsigned long)cmsg->Data64; } } diff --git a/capifax/data.c b/capifax/data.c index c3ea6c02..4353b3ee 100644 --- a/capifax/data.c +++ b/capifax/data.c @@ -1,4 +1,4 @@ -/* $Id: data.c,v 1.2 1998/10/23 12:50:52 fritz Exp $ +/* $Id: data.c,v 1.3 2001/03/01 14:59:11 paul Exp $ * * Functions for dealing user data. * This stuff is based heavily on AVM's CAPI-adk for linux. @@ -15,6 +15,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: data.c,v $ + * Revision 1.3 2001/03/01 14:59:11 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.2 1998/10/23 12:50:52 fritz * Added RCS keywords and GPL notice. * @@ -41,7 +46,7 @@ unsigned SendData(ConnectionID Connection, void *Data, unsigned short DataLength assert (GetState(Connection) == Connected); DATA_B3_REQ_HEADER(&CMSG, Appl_Id, 0, GetConnectionNCCI(Connection)); - DATA_B3_REQ_DATA(&CMSG) = (unsigned long)Data; + DATA_B3_REQ_DATA(&CMSG) = Data; DATA_B3_REQ_DATALENGTH(&CMSG) = DataLength; DATA_B3_REQ_DATAHANDLE(&CMSG) = DataHandle; return CAPI_PUT_CMSG(&CMSG); diff --git a/capifax/id.c b/capifax/id.c index 1a8d3e68..c1ff3f45 100644 --- a/capifax/id.c +++ b/capifax/id.c @@ -1,4 +1,4 @@ -/* $Id: id.c,v 1.2 1998/10/23 12:50:55 fritz Exp $ +/* $Id: id.c,v 1.3 2001/03/01 14:59:11 paul Exp $ * * Connection-ID management. * This stuff is based heavily on AVM's CAPI-adk for linux. @@ -15,6 +15,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: id.c,v $ + * Revision 1.3 2001/03/01 14:59:11 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.2 1998/10/23 12:50:55 fritz * Added RCS keywords and GPL notice. * @@ -52,7 +57,7 @@ typedef struct _ConnectionDesc { unsigned char *CallingPartyNumberStruct; /* CAPI struct */ } ConnectionDesc; -static ConnectionDesc C[maxConnections] = {0}; +static ConnectionDesc C[maxConnections] = {{0}}; static unsigned char *EmptyStruct = (unsigned char *)"\0"; /* diff --git a/eicon/eiconctrl.c b/eicon/eiconctrl.c index 3002236f..94379b0b 100644 --- a/eicon/eiconctrl.c +++ b/eicon/eiconctrl.c @@ -1,4 +1,4 @@ -/* $Id: eiconctrl.c,v 1.21 2000/12/02 21:39:42 armin Exp $ +/* $Id: eiconctrl.c,v 1.22 2001/03/01 14:59:12 paul Exp $ * * Eicon-ISDN driver for Linux. (Control-Utility) * @@ -21,6 +21,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: eiconctrl.c,v $ + * Revision 1.22 2001/03/01 14:59:12 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.21 2000/12/02 21:39:42 armin * Update of load and log utility. * New firmware and NT mode for PRI card. @@ -284,12 +289,12 @@ t_dsp_combifile_directory_entry *display_combifile_details(char *details) download_count = file_header->download_count; directory_size = file_header->directory_size; - return_ptr = (t_dsp_combifile_directory_entry *) (unsigned int)file_header ; + return_ptr = (t_dsp_combifile_directory_entry *) (unsigned long)file_header ; offset += (file_header->header_size); offset += (file_header->combifile_description_size); - offset += (__u32)return_ptr; + offset += (__u32)(unsigned long)return_ptr; - return (t_dsp_combifile_directory_entry *)offset; + return (t_dsp_combifile_directory_entry *)(unsigned long)offset; } @@ -439,7 +444,7 @@ __u32 get_download(char *download_block, char *download_area) #endif addr = store_download(data, p_download_desc->excess_header_size, download_block); - p_download_desc->p_excess_header_data = (char *)addr; + p_download_desc->p_excess_header_data = (char *)(unsigned long)addr; data += ((p_download_desc->excess_header_size)); } p_download_desc->p_download_description = NULL; @@ -457,7 +462,7 @@ __u32 get_download(char *download_block, char *download_area) printf("\t%s\n", Text); } - p_download_desc->p_download_description = (char *)addr; + p_download_desc->p_download_description = (char *)(unsigned long)addr; data += ((file_header->download_description_size)); } p_download_desc->p_memory_block_table = NULL; @@ -468,7 +473,7 @@ __u32 get_download(char *download_block, char *download_area) #endif addr = store_download(data, file_header->memory_block_table_size, download_block); - p_download_desc->p_memory_block_table = (t_dsp_memory_block_desc *)addr; + p_download_desc->p_memory_block_table = (t_dsp_memory_block_desc *)(unsigned long)addr; data += ((file_header->memory_block_table_size)); } p_download_desc->p_segment_table = NULL; @@ -479,7 +484,7 @@ __u32 get_download(char *download_block, char *download_area) #endif addr = store_download(data, file_header->segment_table_size, download_block); - p_download_desc->p_segment_table = (t_dsp_segment_desc *)addr; + p_download_desc->p_segment_table = (t_dsp_segment_desc *)(unsigned long)addr; data += (file_header->segment_table_size); } p_download_desc->p_symbol_table = NULL; @@ -490,7 +495,7 @@ __u32 get_download(char *download_block, char *download_area) #endif addr = store_download(data, file_header->symbol_table_size, download_block); - p_download_desc->p_symbol_table = (t_dsp_symbol_desc *)addr; + p_download_desc->p_symbol_table = (t_dsp_symbol_desc *)(unsigned long)addr; data += (file_header->symbol_table_size); } p_download_desc->p_data_blocks_dm = NULL; @@ -501,7 +506,7 @@ __u32 get_download(char *download_block, char *download_area) #endif addr = store_download(data, file_header->total_data_size_dm, download_block); - p_download_desc->p_data_blocks_dm = (__u16 *)addr; + p_download_desc->p_data_blocks_dm = (__u16 *)(unsigned long)addr; data += (file_header->total_data_size_dm); } p_download_desc->p_data_blocks_pm = NULL; @@ -512,7 +517,7 @@ __u32 get_download(char *download_block, char *download_area) #endif addr = store_download(data, file_header->total_data_size_pm, download_block); - p_download_desc->p_data_blocks_pm = (__u16 *)addr; + p_download_desc->p_data_blocks_pm = (__u16 *)(unsigned long)addr; data += (file_header->total_data_size_pm); } } diff --git a/eurofile/src/eft/access.c b/eurofile/src/eft/access.c index 807c163e..66a37d0b 100644 --- a/eurofile/src/eft/access.c +++ b/eurofile/src/eft/access.c @@ -1,4 +1,4 @@ -/* $Id: access.c,v 1.3 1999/10/06 18:16:22 he Exp $ */ +/* $Id: access.c,v 1.4 2001/03/01 14:59:12 paul Exp $ */ /* Copyright 1997 by Henner Eisen This code is free software; you can redistribute it and/or @@ -16,6 +16,7 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include #include "tdu.h" diff --git a/eurofile/src/eft/eft_client.c b/eurofile/src/eft/eft_client.c index d302b50c..5118799e 100644 --- a/eurofile/src/eft/eft_client.c +++ b/eurofile/src/eft/eft_client.c @@ -1,4 +1,4 @@ -/* $Id: eft_client.c,v 1.2 1999/10/06 18:16:22 he Exp $ */ +/* $Id: eft_client.c,v 1.3 2001/03/01 14:59:12 paul Exp $ */ /* Copyright 1998 by Henner Eisen @@ -17,12 +17,13 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include +#include +#include #include +#include #include #include -#include -#include #include diff --git a/eurofile/src/eft/eft_tmpfile.c b/eurofile/src/eft/eft_tmpfile.c index 740dd341..3aaba064 100644 --- a/eurofile/src/eft/eft_tmpfile.c +++ b/eurofile/src/eft/eft_tmpfile.c @@ -1,4 +1,4 @@ -/* $Id: eft_tmpfile.c,v 1.1 1999/06/30 17:18:24 he Exp $ */ +/* $Id: eft_tmpfile.c,v 1.2 2001/03/01 14:59:12 paul Exp $ */ /* Copyright 1998 by Henner Eisen @@ -17,31 +17,25 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include - #include #include +#include +#include +#include #include #include "eft_private.h" #include -int eft_make_tmp() +int eft_make_tmp(void) { - char * tmp; + char tmp[sizeof("/tmp/eftXXXXXX\0")]; int fd; struct stat stat_ln, stat_fd; - tmp = tempnam("/tmp", "eft"); - if( ! tmp ){ - perror("eft_make_tmp:tmpnam"); - return -1; - } - if( (fd = open(tmp,O_RDWR|O_CREAT),0600) < 0 ){ - perror("eft_make_tmp:open"); - free(tmp); + strcpy(tmp, "/tmp/eftXXXXXX"); + if( (fd = mkstemp(tmp)) < 0 ){ + perror("eft_make_tmp:mkstemp"); return -1; } @@ -55,13 +49,11 @@ int eft_make_tmp() if( lstat(tmp, &stat_ln) || fstat(fd,&stat_fd) || memcmp(&stat_ln, &stat_fd, sizeof(stat_ln) )){ fprintf(stderr,"eft_make_tmp(): symlink attack for \"%s\" defended\n",tmp); - free(tmp); close(fd); return -1; } if( unlink(tmp) ) perror("unlink()"); - free(tmp); return fd; } diff --git a/eurofile/src/eft/fileheader.c b/eurofile/src/eft/fileheader.c index ba8becb0..64e5ac04 100644 --- a/eurofile/src/eft/fileheader.c +++ b/eurofile/src/eft/fileheader.c @@ -1,4 +1,4 @@ -/* $Id: fileheader.c,v 1.3 2000/01/26 20:11:34 he Exp $ */ +/* $Id: fileheader.c,v 1.4 2001/03/01 14:59:12 paul Exp $ */ /* Copyright 1998 by Henner Eisen @@ -25,11 +25,12 @@ This file containing stuff used for processing of file headers. */ -#include -#include -#include #include +#include #include +#include +#include +#include #include diff --git a/eurofile/src/eft/tdu.c b/eurofile/src/eft/tdu.c index 40cd0719..648e7b8c 100644 --- a/eurofile/src/eft/tdu.c +++ b/eurofile/src/eft/tdu.c @@ -1,4 +1,4 @@ -/* $Id: tdu.c,v 1.1 1999/06/30 17:18:40 he Exp $ */ +/* $Id: tdu.c,v 1.2 2001/03/01 14:59:12 paul Exp $ */ /* Copyright 1997 by Henner Eisen @@ -46,6 +46,7 @@ #include #include +#include #include "tdu_user.h" #include "tdu.h" #include "sbv.h" diff --git a/eurofile/src/eft/tdu_log.c b/eurofile/src/eft/tdu_log.c index 18131cfe..4a66a618 100644 --- a/eurofile/src/eft/tdu_log.c +++ b/eurofile/src/eft/tdu_log.c @@ -1,4 +1,4 @@ -/* $Id: tdu_log.c,v 1.1 1999/06/30 17:18:44 he Exp $ */ +/* $Id: tdu_log.c,v 1.2 2001/03/01 14:59:12 paul Exp $ */ /* Copyright 1997 by Henner Eisen @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/eurofile/src/eftd/eftd.c b/eurofile/src/eftd/eftd.c index 6f7e6387..76a883a4 100644 --- a/eurofile/src/eftd/eftd.c +++ b/eurofile/src/eftd/eftd.c @@ -1,4 +1,4 @@ -/* $Id: eftd.c,v 1.5 1999/10/08 16:25:36 he Exp $ */ +/* $Id: eftd.c,v 1.6 2001/03/01 14:59:13 paul Exp $ */ /* Copyright 1998 by Henner Eisen @@ -25,8 +25,9 @@ /* for strsignal() */ #define _GNU_SOURCE +#include #include -#include +#include #include #include #include @@ -51,7 +52,6 @@ #endif #include -#include #ifdef __USE_GNU /* Return a string describing the meaning of the signal number in SIG. */ diff --git a/eurofile/src/wuauth/divfunc.c b/eurofile/src/wuauth/divfunc.c index f8ae6526..cea944fb 100644 --- a/eurofile/src/wuauth/divfunc.c +++ b/eurofile/src/wuauth/divfunc.c @@ -32,6 +32,7 @@ #include #include +#include #include #ifdef SYSSYSLOG #include diff --git a/ipppd/main.c b/ipppd/main.c index 965dd049..d8282bae 100644 --- a/ipppd/main.c +++ b/ipppd/main.c @@ -25,7 +25,7 @@ * PATCHLEVEL 9 */ -char main_rcsid[] = "$Id: main.c,v 1.18 2000/07/25 20:23:51 kai Exp $"; +char main_rcsid[] = "$Id: main.c,v 1.19 2001/03/01 14:59:14 paul Exp $"; #include #include @@ -43,7 +43,7 @@ char main_rcsid[] = "$Id: main.c,v 1.18 2000/07/25 20:23:51 kai Exp $"; #include #include #include -#include +#include #include #include #include diff --git a/isdnctrl/isdn_dwabclib.c b/isdnctrl/isdn_dwabclib.c index 99d8e876..936f5c02 100644 --- a/isdnctrl/isdn_dwabclib.c +++ b/isdnctrl/isdn_dwabclib.c @@ -1,4 +1,4 @@ -/* $Id: isdn_dwabclib.c,v 1.1 1999/11/07 22:04:05 detabc Exp $ +/* $Id: isdn_dwabclib.c,v 1.2 2001/03/01 14:59:15 paul Exp $ * * * This program is free software; you can redistribute it and/or modify @@ -16,18 +16,24 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdn_dwabclib.c,v $ + * Revision 1.2 2001/03/01 14:59:15 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.1 1999/11/07 22:04:05 detabc * add dwabc-udpinfo-utilitys in isdnctrl * */ +#include +#include #include #include #include #include #include -#include #include #include #include @@ -91,7 +97,7 @@ err:; ms->sin_port = htons(20000+po); - if(!bind(sock,ms,sizeof(*ms))) + if(!bind(sock, (struct sockaddr *)ms, sizeof(*ms))) break; } @@ -106,7 +112,7 @@ err:; ms->sin_port = htons(25001); memcpy(&ms->sin_addr.s_addr,*(he->h_addr_list),he->h_length); - if(sendto(sock,buf,bytes,0,ms,sizeof(*ms)) != bytes) { + if(sendto(sock,buf,bytes,0,(struct sockaddr *)ms,sizeof(*ms)) != bytes) { sprintf(em,"sendto <%s> failt errno %d",dest,errno); goto err; diff --git a/isdnctrl/isdnctrl.c b/isdnctrl/isdnctrl.c index 31c31d6b..5578d789 100644 --- a/isdnctrl/isdnctrl.c +++ b/isdnctrl/isdnctrl.c @@ -1,4 +1,4 @@ -/* $Id: isdnctrl.c,v 1.44 2000/08/17 09:24:06 paul Exp $ +/* $Id: isdnctrl.c,v 1.45 2001/03/01 14:59:15 paul Exp $ * ISDN driver for Linux. (Control-Utility) * * Copyright 1994,95 by Fritz Elfert (fritz@isdn4linux.de) @@ -21,6 +21,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdnctrl.c,v $ + * Revision 1.45 2001/03/01 14:59:15 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.44 2000/08/17 09:24:06 paul * Added --version option to display (isdn4k-utils) version, * and fixed a compile warning on alpha. @@ -496,7 +501,7 @@ static void listbind(char *s, int e) int ch; sscanf(p + 1, "%d", &ch); *p = '\0'; - printf("%s, Channel %d%s\n", s, ch, (e > 0) ? ", exclusive" : ""); + printf("%s, channel %d%s\n", s, ch, (e > 0) ? ", exclusive" : ""); } else printf("Nothing\n"); } diff --git a/isdnlog/tools/isdnrate.c b/isdnlog/tools/isdnrate.c index 89b080e9..2d5b5ab3 100644 --- a/isdnlog/tools/isdnrate.c +++ b/isdnlog/tools/isdnrate.c @@ -1,4 +1,4 @@ -/* $Id: isdnrate.c,v 1.37 2000/07/17 16:34:23 akool Exp $ +/* $Id: isdnrate.c,v 1.38 2001/03/01 14:59:16 paul Exp $ * ISDN accounting for isdn4linux. (rate evaluation) * @@ -19,6 +19,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdnrate.c,v $ + * Revision 1.38 2001/03/01 14:59:16 paul + * Various patches to fix errors when using the newest glibc, + * replaced use of insecure tempnam() function + * and to remove warnings etc. + * * Revision 1.37 2000/07/17 16:34:23 akool * isdnlog-4.32 * - added new Prefixes 0160 (D1) and 0162 (D2) to "country-de.dat" @@ -1573,7 +1578,7 @@ static void setup_daemon() struct sockaddr_in client; fd_set active_fd_set, read_fd_set; char *sock_name = socket_file; - size_t size; + socklen_t size; struct stat stat_buf; int i; pid_t pid; diff --git a/vbox/src/libvbox.c b/vbox/src/libvbox.c index b9b7a636..9724c8ab 100644 --- a/vbox/src/libvbox.c +++ b/vbox/src/libvbox.c @@ -1,5 +1,5 @@ /* -** $Id: libvbox.c,v 1.11 1997/10/22 20:47:06 fritz Exp $ +** $Id: libvbox.c,v 1.12 2001/03/01 14:59:16 paul Exp $ ** ** Copyright (C) 1996, 1997 Michael 'Ghandi' Herold */ @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/vbox/src/vbox.c b/vbox/src/vbox.c index a8e2b120..5e130679 100644 --- a/vbox/src/vbox.c +++ b/vbox/src/vbox.c @@ -1,5 +1,5 @@ /* -** $Id: vbox.c,v 1.9 1998/12/31 09:57:27 paul Exp $ +** $Id: vbox.c,v 1.10 2001/03/01 14:59:16 paul Exp $ ** ** Copyright (C) 1996, 1997 Michael 'Ghandi' Herold */ @@ -1547,7 +1547,7 @@ static void draw_message_list(void) static void play_message(int msg) { struct messageline *msgline; - char *msgname; + char msgname[sizeof("/tmp/vboxXXXXXX\0")]; char *command; char *answer; int size; @@ -1557,19 +1557,15 @@ static void play_message(int msg) if ((!messagesmp) || (messagesnr < 1)) return; msgline = (struct messageline *)(messagesmp + (sizeof(struct messageline) * msg)); - msgname = tmpnam(NULL); - - if ((!msgline) || (!msgname)) + if (!msgline) { - message("\r\n", "Can't create temporary file! %s", "[RETURN]"); - + message("\r\n", "No message found! (can't happen?) %s", "[RETURN]"); return; } - - if ((fd = open(msgname, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR)) == -1) + strcpy(msgname, "/tmp/vboxXXXXXX"); + if ((fd = mkstemp(msgname)) == -1) { message("\r\n", "Can't open temporary file! %s", "[RETURN]"); - return; } diff --git a/vbox/src/vboxconvert.c b/vbox/src/vboxconvert.c index b9e8bb70..3ed2d395 100644 --- a/vbox/src/vboxconvert.c +++ b/vbox/src/vboxconvert.c @@ -1,5 +1,5 @@ /* -** $Id: vboxconvert.c,v 1.9 2000/09/15 09:08:37 paul Exp $ +** $Id: vboxconvert.c,v 1.10 2001/03/01 14:59:16 paul Exp $ ** ** Copyright (C) 1996, 1997 Michael 'Ghandi' Herold ** @@ -116,7 +116,7 @@ static struct option args_autovbox[] = static char *vbasename = NULL; static FILE *vboxtmpfile = NULL; -static char *vboxtmpname = NULL; +static char perrormsg[256]; /** Prototypes ***********************************************************/ @@ -347,7 +347,6 @@ static void start_vboxtoau(int samplemode, int samplerate) int compression; int result; - vboxtmpname = NULL; vboxtmpfile = NULL; signal(SIGINT , leave_vboxtoau); @@ -356,24 +355,17 @@ static void start_vboxtoau(int samplemode, int samplerate) signal(SIGHUP , leave_vboxtoau); signal(SIGPIPE, leave_vboxtoau); - if (!(vboxtmpname = tempnam("/tmp", "vbox"))) + if (!(vboxtmpfile = tmpfile())) { - fprintf(stderr, "%s: can't create a temporary file.\n", vbasename); - - leave_vboxtoau(255); - } - - if (!(vboxtmpfile = fopen(vboxtmpname, "w+"))) - { - fprintf(stderr, "%s: can't create \"%s\".\n", vbasename, vboxtmpname); - + sprintf(perrormsg, "%s: can't create tmpfile", vbasename); + perror(perrormsg); leave_vboxtoau(255); } if (fread(&header, sizeof(vaheader_t), 1, stdin) != 1) { - fprintf(stderr, "%s: can't read vbox audio header.\n", vbasename); - + sprintf(perrormsg, "%s: can't read vbox audio header", vbasename); + perror(perrormsg); leave_vboxtoau(255); } @@ -419,14 +411,8 @@ static void start_vboxtoau(int samplemode, int samplerate) static void leave_vboxtoau(int sig) { - if (vboxtmpfile) fclose(vboxtmpfile); - - if (vboxtmpname) - { - unlink(vboxtmpname); - free(vboxtmpname); - } - + if (vboxtmpfile) + fclose(vboxtmpfile); exit(sig); } @@ -507,7 +493,6 @@ static void start_autovbox(int compression, char *name, char *id, char *phone, c vaheader_t header; int result; - vboxtmpname = NULL; vboxtmpfile = NULL; signal(SIGINT , leave_autovbox); @@ -516,17 +501,10 @@ static void start_autovbox(int compression, char *name, char *id, char *phone, c signal(SIGHUP , leave_autovbox); signal(SIGPIPE, leave_autovbox); - if (!(vboxtmpname = tempnam("/tmp", "vbox"))) + if (!(vboxtmpfile = tmpfile())) { - fprintf(stderr, "%s: can't create a temporary file.\n", vbasename); - - leave_autovbox(255); - } - - if (!(vboxtmpfile = fopen(vboxtmpname, "w+"))) - { - fprintf(stderr, "%s: can't create \"%s\".\n", vbasename, vboxtmpname); - + sprintf(perrormsg, "%s: can't create tmpfile", vbasename); + perror(perrormsg); leave_autovbox(255); } @@ -580,14 +558,8 @@ static void start_autovbox(int compression, char *name, char *id, char *phone, c static void leave_autovbox(int sig) { - if (vboxtmpfile) fclose(vboxtmpfile); - - if (vboxtmpname) - { - unlink(vboxtmpname); - free(vboxtmpname); - } - + if (vboxtmpfile) + fclose(vboxtmpfile); exit(sig); } @@ -832,13 +804,13 @@ static int convert_pvf_to_au(int mode, int rate, FILE *in, FILE *out) Snd.channelCount = 1; Snd.info[0] = 0; - write_one_word((int)Snd.magic , out); + write_one_word((int)Snd.magic, out); write_one_word((int)Snd.dataLocation, out); - write_one_word((int)Snd.dataSize , out); - write_one_word((int)Snd.dataFormat , out); + write_one_word((int)Snd.dataSize, out); + write_one_word((int)Snd.dataFormat, out); write_one_word((int)Snd.samplingRate, out); write_one_word((int)Snd.channelCount, out); - write_one_word((int)Snd.info , out); + write_one_word(*((int *)Snd.info), out); while (1) { diff --git a/xisdnload/xisdnload.c b/xisdnload/xisdnload.c index e2233e98..fae30773 100644 --- a/xisdnload/xisdnload.c +++ b/xisdnload/xisdnload.c @@ -34,13 +34,14 @@ from the X Consortium. * */ +#include +#include +#include #include #include #include -#include -#include #include -#include +#include #include #include