rpms/kismet/devel kismet-2005-08-R1-jobcontrol.patch, NONE, 1.1 kismet-2006-04-R1-alias.patch, NONE, 1.1 kismet-2006-04-R1-alias1.patch, NONE, 1.1 kismet-2006-04-R1-noret.patch, NONE, 1.1 kismet-2006-04-R1-packed.patch, NONE, 1.1 kismet-2006-04-R1-ssize.patch, NONE, 1.1 kismet-2006-04-R1-strop.patch, NONE, 1.1 kismet-2006-04-R1-uninit.patch, NONE, 1.1 kismet-2006-04-R1.tar.gz.asc, NONE, 1.1 kismet.spec, NONE, 1.1 sysconfig.kismet, NONE, 1.1 tmpwatch.kismet, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Enrico Scholz (ensc) fedora-extras-commits at redhat.com
Sat Apr 29 16:31:29 UTC 2006


Author: ensc

Update of /cvs/extras/rpms/kismet/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10145/devel

Modified Files:
	.cvsignore sources 
Added Files:
	kismet-2005-08-R1-jobcontrol.patch 
	kismet-2006-04-R1-alias.patch kismet-2006-04-R1-alias1.patch 
	kismet-2006-04-R1-noret.patch kismet-2006-04-R1-packed.patch 
	kismet-2006-04-R1-ssize.patch kismet-2006-04-R1-strop.patch 
	kismet-2006-04-R1-uninit.patch kismet-2006-04-R1.tar.gz.asc 
	kismet.spec sysconfig.kismet tmpwatch.kismet 
Log Message:
auto-import kismet-0.0.2006.04.R1-2 on branch devel from kismet-0.0.2006.04.R1-2.src.rpm

kismet-2005-08-R1-jobcontrol.patch:

--- NEW FILE kismet-2005-08-R1-jobcontrol.patch ---
2006-03-18  Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

	- scripts/kismet.in: disable jobcontrol which simply does
	  not work: when starting the server with 'kismet_server
	  ... &', write operations will result into a SIGTTOU
	  causing malfunctions. So, it is better not to use job
	  control which seems to be required for specifying the
	  last job only. A plain 'wait' will suffice there.

--- kismet-2005-08-R1/scripts/kismet.in.jobcontrol	2005-08-16 03:22:38.000000000 +0200
+++ kismet-2005-08-R1/scripts/kismet.in	2006-03-18 11:52:24.000000000 +0100
@@ -7,8 +7,6 @@
 
 GREP_OPTIONS=""
 
-set -m
-
 gui=`grep -e "^gui=" ${ETC}/kismet_ui.conf | cut -d= -f2 | tr -d " \t"`
 piddir=`grep -e "^piddir=" ${ETC}/kismet.conf | cut -d= -f2 | tr -d " \t"`
 
@@ -74,7 +72,7 @@
 if test "$?" != "5"; then
 	echo "Killing server..."
 	kill $servpid
-	wait %-
+	wait
 fi
 
 echo "Kismet exited."

kismet-2006-04-R1-alias.patch:

--- NEW FILE kismet-2006-04-R1-alias.patch ---
2006-04-22  Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

	* expat.cc, tcpclient.cc, gpsmap.cc, packetracker.cc:

	  avoid constructs like

	  | sscanf(..., "%u", (int *)&some_var);

	  where 'some_var' is not an 'int'. Depending on the platform,
	  this might caused unwanted effects (e.g. assigning a 64-bit
	  'int' to a 32-bit 'enum'; writing to unaligned addresses
	  causing kernel traps)

	  Some time-handling related hunks should be reworked before
	  2038 ;)


--- kismet-2006-04-R1/expat.cc.alias	2005-03-23 17:36:56.000000000 +0100
+++ kismet-2006-04-R1/expat.cc	2006-04-22 18:22:02.000000000 +0200
@@ -192,12 +192,14 @@ int NetXmlStr2Struct(wireless_network *i
         return -1;
     }
 
-    if (sscanf(xmlstrnodes[net_node_wn_maxrate].c_str(), "%f", (float *) &in_net->maxrate) < 1) {
+    float	tmpmaxrate;
+    if (sscanf(xmlstrnodes[net_node_wn_maxrate].c_str(), "%f", &tmpmaxrate) < 1) {
         if (verbose)
             fprintf(stderr, "WARNING:  Illegal maxrate '%s', skipping rest of network.\n",
                     xmlstrnodes[net_node_wn_maxrate].c_str());
         return -1;
     }
+    in_net->maxrate = tmpmaxrate;
 
     if (sscanf(xmlstrnodes[net_node_pk_LLC].c_str(), "%d", &in_net->llc_packets) < 1) {
         if (verbose)
--- kismet-2006-04-R1/tcpclient.cc.alias	2005-10-17 15:52:47.000000000 +0200
+++ kismet-2006-04-R1/tcpclient.cc	2006-04-22 18:22:02.000000000 +0200
@@ -277,6 +277,8 @@ int TcpClient::ParseData(char *in_data) 
     char bssid_str[18];
     mac_addr bssid;
     int junkmajor, junkminor, junktiny;
+#warning FIXME: implement reading of time_t types 
+    int		tmptime;	// HACK: should be some 64-bit type
 
     if (sscanf(in_data, "%64[^:]", header) < 1) {
         return 0;
@@ -294,14 +295,15 @@ int TcpClient::ParseData(char *in_data) 
         if (sscanf(in_data+hdrlen, "%d.%d.%d %d \001%32[^\001]\001 %24s %d "
                    "%24[^.].%24[^.].%24s",
                    &junkmajor, &junkminor, &junktiny, 
-                   (int *) &start_time, servername, 
+                   &tmptime, servername, 
                    build, &channel_hop,
                    major, minor, tiny) < 7)
             return 0;
+	start_time = tmptime;
     } else if (!strncmp(header, "*TIME", 64)) {
-        if (sscanf(in_data+hdrlen, "%d", (int *) &serv_time) < 1)
+        if (sscanf(in_data+hdrlen, "%d", &tmptime) < 1)
             return 0;
-
+	serv_time = tmptime;
     } else if (!strncmp(header, "*NETWORK", 64)) {
         wireless_network *net;
 
@@ -393,17 +395,23 @@ int TcpClient::ParseData(char *in_data) 
             newnet = 1;
         }
 
+	{
+	int		tmptype, tmpatype;
+	int		tmpturbocell_mode;
+#warning FIXME: implement reading of time_t types 
+	int		tmpfirst_time;	// HACK: should be some 64-bit type
+	int		tmplast_time;	// HACK: should be some 64-bit type
         scanned = sscanf(in_data+hdrlen+18, "%d \001%255[^\001]\001 "
 						 "\001%255[^\001]\001 "
                          "%d %d %d %d %d %d %d %d %d %hd.%hd.%hd.%hd "
                          "%d %f %f %f %f %f %f %f %f %d %d %d %f %d %d %d %d %d %d "
 						 "%f %f %f %lf %lf %lf %ld %ld"
                          "%d %d %d %d %d %d %d %d %lld",
-                         (int *) &type, ssid, beaconstr,
+                         &tmptype, ssid, beaconstr,
                          &llc_packets, &data_packets, &crypt_packets, 
                          &interesting_packets, &channel, &crypt_set, 
-                         (int *) &first_time, (int *) &last_time,
-                         (int *) &atype, &range[0], &range[1], &range[2], 
+                         &tmpfirst_time, &tmplast_time,
+                         &tmpatype, &range[0], &range[1], &range[2], 
                          &range[3], &gps_fixed, &min_lat, &min_lon, 
                          &min_alt, &min_spd, &max_lat, &max_lon, 
                          &max_alt, &max_spd, &octets, 
@@ -413,10 +420,16 @@ int TcpClient::ParseData(char *in_data) 
                          &best_lat, &best_lon, &best_alt,
                          &aggregate_lat, &aggregate_lon, &aggregate_alt,
                          &aggregate_points, &datasize,
-                         &turbocell_nid, (int *) &turbocell_mode, 
+                         &turbocell_nid, &tmpturbocell_mode, 
                          &turbocell_sat, &carrier_set, &maxseenrate, 
                          &encoding_set, &decrypted, &dupeiv_packets, &bss_timestamp);
-
+	type           = static_cast<wireless_network_type>(tmptype);
+	first_time     = tmpfirst_time;
+	last_time      = tmplast_time;
+	atype          = static_cast<address_type>(tmpatype);
+	turbocell_mode = static_cast<turbocell_type>(tmpturbocell_mode);
+	}
+	
         if (scanned < 51) {
             // fprintf(stderr, "Flubbed network, discarding... %s  '%s'\n", bssid_str, in_data);
 			// Can't delete us out of the tracker offhand if we're not a new network,
@@ -562,12 +575,17 @@ int TcpClient::ParseData(char *in_data) 
             return 0;
         }
 
+	{
+	int		tmptype, tmpatype;
+#warning FIXME: implement reading of time_t types 
+	int		tmpfirst_time;	// HACK: should be some 64-bit type
+	int		tmplast_time;	// HACK: should be some 64-bit type
         scanned = sscanf(in_data+hdrlen+36, "%d %d %d %d %d %d %d "
                          "%f %f %f %f %f %f %f %f %lf %lf "
                          "%lf %ld %f %d %d %d %d %d %d "
                          "%f %f %f %d %hd.%hd.%hd.%hd %ld %d %d %d %d",
-                         (int *) &type,
-                         (int *) &first_time, (int *) &last_time,
+                         &tmptype,
+                         &tmpfirst_time, &tmplast_time,
                          &data_packets, &crypt_packets,
                          &interesting_packets,
                          &gps_fixed, &min_lat, &min_lon,
@@ -580,9 +597,14 @@ int TcpClient::ParseData(char *in_data) 
                          &best_quality, &best_signal, 
 						 &best_noise,
                          &best_lat, &best_lon, &best_alt,
-                         (int *) &atype, &ip[0], &ip[1], &ip[2], &ip[3],
+                         &tmpatype, &ip[0], &ip[1], &ip[2], &ip[3],
                          &datasize, &maxseenrate, &encoding_set,
                          &decrypted, &crypt_set);
+	type       = static_cast<client_type>(tmptype);
+	first_time = tmpfirst_time;
+	last_time  = tmplast_time;
+	atype      = static_cast<address_type>(tmpatype);
+	}
 
         if (scanned < 39) {
             if (nclient)
@@ -767,20 +789,31 @@ int TcpClient::ParseData(char *in_data) 
         short int sip[4], dip[4];
         int sport, dport;
 
+	{
+	int	tmptype, tmpsubtype, tmptvsec;
+	int	tmpproto_type, tmpsport, tmpdport, tmpproto_nbtype;  
         if (sscanf(in_data+hdrlen, "%d %d %d %d %d %d %17s %17s %17s "
                    "\001%32[^\001]\001 %d %hd.%hd.%hd.%hd %hd.%hd.%hd.%hd %d %d %d "
                    "\001%16[^\001]\001\n",
-                   (int *) &packinfo.type,
-                   (int *) &packinfo.subtype,
-                   (int *) &packinfo.ts.tv_sec,
+                   &tmptype,
+                   &tmpsubtype,
+                   &tmptvsec,
                    &packinfo.encrypted, &packinfo.interesting, &packinfo.beacon,
                    smac, dmac, bmac,
                    packinfo.ssid,
-                   (int *) &packinfo.proto.type,
+		   &tmpproto_type,
                    &sip[0], &sip[1], &sip[2], &sip[3], &dip[0], &dip[1], &dip[2], &dip[3],
-                   (int *) &sport, (int *) &dport,
-                   (int *) &packinfo.proto.nbtype, packinfo.proto.netbios_source) < 22)
+                   &tmpsport, &tmpdport,
+                   &tmpproto_nbtype, packinfo.proto.netbios_source) < 22)
             return 0;
+	packinfo.type       = static_cast<packet_type>(tmptype);
+	packinfo.subtype    = static_cast<packet_sub_type>(tmpsubtype);
+	packinfo.ts.tv_sec  = tmptvsec;
+	packinfo.proto.type = static_cast<protocol_info_type>(tmpproto_type);
+	sport               = tmpsport;
+	dport               = tmpdport;
+	packinfo.proto.nbtype = static_cast<protocol_netbios_type>(tmpproto_nbtype);
+	}
 
         packinfo.source_mac = smac;
         packinfo.dest_mac = dmac;
--- kismet-2006-04-R1/gpsmap.cc.alias	2006-04-22 18:22:02.000000000 +0200
+++ kismet-2006-04-R1/gpsmap.cc	2006-04-22 18:22:03.000000000 +0200
@@ -2212,7 +2212,9 @@ void DrawNetPower(vector<gps_network *> 
     // Now wait for the threads to complete and come back
     int thread_status;
     for (int t = 0; t < numthreads; t++) {
-        pthread_join(mapthread[t], (void **) &thread_status);
+        void *tmp;
+        pthread_join(mapthread[t], &tmp);
+	thread_status = reinterpret_cast<int>(tmp);
     }
 #else
     // Run one instance of our "thread".  thread number 0, it should just crunch it all
--- kismet-2006-04-R1/packetracker.cc.alias	2006-04-22 18:22:02.000000000 +0200
+++ kismet-2006-04-R1/packetracker.cc	2006-04-22 18:22:03.000000000 +0200
@@ -2350,6 +2350,7 @@ void Packetracker::ReadIPMap(FILE *in_fi
         memset(&dat, 0, sizeof(net_ip_data));
 
         short int range[4];
+	int		tmpatype;
         /*
          , mask[4], gate[4];
          */
@@ -2357,10 +2358,11 @@ void Packetracker::ReadIPMap(FILE *in_fi
         // Fetch the line and continue if we're invalid...
         if (sscanf(dline, "%17s %d %d %hd %hd %hd %hd",
                    bssid_str,
-                   (int *) &dat.atype, &dat.octets,
+                   &tmpatype, &dat.octets,
                    &range[0], &range[1], &range[2], &range[3]
                   ) < 7)
             continue;
+	dat.atype = static_cast<address_type>(tmpatype);
 
         for (int x = 0; x < 4; x++) {
             dat.range_ip[x] = (uint8_t) range[x];

kismet-2006-04-R1-alias1.patch:

--- NEW FILE kismet-2006-04-R1-alias1.patch ---
2006-04-29  Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

	* gpsmap.cc: fixed compilation errors on 64-bit platforms
	  which were created by my previous -alias patch. This patch
	  and the problems were reported by Hans de Goede at

	  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=165314#c24

	  The value_ptr argument was ommited completely in the
	  pthread_join() call because the result will not be used
	  at all.

	  Alternatively,

	  | thread_status = reinterpret_cast<long>(tmp);

	  instead of

	  | thread_status = reinterpret_cast<int>(tmp);

	  should be possible.


diff --git a/gpsmap.cc b/gpsmap.cc
index 1ce771b..915a482 100644
--- a/gpsmap.cc
+++ b/gpsmap.cc
@@ -2210,11 +2210,8 @@ #ifdef HAVE_PTHREAD
     pthread_attr_destroy(&attr);
 
     // Now wait for the threads to complete and come back
-    int thread_status;
     for (int t = 0; t < numthreads; t++) {
-        void *tmp;
-        pthread_join(mapthread[t], &tmp);
-	thread_status = reinterpret_cast<int>(tmp);
+        pthread_join(mapthread[t], NULL);
     }
 #else
     // Run one instance of our "thread".  thread number 0, it should just crunch it all

kismet-2006-04-R1-noret.patch:

--- NEW FILE kismet-2006-04-R1-noret.patch ---
2006-04-22  Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

	* prism2source.cc, util.cc, configfile.cc, pcapsource.cc,
	  manuf.cc, packetracker.cc, frontend.cc, panelfront.cc,
	  gpsmap.cc:

	  honor the return value of a lot of syscall/libc functions
	  marked with __attribute__((__warn_result__)).

	  Some/all of the 'fgets(...)==NULL || feof(...)' constructs
	  abort correctly on error but do not report the error.


--- kismet-2006-04-R1/prism2source.cc.noret	2004-08-12 03:59:50.000000000 +0200
+++ kismet-2006-04-R1/prism2source.cc	2006-04-22 18:22:02.000000000 +0200
@@ -107,7 +107,8 @@ int Prism2Source::FetchPacket(kis_packet
 
     if (FD_ISSET(read_sock, &rs)) {
         char a;
-        read(read_sock, &a, 1);
+        if (read(read_sock, &a, 1)!=1)
+	  return -1;
     }
 
 //    u_char buf[MAX_PACKET_LEN];
--- kismet-2006-04-R1/util.cc.noret	2005-06-15 23:54:08.000000000 +0200
+++ kismet-2006-04-R1/util.cc	2006-04-22 18:22:02.000000000 +0200
@@ -248,9 +248,7 @@ vector<int> Str2IntVec(string in_text) {
 }
 
 int RunSysCmd(char *in_cmd) {
-    system(in_cmd);
-    
-    return 0;
+    return system(in_cmd);
 }
 
 pid_t ExecSysCmd(char *in_cmd) {
--- kismet-2006-04-R1/configfile.cc.noret	2006-01-04 16:32:46.000000000 +0100
+++ kismet-2006-04-R1/configfile.cc	2006-04-22 18:22:02.000000000 +0200
@@ -38,9 +38,8 @@ int ConfigFile::ParseConfig(const char *
     }
 
     while (!feof(configf)) {
-        fgets(confline, 8192, configf);
-
-        if (feof(configf)) break;
+        if (fgets(confline, 8192, configf) == NULL ||
+	    feof(configf)) break;
 
         // It's easier to parse this using C++ functions
         string parsestr = StrStrip(confline);
--- kismet-2006-04-R1/pcapsource.cc.noret	2006-04-02 17:13:00.000000000 +0200
+++ kismet-2006-04-R1/pcapsource.cc	2006-04-22 18:22:02.000000000 +0200
@@ -2054,7 +2054,10 @@ int monitor_ipwlivetap(const char *in_de
 		return -1;
 	}
 
-	fgets(dynif, 32, sysf);
+	if (fgets(dynif, 32, sysf) == NULL) {
+	        fclose(sysf);
+	        return -1;
+	}
 
 	// We're done with the RO 
 	fclose(sysf);
@@ -2084,7 +2087,10 @@ int monitor_ipwlivetap(const char *in_de
 			return -1;
 		}
 
-		fgets(dynif, 32, sysf);
+		if (fgets(dynif, 32, sysf) == NULL) {
+		        fclose(sysf);
+			return -1;
+		}
 
 		fclose(sysf);
 
--- kismet-2006-04-R1/manuf.cc.noret	2004-01-14 03:18:32.000000000 +0100
+++ kismet-2006-04-R1/manuf.cc	2006-04-22 18:22:02.000000000 +0200
@@ -48,8 +48,8 @@ macmap<vector<manuf *> > ReadManufMap(FI
     // Read from the file
     char dline[8192];
     while (!feof(in_file)) {
-        fgets(dline, 8192, in_file);
-        if (feof(in_file)) break;
+        if (fgets(dline, 8192, in_file) == NULL ||
+	    feof(in_file)) break;
 
         linenum++;
 
--- kismet-2006-04-R1/packetracker.cc.noret	2006-04-01 18:37:07.000000000 +0200
+++ kismet-2006-04-R1/packetracker.cc	2006-04-22 18:22:03.000000000 +0200
@@ -2295,9 +2295,8 @@ void Packetracker::ReadSSIDMap(FILE *in_
     char bssid_str[18];
 
     while (!feof(in_file)) {
-        fgets(dline, 8192, in_file);
-
-        if (feof(in_file)) break;
+        if (fgets(dline, 8192, in_file) == NULL ||
+	    feof(in_file)) break;
 
         if (sscanf(dline, "%17s %1023[^\n]\n",
                    bssid_str, name) < 2)
@@ -2313,8 +2312,10 @@ void Packetracker::ReadSSIDMap(FILE *in_
 }
 
 void Packetracker::WriteSSIDMap(FILE *in_file) {
-    fseek(in_file, 0L, SEEK_SET);
-    ftruncate(fileno(in_file), 0);
+    if (fseek(in_file, 0L, SEEK_SET) == -1 ||
+	ftruncate(fileno(in_file), 0) == -1)
+      abort();		// HACK: implement better error-handling
+#warning FIXME: implement better error-handling
 
     char format[64];
     snprintf(format, 64, "%%.%ds %%.%ds\n", MAC_STR_LEN, SSID_SIZE);
@@ -2344,9 +2344,8 @@ void Packetracker::ReadIPMap(FILE *in_fi
     net_ip_data dat;
 
     while (!feof(in_file)) {
-        fgets(dline, 8192, in_file);
-
-        if (feof(in_file)) break;
+        if (fgets(dline, 8192, in_file) == NULL ||
+	    feof(in_file)) break;
 
         memset(&dat, 0, sizeof(net_ip_data));
 
@@ -2382,8 +2383,10 @@ void Packetracker::ReadIPMap(FILE *in_fi
 }
 
 void Packetracker::WriteIPMap(FILE *in_file) {
-    fseek(in_file, 0L, SEEK_SET);
-    ftruncate(fileno(in_file), 0);
+    if (fseek(in_file, 0L, SEEK_SET) == -1 ||
+        ftruncate(fileno(in_file), 0) == -1)
+        abort();		// HACK: better error-handling
+#warning FIXME: implement better error-handling
 
     for (map<mac_addr, net_ip_data>::iterator x = bssid_ip_map.begin();
          x != bssid_ip_map.end(); ++x) {
@@ -2445,8 +2447,10 @@ void Packetracker::RemoveNetwork(mac_add
 
 // Write a gpsdrive compatable waypoint file
 int Packetracker::WriteGpsdriveWaypt(FILE *in_file) {
-    fseek(in_file, 0L, SEEK_SET);
-    ftruncate(fileno(in_file), 0);
+    if (fseek(in_file, 0L, SEEK_SET) == -1 ||
+	ftruncate(fileno(in_file), 0) == -1)
+      abort();		// HACK: better error-handling
+#warning FIXME: implement better error-handling
 
     // Convert the map to a vector and sort it
     for (map<mac_addr, wireless_network *>::const_iterator i = bssid_map.begin();
--- kismet-2006-04-R1/frontend.cc.noret	2005-06-29 20:04:43.000000000 +0200
+++ kismet-2006-04-R1/frontend.cc	2006-04-22 18:22:02.000000000 +0200
@@ -722,9 +722,8 @@ void Frontend::ReadGroupMap(FILE *in_fil
     snprintf(format, 64, "%%6[^:]: %%%d[^ ] %%1024[^\n]\n", MAC_STR_LEN);
 
     while (!feof(in_file)) {
-        fgets(dline, 8192, in_file);
-
-        if (feof(in_file)) break;
+        if (fgets(dline, 8192, in_file) == NULL ||
+	    feof(in_file)) break;
 
         // Fetch the line and continue if we're invalid...
         if (sscanf(dline, format, type, parm1, parm2) < 3)
--- kismet-2006-04-R1/panelfront.cc.noret	2005-06-29 20:04:43.000000000 +0200
+++ kismet-2006-04-R1/panelfront.cc	2006-04-22 18:22:02.000000000 +0200
@@ -1398,16 +1398,14 @@ int PanelFront::Tick() {
             int ac_line_status, battery_status, flag, percentage, apm_time;
             char units[32];
 
-            if ((apm = fopen("/proc/apm", "r")) == NULL) {
+            if ((apm = fopen("/proc/apm", "r")) == NULL ||
+		fgets(buf, 128, apm) == NULL) {
                 bat_available = 0;
                 bat_ac = 0;
                 bat_percentage = 0;
                 bat_time = 0;
                 bat_charging = 0;
             } else {
-                fgets(buf, 128, apm);
-                fclose(apm);
-
                 sscanf(buf, "%*s %*d.%*d %*x %x %x %x %d%% %d %s\n", &ac_line_status,
                        &battery_status, &flag, &percentage, &apm_time, units);
 
@@ -1436,6 +1434,8 @@ int PanelFront::Tick() {
                 if (!strncmp(units, "min", 32))
                     bat_time *= 60;
             }
+	    if (apm!=NULL)
+	      fclose(apm);
         } else {
             DIR *batteries, *ac_adapters;
             struct dirent *this_battery, *this_adapter;
--- kismet-2006-04-R1/gpsmap.cc.noret	2005-11-02 22:16:07.000000000 +0100
+++ kismet-2006-04-R1/gpsmap.cc	2006-04-22 18:22:03.000000000 +0200
@@ -4178,7 +4180,10 @@ int main(int argc, char *argv[]) {
         } else {
             char geturl[1024];
             snprintf(geturl, 1024, download_template, url, mapname);
-            system(geturl);
+            if (system(geturl)!=0) {
+	      fprintf(stderr, "WARNING: failed to execute '%s'\n", geturl);
+	      exit(1);
+	    }
         }
 
         printf("Loading map into Imagemagick structures.\n");

kismet-2006-04-R1-packed.patch:

--- NEW FILE kismet-2006-04-R1-packed.patch ---
2006-04-22  Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

	* packetstream.h, pcapsource.h, prism2source.h: placed compiler
	  attributes at the right place:

	  | struct foo {
	  |	  char  a __attribute__((packed));
	  |       int	b __attribute__((packed));
	  | };

          is wrong, while

	  | struct bar {
	  |       char	a;
	  |	  int	b;
	  | }  __attribute__((packed));

	  is right. This patch replaces 'packed' with '__packed__' too.


--- kismet-2006-04-R1/packetstream.h.packed	2005-05-26 16:51:45.000000000 +0200
+++ kismet-2006-04-R1/packetstream.h	2006-04-22 18:22:02.000000000 +0200
@@ -38,10 +38,10 @@
 #define STREAM_COMMAND_FLUSH -1
 
 typedef struct stream_frame_header {
-    uint32_t frame_sentinel __attribute__ ((packed));
-    uint8_t frame_type __attribute__ ((packed));
-    uint32_t frame_len __attribute__ ((packed));
-};
+    uint32_t frame_sentinel;
+    uint8_t frame_type;
+    uint32_t frame_len;
+} __attribute__((__packed__));
 
 typedef struct stream_version_packet {
     uint16_t drone_version;
@@ -49,34 +49,34 @@ typedef struct stream_version_packet {
 };
 
 typedef struct stream_packet_header {
-    uint32_t header_len __attribute__ ((packed));
-    uint16_t drone_version __attribute__ ((packed));
-    uint32_t len __attribute__ ((packed));
-    uint32_t caplen __attribute__ ((packed));
-    uint64_t tv_sec __attribute__ ((packed));
-    uint64_t tv_usec __attribute__ ((packed));
-    uint16_t quality __attribute__ ((packed));
-    uint16_t signal __attribute__ ((packed));
-    uint16_t noise __attribute__ ((packed));
-    uint8_t error __attribute__ ((packed));
-    uint8_t channel __attribute__ ((packed));
-    uint8_t carrier __attribute__ ((packed));
-    uint8_t encoding __attribute__ ((packed));
-    uint32_t datarate __attribute__ ((packed));
-
-    int16_t gps_lat __attribute__ ((packed));
-    int64_t gps_lat_mant __attribute__ ((packed));
-    int16_t gps_lon __attribute__ ((packed));
-    int64_t gps_lon_mant __attribute__ ((packed));
-    int16_t gps_alt __attribute__ ((packed));
-    int64_t gps_alt_mant __attribute__ ((packed));
-    int16_t gps_spd __attribute__ ((packed));
-    int64_t gps_spd_mant __attribute__ ((packed));
-    int16_t gps_heading __attribute__ ((packed));
-    int64_t gps_heading_mant __attribute__ ((packed));
-    int8_t gps_fix __attribute__ ((packed));
+    uint32_t header_len;
+    uint16_t drone_version;
+    uint32_t len;
+    uint32_t caplen;
+    uint64_t tv_sec;
+    uint64_t tv_usec;
+    uint16_t quality;
+    uint16_t signal;
+    uint16_t noise;
+    uint8_t error;
+    uint8_t channel;
+    uint8_t carrier;
+    uint8_t encoding;
+    uint32_t datarate;
+
+    int16_t gps_lat;
+    int64_t gps_lat_mant;
+    int16_t gps_lon;
+    int64_t gps_lon_mant;
+    int16_t gps_alt;
+    int64_t gps_alt_mant;
+    int16_t gps_spd;
+    int64_t gps_spd_mant;
+    int16_t gps_heading;
+    int64_t gps_heading_mant;
+    int8_t gps_fix;
 
-    uint8_t sourcename[32] __attribute__ ((packed));
-};
+    uint8_t sourcename[32];
+} __attribute__((__packed__));
 
 #endif
--- kismet-2006-04-R1/pcapsource.h.packed	2006-03-29 05:08:05.000000000 +0200
+++ kismet-2006-04-R1/pcapsource.h	2006-04-22 18:22:02.000000000 +0200
@@ -91,27 +91,27 @@ protected:
     // Prism 802.11 headers from wlan-ng tacked on to the beginning of a
     // pcap packet... Snagged from the wlan-ng source
     typedef struct {
-        uint32_t did __attribute__ ((packed));
-        uint16_t status __attribute__ ((packed));
-        uint16_t len __attribute__ ((packed));
-        uint32_t data __attribute__ ((packed));
-    } p80211item_uint32_t;
+        uint32_t did;
+        uint16_t status;
+        uint16_t len;
+        uint32_t data;
+    } __attribute__((__packed__)) p80211item_uint32_t;
 
     typedef struct {
-        uint32_t msgcode __attribute__ ((packed));
-        uint32_t msglen __attribute__ ((packed));
-        uint8_t devname[WLAN_DEVNAMELEN_MAX] __attribute__ ((packed));
-        p80211item_uint32_t hosttime __attribute__ ((packed));
-        p80211item_uint32_t mactime __attribute__ ((packed));
-        p80211item_uint32_t channel __attribute__ ((packed));
-        p80211item_uint32_t rssi __attribute__ ((packed));
-        p80211item_uint32_t sq __attribute__ ((packed));
-        p80211item_uint32_t signal __attribute__ ((packed));
-        p80211item_uint32_t noise __attribute__ ((packed));
-        p80211item_uint32_t rate __attribute__ ((packed));
-        p80211item_uint32_t istx __attribute__ ((packed));
-        p80211item_uint32_t frmlen __attribute__ ((packed));
-    } wlan_ng_prism2_header;
+        uint32_t msgcode;
+        uint32_t msglen;
+        uint8_t devname[WLAN_DEVNAMELEN_MAX];
+        p80211item_uint32_t hosttime;
+        p80211item_uint32_t mactime;
+        p80211item_uint32_t channel;
+        p80211item_uint32_t rssi;
+        p80211item_uint32_t sq;
+        p80211item_uint32_t signal;
+        p80211item_uint32_t noise;
+        p80211item_uint32_t rate;
+        p80211item_uint32_t istx;
+        p80211item_uint32_t frmlen;
+    }  __attribute__((__packed__)) wlan_ng_prism2_header;
 
     // Prism 802.11 headers from the openbsd Hermes drivers, even though they don't return
     // a valid linktype yet.  Structure lifted from bsd_airtools by dachb0den labs.
--- kismet-2006-04-R1/prism2source.h.packed	2004-08-09 06:36:01.000000000 +0200
+++ kismet-2006-04-R1/prism2source.h	2006-04-22 18:22:02.000000000 +0200
@@ -66,27 +66,27 @@ public:
 
 protected:
     typedef struct {
-        uint32_t did __attribute__ ((packed));
-        uint16_t status __attribute__ ((packed));
-        uint16_t len __attribute__ ((packed));
-        uint32_t data __attribute__ ((packed));
-    } p80211item_t;
+        uint32_t did;
+        uint16_t status;
+        uint16_t len;
+        uint32_t data;
+    } __attribute__((__packed__)) p80211item_t;
 
     typedef struct {
-        uint32_t msgcode __attribute__ ((packed));
-        uint32_t msglen __attribute__ ((packed));
-        uint8_t devname[DEVNAME_LEN] __attribute__ ((packed));
-        p80211item_t hosttime __attribute__ ((packed));
-        p80211item_t mactime __attribute__ ((packed));
-        p80211item_t channel __attribute__ ((packed));
-        p80211item_t rssi __attribute__ ((packed));
-        p80211item_t sq __attribute__ ((packed));
-        p80211item_t signal __attribute__ ((packed));
-        p80211item_t noise __attribute__ ((packed));
-        p80211item_t rate __attribute__ ((packed));
-        p80211item_t istx __attribute__ ((packed));
-        p80211item_t frmlen __attribute__ ((packed));
-    } sniff_packet_t;
+        uint32_t msgcode;
+        uint32_t msglen;
+        uint8_t devname[DEVNAME_LEN];
+        p80211item_t hosttime;
+        p80211item_t mactime;
+        p80211item_t channel;
+        p80211item_t rssi;
+        p80211item_t sq;
+        p80211item_t signal;
+        p80211item_t noise;
+        p80211item_t rate;
+        p80211item_t istx;
+        p80211item_t frmlen;
+    } __attribute__ ((__packed__)) sniff_packet_t;
 
     int Prism2Common(kis_packet *packet, uint8_t *data, uint8_t *moddata);
 

kismet-2006-04-R1-ssize.patch:

--- NEW FILE kismet-2006-04-R1-ssize.patch ---
2006-04-29  Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

	* gpsmap.cc: this patch is originated by Hans de Goede posted at

	  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=165314#c25


--- kismet-2006-04-R1/gpsmap.cc.64bit	2006-04-26 06:56:39.000000000 +0200
+++ kismet-2006-04-R1/gpsmap.cc	2006-04-26 06:57:03.000000000 +0200
@@ -864,8 +864,8 @@
                     orignetfile = "./" + orignetfile;
 
                 // Break up the path to the gpsxml file and form a path based on that
-                unsigned int lastslash = 0;
-                for (unsigned int x = origxmlfile.find('/'); x != string::npos;
+                string::size_type lastslash = 0;
+                for (string::size_type x = origxmlfile.find('/'); x != string::npos;
                      lastslash = x, x = origxmlfile.find('/', lastslash+1)) {
                     // We don't actually need to do anything...
                 }
@@ -873,7 +873,7 @@
                 comp = origxmlfile.substr(0, lastslash);
 
                 lastslash = 0;
-                for (unsigned int x = orignetfile.find('/'); x != string::npos;
+                for (string::size_type x = orignetfile.find('/'); x != string::npos;
                      lastslash = x, x = orignetfile.find('/', lastslash+1)) {
                     // We don't actually need to do anything...
                 }

kismet-2006-04-R1-strop.patch:

--- NEW FILE kismet-2006-04-R1-strop.patch ---
2006-04-22  Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

	* extra/buzzme/buzzme.c, libpcap-0.9.1-kis/fad-glifc.c,
	  libpcap-0.9.1-kis/pcap-nit.c,
	  libpcap-0.9.1-kis/pcap-snoop.c,
	  libpcap-0.9.1-kis/fad-gifc.c,
	  libpcap-0.9.1-kis/pcap-linux.c,
	  pcapsource.cc, tcpclient.cc, gpsmap_cache.cc, ifcontrol.cc:

 	  ensure, that strings copied by 'strncpy()' will be terminated
 	  by '\0'. The following replacements are used for

	  | strncpy(buf, 0, buf_len);

	  a) when 'buf[buf_len-1] == '\0' can be guaranteed (e.g. by a
	     previous memset()):
             | strncpy(buf, 0, buf_len - 1);

	  b) when 'buf[buf_len-1] == '\0' can not be guaranteed:

	     | strncpy(buf, 0, buf_len);
             | buf[buf_len-1] = '\0';

	     on first glance it seems to be more efficient to use

	     | strncpy(buf, 0, buf_len-1);

	     But most 'buf_len' are multiples of 2 or 4 allowing the
	     compiler to generate more efficient code.

	  At same places,

          | strncpy(buf, 0, sizeof buf);

	  will be used where applicable.


	  Perhaps, it would be a good idea to use BSD's strlcpy()
	  there?

	* panelfront_display.cc

	  most hunks fixes some oddnesses in the assignment/range-check
	  for 'print_width'.

          A range-check was added in PanelFront::StatsPrinter() which
          was missing before.


--- kismet-2006-04-R1/extra/buzzme/buzzme.c.strop	2002-07-22 17:01:26.000000000 +0200
+++ kismet-2006-04-R1/extra/buzzme/buzzme.c	2006-04-22 21:08:37.000000000 +0200
@@ -94,6 +94,7 @@ main(int argc, char **argv)
 
   // Figure out program name. Remove path if needed.
   strncpy(pname,argv[0],sizeof(pname));
+  pname[sizeof(pname)-1] = '\0';
   if ((progname = rindex(pname,'/')) != NULL) {
      progname++; // skip slash.
   }
--- kismet-2006-04-R1/libpcap-0.9.1-kis/fad-glifc.c.strop	2005-06-21 02:58:08.000000000 +0200
+++ kismet-2006-04-R1/libpcap-0.9.1-kis/fad-glifc.c	2006-04-22 21:08:37.000000000 +0200
@@ -213,6 +213,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
 		 */
 		strncpy(ifrflags.lifr_name, ifrp->lifr_name,
 		    sizeof(ifrflags.lifr_name));
+		ifrflags.lifr_name[sizeof(ifrflags.lifr_name)-1] = '\0';
 		if (ioctl(fd, SIOCGLIFFLAGS, (char *)&ifrflags) < 0) {
 			if (errno == ENXIO)
 				continue;
@@ -232,6 +233,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
 		 */
 		strncpy(ifrnetmask.lifr_name, ifrp->lifr_name,
 		    sizeof(ifrnetmask.lifr_name));
+		ifrnetmask.lifr_name[sizeof(ifrnetmask.lifr_name)-1] = '\0';
 		memcpy(&ifrnetmask.lifr_addr, &ifrp->lifr_addr,
 		    sizeof(ifrnetmask.lifr_addr));
 		if (ioctl(fd, SIOCGLIFNETMASK, (char *)&ifrnetmask) < 0) {
@@ -259,6 +261,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
 		if (ifrflags.lifr_flags & IFF_BROADCAST) {
 			strncpy(ifrbroadaddr.lifr_name, ifrp->lifr_name,
 			    sizeof(ifrbroadaddr.lifr_name));
+			ifrbroadaddr.lifr_name[sizeof(ifrbroadaddr.lifr_name)-1] = '\0';
 			memcpy(&ifrbroadaddr.lifr_addr, &ifrp->lifr_addr,
 			    sizeof(ifrbroadaddr.lifr_addr));
 			if (ioctl(fd, SIOCGLIFBRDADDR,
@@ -294,6 +297,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
 		if (ifrflags.lifr_flags & IFF_POINTOPOINT) {
 			strncpy(ifrdstaddr.lifr_name, ifrp->lifr_name,
 			    sizeof(ifrdstaddr.lifr_name));
+			ifrdstaddr.lifr_name[sizeof(ifrdstaddr.lifr_name)-1] = '\0';
 			memcpy(&ifrdstaddr.lifr_addr, &ifrp->lifr_addr,
 			    sizeof(ifrdstaddr.lifr_addr));
 			if (ioctl(fd, SIOCGLIFDSTADDR,
--- kismet-2006-04-R1/libpcap-0.9.1-kis/pcap-nit.c.strop	2005-06-21 02:58:08.000000000 +0200
+++ kismet-2006-04-R1/libpcap-0.9.1-kis/pcap-nit.c	2006-04-22 21:08:37.000000000 +0200
@@ -199,7 +199,7 @@ pcap_inject_nit(pcap_t *p, const void *b
 	int ret;
 
 	memset(&sa, 0, sizeof(sa));
-	strncpy(sa.sa_data, device, sizeof(sa.sa_data));
+	strncpy(sa.sa_data, device, sizeof(sa.sa_data)-1);
 	ret = sendto(p->fd, buf, size, 0, &sa, sizeof(sa));
 	if (ret == -1) {
 		snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send: %s",
@@ -273,8 +273,9 @@ pcap_open_live(const char *device, int s
 		    "socket: %s", pcap_strerror(errno));
 		goto bad;
 	}
+	memset(&snit, 0, sizeof snit);
 	snit.snit_family = AF_NIT;
-	(void)strncpy(snit.snit_ifname, device, NITIFSIZ);
+	(void)strncpy(snit.snit_ifname, device, sizeof(snit.snit_ifname)-1);
 
 	if (bind(fd, (struct sockaddr *)&snit, sizeof(snit))) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
--- kismet-2006-04-R1/libpcap-0.9.1-kis/pcap-snoop.c.strop	2005-06-21 02:58:08.000000000 +0200
+++ kismet-2006-04-R1/libpcap-0.9.1-kis/pcap-snoop.c	2006-04-22 21:08:37.000000000 +0200
@@ -223,7 +223,7 @@ pcap_open_live(const char *device, int s
 	p->fd = fd;
 	memset(&sr, 0, sizeof(sr));
 	sr.sr_family = AF_RAW;
-	(void)strncpy(sr.sr_ifname, device, sizeof(sr.sr_ifname));
+	(void)strncpy(sr.sr_ifname, device, sizeof(sr.sr_ifname)-1);
 	if (bind(fd, (struct sockaddr *)&sr, sizeof(sr))) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE, "snoop bind: %s",
 		    pcap_strerror(errno));
@@ -316,6 +316,7 @@ pcap_open_live(const char *device, int s
 	 * to be no greater than the MTU.
 	 */
 	(void)strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	ifr.ifr_name[sizeof(ifr.ifr_name)-1] = '\0';
 	if (ioctl(fd, SIOCGIFMTU, (char *)&ifr) < 0) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE, "SIOCGIFMTU: %s",
 		    pcap_strerror(errno));
--- kismet-2006-04-R1/libpcap-0.9.1-kis/fad-gifc.c.strop	2005-06-21 02:58:08.000000000 +0200
+++ kismet-2006-04-R1/libpcap-0.9.1-kis/fad-gifc.c	2006-04-22 21:08:37.000000000 +0200
@@ -188,6 +188,7 @@ scan_proc_net_dev(pcap_if_t **devlistp, 
 		 * it's not up.
 		 */
 		strncpy(ifrflags.ifr_name, name, sizeof(ifrflags.ifr_name));
+		ifrflags.ifr_name[sizeof(ifrflags.ifr_name)-1] = '\0';
 		if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
 			if (errno == ENXIO)
 				continue;
@@ -354,6 +355,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
 		 */
 		strncpy(ifrflags.ifr_name, ifrp->ifr_name,
 		    sizeof(ifrflags.ifr_name));
+		ifrflags.ifr_name[sizeof(ifrflags.ifr_name)-1] = '\0';
 		if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
 			if (errno == ENXIO)
 				continue;
@@ -373,6 +375,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
 		 */
 		strncpy(ifrnetmask.ifr_name, ifrp->ifr_name,
 		    sizeof(ifrnetmask.ifr_name));
+		ifrnetmask.ifr_name[sizeof(ifrnetmask.ifr_name)-1] = '\0';
 		memcpy(&ifrnetmask.ifr_addr, &ifrp->ifr_addr,
 		    sizeof(ifrnetmask.ifr_addr));
 		if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifrnetmask) < 0) {
@@ -403,6 +406,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
 		if (ifrflags.ifr_flags & IFF_BROADCAST) {
 			strncpy(ifrbroadaddr.ifr_name, ifrp->ifr_name,
 			    sizeof(ifrbroadaddr.ifr_name));
+			ifrbroadaddr.ifr_name[sizeof(ifrbroadaddr.ifr_name)-1] = '\0';
 			memcpy(&ifrbroadaddr.ifr_addr, &ifrp->ifr_addr,
 			    sizeof(ifrbroadaddr.ifr_addr));
 			if (ioctl(fd, SIOCGIFBRDADDR,
@@ -442,6 +446,7 @@ pcap_findalldevs(pcap_if_t **alldevsp, c
 		if (ifrflags.ifr_flags & IFF_POINTOPOINT) {
 			strncpy(ifrdstaddr.ifr_name, ifrp->ifr_name,
 			    sizeof(ifrdstaddr.ifr_name));
+			ifrdstaddr.ifr_name[sizeof(ifrdstaddr.ifr_name)-1] = '\0';
 			memcpy(&ifrdstaddr.ifr_addr, &ifrp->ifr_addr,
 			    sizeof(ifrdstaddr.ifr_addr));
 			if (ioctl(fd, SIOCGIFDSTADDR,
--- kismet-2006-04-R1/libpcap-0.9.1-kis/pcap-linux.c.strop	2005-07-19 22:06:52.000000000 +0200
+++ kismet-2006-04-R1/libpcap-0.9.1-kis/pcap-linux.c	2006-04-22 21:08:37.000000000 +0200
@@ -1496,7 +1496,7 @@ iface_get_id(int fd, const char *device,
 	struct ifreq	ifr;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)-1);
 
 	if (ioctl(fd, SIOCGIFINDEX, &ifr) == -1) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
@@ -1598,7 +1598,7 @@ static void	pcap_close_linux( pcap_t *ha
 		 * kernels.
 		 */
 		memset(&ifr, 0, sizeof(ifr));
-		strncpy(ifr.ifr_name, handle->md.device, sizeof(ifr.ifr_name));
+		strncpy(ifr.ifr_name, handle->md.device, sizeof(ifr.ifr_name)-1);
 		if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) == -1) {
 			fprintf(stderr,
 			    "Can't restore interface flags (SIOCGIFFLAGS failed: %s).\n"
@@ -1714,7 +1714,7 @@ live_open_old(pcap_t *handle, const char
 
 		if (promisc) {
 			memset(&ifr, 0, sizeof(ifr));
-			strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+			strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)-1);
 			if (ioctl(handle->fd, SIOCGIFFLAGS, &ifr) == -1) {
 				snprintf(ebuf, PCAP_ERRBUF_SIZE,
 					 "ioctl: %s", pcap_strerror(errno));
@@ -1792,7 +1792,7 @@ iface_bind_old(int fd, const char *devic
 	socklen_t	errlen = sizeof(err);
 
 	memset(&saddr, 0, sizeof(saddr));
-	strncpy(saddr.sa_data, device, sizeof(saddr.sa_data));
+	strncpy(saddr.sa_data, device, sizeof(saddr.sa_data)-1);
 	if (bind(fd, &saddr, sizeof(saddr)) == -1) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
 			 "bind: %s", pcap_strerror(errno));
@@ -1831,7 +1831,7 @@ iface_get_mtu(int fd, const char *device
 		return BIGGER_THAN_ALL_MTUS;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)-1);
 
 	if (ioctl(fd, SIOCGIFMTU, &ifr) == -1) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
@@ -1851,7 +1851,7 @@ iface_get_arptype(int fd, const char *de
 	struct ifreq	ifr;
 
 	memset(&ifr, 0, sizeof(ifr));
-	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
+	strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name)-1);
 
 	if (ioctl(fd, SIOCGIFHWADDR, &ifr) == -1) {
 		snprintf(ebuf, PCAP_ERRBUF_SIZE,
--- kismet-2006-04-R1/panelfront_display.cc.strop	2005-08-15 17:52:16.000000000 +0200
+++ kismet-2006-04-R1/panelfront_display.cc	2006-04-22 21:08:37.000000000 +0200
@@ -19,6 +19,7 @@
 #include "config.h"
 
 #include <math.h>
+#include <sys/param.h>
 
 #include "panelfront.h"
 #include "displaynetworksort.h"
@@ -1475,9 +1476,8 @@ int PanelFront::DetailsPrinter(void *in_
     char output[1024];
     kwin->text.clear();
 
-    int print_width = kwin->print_width;
-    if (print_width > 1024)
-        print_width = 1023;
+    size_t const print_width = MIN(static_cast<size_t>(kwin->print_width),
+				   sizeof(output));
 
 	if (details_network == NULL) {
 		kwin->text.push_back("The network or group being displayed");
@@ -1918,9 +1918,8 @@ int PanelFront::GpsPrinter(void *in_wind
 
     wireless_network *dnet = details_network->virtnet;
 
-    int print_width = kwin->print_width;
-    if (print_width > 1024)
-        print_width = 1023;
+    size_t const print_width = MIN(static_cast<size_t>(kwin->print_width),
+				   sizeof(output));
 
     if (print_width < 32) {
         kwin->text.push_back("Display not wide enough");
@@ -2603,7 +2602,8 @@ int PanelFront::StatsPrinter(void *in_wi
     vector<string> details_text;
     char output[1024];
 
-    const int print_width = kwin->print_width;
+    const size_t print_width = MIN(static_cast<size_t>(kwin->print_width),
+				   sizeof(output));
 
     snprintf(output, print_width, "Start   : %.24s", ctime((const time_t *) &start_time));
     details_text.push_back(output);
@@ -2921,9 +2921,8 @@ int PanelFront::DetailsClientPrinter(voi
     char temp[1024];
     kwin->text.clear();
 
-    int print_width = kwin->print_width;
-    if (print_width > 1024)
-        print_width = 1023;
+    size_t const print_width = MIN(static_cast<size_t>(kwin->print_width),
+				   sizeof(output));
 
     switch (details_client->type) {
     case client_fromds:
--- kismet-2006-04-R1/pcapsource.cc.strop	2006-04-22 21:08:37.000000000 +0200
+++ kismet-2006-04-R1/pcapsource.cc	2006-04-22 21:08:37.000000000 +0200
@@ -2756,7 +2756,7 @@ bool RadiotapBSD::getmediaopt(int& optio
         return false;
 
     memset(&ifmr, 0, sizeof(ifmr));
-    strncpy(ifmr.ifm_name, ifname.c_str(), sizeof(ifmr.ifm_name));
+    strncpy(ifmr.ifm_name, ifname.c_str(), sizeof(ifmr.ifm_name)-1);
 
     /*
      * We must go through the motions of reading all
@@ -2781,7 +2781,7 @@ bool RadiotapBSD::setmediaopt(int option
         return false;
 
     memset(&ifmr, 0, sizeof(ifmr));
-    strncpy(ifmr.ifm_name, ifname.c_str(), sizeof(ifmr.ifm_name));
+    strncpy(ifmr.ifm_name, ifname.c_str(), sizeof(ifmr.ifm_name)-1);
 
     /*
      * We must go through the motions of reading all
@@ -2809,7 +2809,7 @@ bool RadiotapBSD::setmediaopt(int option
     delete mwords;
 
     memset(&ifr, 0, sizeof(ifr));
-    strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name));
+    strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name)-1);
     ifr.ifr_media = (ifmr.ifm_current &~ IFM_OMASK) | options;
     ifr.ifr_media = (ifr.ifr_media &~ IFM_MMASK) | IFM_MAKEMODE(mode);
 
@@ -2863,7 +2863,7 @@ bool RadiotapBSD::get80211(int type, int
     if (!checksocket())
         return false;
     memset(&ireq, 0, sizeof(ireq));
-    strncpy(ireq.i_name, ifname.c_str(), sizeof(ireq.i_name));
+    strncpy(ireq.i_name, ifname.c_str(), sizeof(ireq.i_name)-1);
     ireq.i_type = type;
     ireq.i_len = len;
     ireq.i_data = data;
@@ -2881,7 +2881,7 @@ bool RadiotapBSD::set80211(int type, int
     if (!checksocket())
 	return false;
     memset(&ireq, 0, sizeof(ireq));
-    strncpy(ireq.i_name, ifname.c_str(), sizeof(ireq.i_name));
+    strncpy(ireq.i_name, ifname.c_str(), sizeof(ireq.i_name)-1);
     ireq.i_type = type;
     ireq.i_val = val;
     ireq.i_len = len;
@@ -2898,6 +2898,7 @@ bool RadiotapBSD::getifflags(int& flags)
         return false;
 
     strncpy(ifr.ifr_name, ifname.c_str(), sizeof (ifr.ifr_name));
+    ifr.ifr_name[sizeof (ifr.ifr_name)-1] = '\0';
     if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
         perror("SIOCGIFFLAGS ioctl failed");
         return false;
--- kismet-2006-04-R1/tcpclient.cc.strop	2006-04-22 21:08:37.000000000 +0200
+++ kismet-2006-04-R1/tcpclient.cc	2006-04-22 21:08:37.000000000 +0200
@@ -107,6 +107,7 @@ int TcpClient::Connect(short int in_port
     }
 
     strncpy(hostname, in_host, MAXHOSTNAMELEN);
+    hostname[MAXHOSTNAMELEN-1] = '\0';
 
     // Set up our socket
     //bzero(&client_sock, sizeof(client_sock));
--- kismet-2006-04-R1/gpsmap_cache.cc.strop	2005-03-10 17:49:34.000000000 +0100
+++ kismet-2006-04-R1/gpsmap_cache.cc	2006-04-22 21:08:37.000000000 +0200
@@ -174,6 +174,8 @@ int ReadGpsCacheFile(const char *in_gpsf
 
         strncpy(pt->bssid, cpt.bssid, MAC_STR_LEN);
         strncpy(pt->source, cpt.source, MAC_STR_LEN);
+	pt->bssid[MAC_STR_LEN-1]  = '\0';
+	pt->source[MAC_STR_LEN-1] = '\0';
         pt->tv_sec = cpt.tv_sec;
         pt->tv_usec = cpt.tv_usec;
         pt->lat = cpt.lat;
@@ -344,9 +346,10 @@ int WriteGpsCacheFile(const char *in_gps
     for (unsigned int nsam = 0; nsam < fheader.num_points; nsam++) {
         gpscache_point cpt;
         gps_point *pt = (*in_points)[nsam];
-   
-        strncpy(cpt.bssid, pt->bssid, MAC_STR_LEN);
-        strncpy(cpt.source, pt->source, MAC_STR_LEN);
+
+	memset(&cpt, 0, sizeof cpt);
+        strncpy(cpt.bssid, pt->bssid, sizeof(cpt.bssid)-1);
+        strncpy(cpt.source, pt->source, sizeof(cpt.source)-1);
         cpt.tv_sec = pt->tv_sec;
         cpt.tv_usec = pt->tv_usec;
         cpt.lat = pt->lat;
--- kismet-2006-04-R1/ifcontrol.cc.strop	2004-08-09 06:36:01.000000000 +0200
+++ kismet-2006-04-R1/ifcontrol.cc	2006-04-22 21:08:37.000000000 +0200
@@ -32,7 +32,8 @@ int Ifconfig_Set_Flags(const char *in_de
     }
 
     // Fetch interface flags
-    strncpy(ifr.ifr_name, in_dev, IFNAMSIZ);
+    memset(&ifr, 0, sizeof ifr);
+    strncpy(ifr.ifr_name, in_dev, sizeof(ifr.ifr_name)-1);
     ifr.ifr_flags = flags;
     if (ioctl(skfd, SIOCSIFFLAGS, &ifr) < 0) {
         snprintf(errstr, STATUS_MAX, "SetIFFlags: Unknown interface %s: %s", 
@@ -58,7 +59,8 @@ int Ifconfig_Get_Flags(const char *in_de
     }
 
     // Fetch interface flags
-    strncpy(ifr.ifr_name, in_dev, IFNAMSIZ);
+    memset(&ifr, 0, sizeof ifr);
+    strncpy(ifr.ifr_name, in_dev, sizeof(ifr.ifr_name)-1);
     if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) {
         snprintf(errstr, STATUS_MAX, "GetIFFlags: interface %s: %s", 
                  in_dev, strerror(errno));
@@ -96,7 +98,8 @@ int Ifconfig_Get_Hwaddr(const char *in_d
     }
 
     // Fetch interface flags
-    strncpy(ifr.ifr_name, in_dev, IFNAMSIZ);
+    memset(&ifr, 0, sizeof ifr);
+    strncpy(ifr.ifr_name, in_dev, sizeof(ifr.ifr_name)-1);
     if (ioctl(skfd, SIOCGIFHWADDR, &ifr) < 0) {
         snprintf(errstr, STATUS_MAX, "Getting HWAddr: unknown interface %s: %s", 
                  in_dev, strerror(errno));
@@ -122,7 +125,8 @@ int Ifconfig_Set_Hwaddr(const char *in_d
         return -1;
     }
 
-    strncpy(ifr.ifr_name, in_dev, IFNAMSIZ);
+    memset(&ifr, 0, sizeof ifr);
+    strncpy(ifr.ifr_name, in_dev, sizeof(ifr.ifr_name)-1);
     memcpy(ifr.ifr_hwaddr.sa_data, in_hwaddr, 6);
     ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
      
@@ -151,7 +155,8 @@ int Ifconfig_Set_MTU(const char *in_dev,
     }
 
     // Fetch interface flags
-    strncpy(ifr.ifr_name, in_dev, IFNAMSIZ);
+    memset(&ifr, 0, sizeof ifr);
+    strncpy(ifr.ifr_name, in_dev, sizeof(ifr.ifr_name)-1);
     ifr.ifr_mtu = in_mtu;
     if (ioctl(skfd, SIOCSIFMTU, &ifr) < 0) {
         snprintf(errstr, STATUS_MAX, "Setting MTU: unknown interface %s: %s", 

kismet-2006-04-R1-uninit.patch:

--- NEW FILE kismet-2006-04-R1-uninit.patch ---
2006-04-22  Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

	* macaddr.h: initialized a 'second' attribute in an iterator
	  class which might be used uninitialized else

--- kismet-2006-04-R1/macaddr.h.uninit	2006-01-04 16:32:46.000000000 +0100
+++ kismet-2006-04-R1/macaddr.h	2006-04-22 18:22:02.000000000 +0200
@@ -290,6 +290,7 @@ public:
             } else {
                 singleton_itr = owner->singleton_map.end();
                 vector_itr = owner->mask_vec.size();
+		second     = NULL;
             }
         }
 


--- NEW FILE kismet-2006-04-R1.tar.gz.asc ---
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQBEPdlU17KIInOLvbERAhT2AKCWL5TA/FwgFZbFubgKQc8so8bYPACaAwQd
3W60uDYNJgwGoxNwroHB5t4=
=KeKF
-----END PGP SIGNATURE-----


--- NEW FILE kismet.spec ---
## $Id: kismet.spec 1859 2006-04-23 11:47:18Z ensc at BIGO.ENSC.DE $

%global _version	2006-04-R1

## {Local macros...
%global username	kismet
%global crontabdir	%_sysconfdir/cron.daily
%global homedir		%_var/lib/%name
%global logdir		%_var/log/%name
%global cfgdir		%_sysconfdir/%name
%global _rpmversion	0.0.%(echo %_version | tr - .)
## ...local macros}

%{!?release_func:%global release_func() %1%{?dist}}

Summary:	WLAN detector, sniffer and IDS
Name:		kismet
Version:	%_rpmversion
Release:	%release_func 2
License:	GPL
Group:		Applications/Internet
URL:		http://www.kismetwireless.net/
Source0:	http://www.kismetwireless.net/code/%name-%_version.tar.gz
Source1:	http://www.kismetwireless.net/code/%name-%_version.tar.gz.asc
Source10:	tmpwatch.kismet
Source11:	sysconfig.kismet
Patch0:		kismet-2005-08-R1-jobcontrol.patch
Patch1:		kismet-2006-04-R1-packed.patch
Patch2:		kismet-2006-04-R1-noret.patch
Patch3:		kismet-2006-04-R1-uninit.patch
Patch4:		kismet-2006-04-R1-alias.patch
Patch5:		kismet-2006-04-R1-strop.patch
Patch6:		kismet-2006-04-R1-alias1.patch
Patch7:		kismet-2006-04-R1-ssize.patch
BuildRoot:	%_tmppath/%name-%version-%release-root
BuildRequires:		expat-devel ncurses-devel diffutils
BuildRequires:		gmp-devel wget glib-devel
BuildRequires:		ImageMagick-devel
# should be required by ImageMagick-devel but are missing in FC4
BuildRequires:		libtiff-devel libjpeg-devel
BuildRequires:		bzip2-devel
Requires(pre):		fedora-usermgmt
Requires(postun):	fedora-usermgmt
Requires(missingok):	tmpwatch
Requires(missingok):	crontabs
Requires(pre):		%crontabdir
Requires(postun):	%crontabdir


%package extras
Summary:	Non-core programs for 'kismet'
Group:		Applications/Internet
Requires:	%name = %version-%release


%description
Kismet is an 802.11 layer2 wireless network detector, sniffer, and
intrusion detection system. Kismet will work with any wireless card
which supports raw monitoring (rfmon) mode, and can sniff 802.11b,
802.11a, and 802.11g traffic.

Kismet identifies networks by passively collecting packets and detecting
standard named networks, detecting (and given time, decloaking) hidden
networks, and infering the presence of nonbeaconing networks via data
traffic.

%description extras
Kismet is an 802.11 layer2 wireless network detector, sniffer, and
intrusion detection system. Kismet will work with any wireless card
which supports raw monitoring (rfmon) mode, and can sniff 802.11b,
802.11a, and 802.11g traffic.

This subpackage contains programs which provide additional functionality
but introduce dependencies which are not needed for kismet to work.


%prep
%setup -q -n %name-%_version
%patch0 -p1 -b .jobcontrol
%patch1 -p1 -b .packed
%patch2 -p1 -b .noret
%patch3 -p1 -b .uninit
%patch4 -p1 -b .alias
%patch6 -p1 -b .alias1
%patch5 -p1 -b .strop
%patch7 -p1 -b .ssize

sed -e 's!/var/log/kismet!%logdir!g' %SOURCE10 >tmpwatch.kismet
touch --reference=%SOURCE10 tmpwatch.kismet || :	# keep timestamp

# set our 'kismet' user, disable GPS and log into %logdir by
# default
sed -i -e "s!your_user_here!%username!g;
           s!^gps=true!gps=false!;
           s!^logtemplate=%%!logtemplate=%logdir/%%!;
	   s!^configdir=.*!configdir=%h/!" \
		conf/kismet.conf.in conf/kismet_drone.conf

# do not strip installed binaries as it conflicts with the -debuginfo
# mechanism
sed -i -e "s!\(install .*\) -s !\1 !g" Makefile.in


%build
export ac_cv_header_linux_netlink_h=yes	# we have netlink.h; just the check is buggy
export ac_cv_lib_uClibcpp_main=no	# we do not want to build against uClibc++, even when available
%configure --enable-ipv6 --sysconfdir=%cfgdir

# HOME will be set to @srcdir@ which is disturbing distcc
make clean
make %{?_smp_mflags} HOME="$HOME"


%install
rm -rf $RPM_BUILD_ROOT
make install	\
	DESTDIR="$RPM_BUILD_ROOT" \
	INSTUSR="$(id -un)" INSTGRP="$(id -gn)" MANGRP="$(id -gn)"
install -d $RPM_BUILD_ROOT{%homedir,%logdir,%crontabdir,%_sysconfdir/sysconfig}
install -p -m755 tmpwatch.kismet $RPM_BUILD_ROOT%crontabdir
install -p -m644 %SOURCE11       $RPM_BUILD_ROOT%_sysconfdir/sysconfig/kismet


%pre
/usr/sbin/fedora-groupadd 12 -r %username &>/dev/null || :
/usr/sbin/fedora-useradd  12 -r -s /sbin/nologin -M -d %homedir		\
			     -c 'Kismet user' -g %username %username &>/dev/null || :


%postun
test "$1" != 0 || /usr/sbin/fedora-userdel  %username &>/dev/null || :
test "$1" != 0 || /usr/sbin/fedora-groupdel %username &>/dev/null || :


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc CHANGELOG* GPL README TODO docs
%dir %attr(0770,root,%username) %homedir
%dir %attr(0730,root,%username) %logdir
%dir %attr(0750,root,%username) %cfgdir
%config(noreplace) %cfgdir/*
%_bindir/kismet*
%_datadir/kismet
%_mandir/*/kismet*

%config            %crontabdir/tmpwatch.kismet
%config(noreplace) %_sysconfdir/sysconfig/kismet


%files extras
%defattr(-,root,root,-)
%_bindir/gps*
%_mandir/*/gps*


%changelog
* Sat Apr 29 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.0.2006.04.R1-2
- fixed compilation problems on AMD64 introduced by my -alias patch
  (reported by Hans de Goede)
- fixed ssize_t vs. int problem on AMD64 (found and reported by Hans
  de Goede)
- initial import into Fedora Extra (review #165314)

* Sat Apr 22 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.0.2006.04.R1-1
- updated to 2006-04-R1
- fixed/improved some ./configure checks
- removed the starting 'A' from the summary
- added a bunch of patches fixing compiler warnings

* Fri Mar 17 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.0.2005.08.R1-3
- fixed the usermgmt in the %%postun script: test for uninstallation
  and swap order of user- and groupdel operations
- moved logs to /var/log/kismet
- placed status information directly under /var/lib/kismet instead of
  /var/lib/kismet/.kismet
- added /etc/cron.dail/tmpwatch.kismet to cleanup the generated
  logfiles; used tmpwatch because kismet creates new, differently
  named logfiles.
- added -jobcontrol patch

* Thu Mar 16 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.0.2005.08.R1-2
- set *USR and *GRP variables to avoid problems with certain 'install'
  versions

* Thu Aug 18 2005 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.0.2005.08.R1-1
- updated to 2005-08-R1 (SECURITY)
- do not use 'subst()' in %%prep anymore; the files *will* be touched
  so we do not need to care about the timestamp
- fixed copy&paste error in the gecos entry of the 'kismet' user

* Sun Aug  7 2005 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.0.2005.07.R1a-1
- updated to 2005-07-R1a

* Sat Jul  9 2005 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.0.2005.06.R1-1
- Initial build.


## Local Variables:
## outline-regexp: "##\\s-*{.*\\.\\.\\."
## outline-heading-end-regexp: "##\\s-*\\.\\.\\..*}"
## End:


--- NEW FILE sysconfig.kismet ---
## set this flag when automatic removal of generated kismet logfiles
## is unwanted. Default: unset
# NO_TMPWATCH=

## set this option to the number of minimum number of hours the
## generated logfiles shall be kept. Default: 72 (3 days)
# TMPWATCH_TIME=72

## add additional options which shall be given to tmpwatch(8). Default:
## unset
# TMPWATCH_FLAGS=


--- NEW FILE tmpwatch.kismet ---
#! /bin/sh

TMPWATCH=/usr/sbin/tmpwatch
CFGFILE=/etc/sysconfig/kismet
LOGDIR=/var/log/kismet

NO_TMPWATCH=
TMPWATCH_TIME=72	# 3 days
TMPWATCH_FLAGS=
test ! -e $CFGFILE      || . $CFGFILE

test -z "$NO_LOGROTATE" || exit 0
test -x "$TMPWATCH"     || exit 0


exec $TMPWATCH $TMPWATCH_FLAGS "$TMPWATCH_TIME" "$LOGDIR"


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/kismet/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	29 Apr 2006 16:28:15 -0000	1.1
+++ .cvsignore	29 Apr 2006 16:31:28 -0000	1.2
@@ -0,0 +1 @@
+kismet-2006-04-R1.tar.gz


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/kismet/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	29 Apr 2006 16:28:15 -0000	1.1
+++ sources	29 Apr 2006 16:31:28 -0000	1.2
@@ -0,0 +1 @@
+8ec2de513f2911df1b7edfcba5ad1c26  kismet-2006-04-R1.tar.gz




More information about the scm-commits mailing list