Ethereal-dev: [Ethereal-dev] Patch to get 0.10.12 to compile on OpenBSD37

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ober Heim <ober@xxxxxxxxxx>
Date: Mon, 15 Aug 2005 14:59:27 -0500 (CDT)
There is a name space conflict with the latest radius dissectors with the keyword encrypt, which is previously defined in /usr/include/unistd.h.


"I am not your puppet. Since when? Now, get your spongy pink ass out there, and dance for the cameras." -Death to Smoochy
diff -ru ethereal-0.10.12/epan/dissectors/packet-radius.c ethereal-0.10.12.obsd/epan/dissectors/packet-radius.c
--- ethereal-0.10.12/epan/dissectors/packet-radius.c	Tue Jul 26 14:26:42 2005
+++ ethereal-0.10.12.obsd/epan/dissectors/packet-radius.c	Mon Aug 15 14:31:47 2005
@@ -265,7 +265,7 @@
 }
 
 void radius_string(radius_attr_info_t* a, proto_tree* tree, packet_info *pinfo _U_, tvbuff_t* tvb, int offset, int len, proto_item* avp_item) {
-	if (a->encrypt) {
+	if (a->rencrypt) {
 		if (*shared_secret == '\0') {
 			proto_item_append_text(avp_item, "Encrypted");
 			proto_tree_add_item(tree, a->hf, tvb, offset, len, FALSE);
@@ -845,7 +845,7 @@
 		
 		dictionary_entry->name = g_strdup_printf("Unknown-Attribute-%u",attribute_id);
 		dictionary_entry->code = attribute_id;
-		dictionary_entry->encrypt = FALSE;
+		dictionary_entry->rencrypt = FALSE;
 		dictionary_entry->type = NULL;
 		dictionary_entry->vs = NULL;
 		dictionary_entry->hf = no_dictionary_entry.hf;
diff -ru ethereal-0.10.12/epan/dissectors/packet-radius.h ethereal-0.10.12.obsd/epan/dissectors/packet-radius.h
--- ethereal-0.10.12/epan/dissectors/packet-radius.h	Tue Jul 26 14:26:42 2005
+++ ethereal-0.10.12.obsd/epan/dissectors/packet-radius.h	Mon Aug 15 14:32:00 2005
@@ -37,7 +37,7 @@
 struct _radius_attr_info_t {
 	gchar *name;
 	guint code;
-	gboolean encrypt;
+	gboolean rencrypt;
 	gboolean tagged;
 	radius_attr_dissector_t* type;
 	radius_avp_dissector_t* dissector;
diff -ru ethereal-0.10.12/epan/radius_dict.l ethereal-0.10.12.obsd/epan/radius_dict.l
--- ethereal-0.10.12/epan/radius_dict.l	Tue Jul 26 14:26:46 2005
+++ ethereal-0.10.12.obsd/epan/radius_dict.l	Mon Aug 15 14:31:04 2005
@@ -65,7 +65,7 @@
 	static gchar* attr_vendor = NULL;
 	static gchar* vendor_name = NULL;
 	static gchar* value_repr = NULL;
-	static gboolean encrypt = FALSE;
+	static gboolean rencrypt = FALSE;
 	static gboolean has_tag = FALSE;
 	static gchar* current_vendor = NULL;
 	
@@ -97,7 +97,7 @@
 <VENDOR_W_NAME>[0-9]+   { add_vendor(vendor_name,strtol(yytext,NULL,10)); BEGIN OUT; }
 <VENDOR_W_NAME>0x[0-9a-f]+   { add_vendor(vendor_name,strtol(yytext,NULL,16)); BEGIN OUT; }
 
-<ATTR>[0-9a-z_-]+					{ attr_name = g_strdup(yytext); encrypt = FALSE; has_tag = FALSE; BEGIN ATTR_W_NAME; }
+<ATTR>[0-9a-z_-]+					{ attr_name = g_strdup(yytext); rencrypt = FALSE; has_tag = FALSE; BEGIN ATTR_W_NAME; }
 <ATTR_W_NAME>[0-9]+					{ attr_id = g_strdup(yytext);  BEGIN ATTR_W_ID;}
 <ATTR_W_NAME>0x[0-9a-f]+			{ attr_id = g_strdup_printf("%u",(int)strtoul(yytext,NULL,16)); BEGIN ATTR_W_ID;}
 <ATTR_W_ID>integer					{ attr_type = radius_integer;  BEGIN ATTR_W_TYPE; }
@@ -109,11 +109,11 @@
 <ATTR_W_ID>ifid						{ attr_type = radius_ifid;  BEGIN ATTR_W_TYPE; }
 <ATTR_W_ID>[0-9a-z_-]+				{ attr_type = radius_octets;  BEGIN ATTR_W_TYPE; }
 <ATTR_W_TYPE>has_tag[,]?			{ has_tag = TRUE; attr_vendor = NULL;  BEGIN ATTR_W_VENDOR; }
-<ATTR_W_TYPE>encrypt=1[,]?			{ encrypt=TRUE;  attr_vendor = NULL;  BEGIN ATTR_W_VENDOR; }
+<ATTR_W_TYPE>rencrypt=1[,]?			{ rencrypt=TRUE;  attr_vendor = NULL;  BEGIN ATTR_W_VENDOR; }
 <ATTR_W_TYPE>[,0-9a-z_-]+=([^\n]+)	{ /* ignore other parameters */  attr_vendor = NULL;  BEGIN ATTR_W_VENDOR; }
-<ATTR_W_TYPE>[0-9a-z_-]+			{ attr_vendor = g_strdup(yytext);  add_attribute(attr_name,attr_id,attr_type,attr_vendor,encrypt,has_tag); attr_vendor = NULL;  BEGIN OUT; }
-<ATTR_W_TYPE>\n						{ add_attribute(attr_name,attr_id,attr_type,current_vendor ? g_strdup(current_vendor) : NULL ,encrypt,has_tag); linenums[include_stack_ptr]++;  BEGIN OUT; }
-<ATTR_W_VENDOR>\n					{ add_attribute(attr_name,attr_id,attr_type,attr_vendor,encrypt,has_tag); linenums[include_stack_ptr]++; BEGIN OUT; };
+<ATTR_W_TYPE>[0-9a-z_-]+			{ attr_vendor = g_strdup(yytext);  add_attribute(attr_name,attr_id,attr_type,attr_vendor,rencrypt,has_tag); attr_vendor = NULL;  BEGIN OUT; }
+<ATTR_W_TYPE>\n						{ add_attribute(attr_name,attr_id,attr_type,current_vendor ? g_strdup(current_vendor) : NULL ,rencrypt,has_tag); linenums[include_stack_ptr]++;  BEGIN OUT; }
+<ATTR_W_VENDOR>\n					{ add_attribute(attr_name,attr_id,attr_type,attr_vendor,rencrypt,has_tag); linenums[include_stack_ptr]++; BEGIN OUT; };
 
 <VALUE>[0-9a-z-]+					{ attr_name = g_strdup(yytext); BEGIN VALUE_W_ATTR; }
 <VALUE_W_ATTR>[^[:blank:]]+			{ value_repr = g_strdup(yytext); BEGIN VALUE_W_NAME; }
@@ -201,7 +201,7 @@
 	
 	a->name = name;
 	a->code = strtol(code,NULL,10); g_free(code);
-	a->encrypt = crypt;
+	a->rencrypt = crypt;
 	a->tagged =  tagged;
 	a->type = type;
 	a->dissector = NULL;