changeset 199:75eebb3b0592

2003-6-24 Brian Masney <masneyb@gftp.org> * lib/config_file.c lib/gftp.h lib/protocols.c - added backend for overriding options on a per bookmark basis. Also added gftp_copy_local_options() to config_file.c * lib/gftp.h lib/misc.c src/gtk/bookmarks.c - added gftp_free_bookmark() to misc.c. It was taken from the function free_bookmark_entry_items() in bookmarks.c * lib/sslcommon.c - formatting fixes. Added thread functions (mostly from the OReilly SSL book)
author masneyb
date Wed, 25 Jun 2003 01:53:45 +0000
parents 8fea1b1a2ec6
children 27ae88b5a55e
files ChangeLog lib/config_file.c lib/gftp.h lib/misc.c lib/protocols.c lib/sslcommon.c src/gtk/bookmarks.c
diffstat 7 files changed, 285 insertions(+), 150 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jun 23 01:07:05 2003 +0000
+++ b/ChangeLog	Wed Jun 25 01:53:45 2003 +0000
@@ -1,3 +1,15 @@
+2003-6-24 Brian Masney <masneyb@gftp.org>
+	* lib/config_file.c lib/gftp.h lib/protocols.c - added backend for 
+	overriding options on a per bookmark basis. Also added 
+	gftp_copy_local_options() to config_file.c
+
+	* lib/gftp.h lib/misc.c src/gtk/bookmarks.c - added
+	gftp_free_bookmark() to misc.c. It was taken from the function
+	free_bookmark_entry_items() in bookmarks.c
+
+	* lib/sslcommon.c - formatting fixes. Added thread functions (mostly 
+	from the OReilly SSL book)
+
 2003-6-22 Brian Masney <masneyb@gftp.org>
 	* lib/config_file.c lib/gftp.h - renamed parse_args to 
 	gftp_config_parse_args() and removed the static declaration
@@ -1070,7 +1082,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.98 2003/06/23 01:07:04 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.99 2003/06/25 01:53:44 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/config_file.c	Mon Jun 23 01:07:05 2003 +0000
+++ b/lib/config_file.c	Wed Jun 25 01:53:45 2003 +0000
@@ -109,6 +109,7 @@
 gftp_read_bookmarks (char *global_data_path)
 {
   char *tempstr, *temp1str, buf[255], *curpos;
+  gftp_config_vars * global_entry;
   gftp_bookmarks_var * newentry;
   FILE *bmfile;
   size_t len;
@@ -213,16 +214,47 @@
 	    g_free (newentry->acct);
 	  newentry->acct = g_strdup (curpos);
 	}
-      else if (strncmp (buf, "sftpserv_path", 13) == 0 && newentry)
+      else if (*buf == '#' || *buf == '\0')
+        continue;
+      else
         {
-          curpos = buf + 14;
-          if (newentry->sftpserv_path)
-            g_free (newentry->sftpserv_path);
-          newentry->sftpserv_path = g_strdup (curpos);
+          if ((curpos = strchr (buf, '=')) == NULL)
+            continue;
+          *curpos = '\0';
+
+          if ((global_entry = g_hash_table_lookup (gftp_global_options_htable,
+                                                   buf)) == NULL ||
+               gftp_option_types[global_entry->otype].read_function == NULL)
+            {
+	      printf (_("gFTP Warning: Skipping line %d in bookmarks file: %s\n"),
+                      line, buf);
+              continue;
+            }
+
+          if (newentry->local_options_hash == NULL)
+            newentry->local_options_hash = g_hash_table_new (string_hash_function,
+                                                             string_hash_compare);
+
+          newentry->num_local_options_vars++;
+          newentry->local_options_vars = g_realloc (newentry->local_options_vars,
+                                                    sizeof (gftp_config_vars) * newentry->num_local_options_vars);
+
+          memcpy (&newentry->local_options_vars[newentry->num_local_options_vars - 1], global_entry, 
+                  sizeof (newentry->local_options_vars[newentry->num_local_options_vars - 1]));
+
+          newentry->local_options_vars[newentry->num_local_options_vars - 1].flags &= ~GFTP_CVARS_FLAGS_DYNMEM;
+          newentry->local_options_vars[newentry->num_local_options_vars - 1].value = NULL;
+
+          if (gftp_option_types[global_entry->otype].read_function (curpos + 1,
+                                &newentry->local_options_vars[newentry->num_local_options_vars - 1], line) != 0)
+            {
+	      printf (_("gFTP Warning: Skipping line %d in bookmarks file: %s\n"),
+                      line, buf);
+              continue;
+            }
+
+          g_hash_table_insert (newentry->local_options_hash, newentry->local_options_vars[newentry->num_local_options_vars - 1].key, &newentry->local_options_vars[newentry->num_local_options_vars - 1]);
         }
-      else if (*buf != '#' && *buf != '\0')
-	printf (_("gFTP Warning: Skipping line %d in bookmarks file: %s\n"),
-		line, buf);
     }
 }
 
@@ -632,6 +664,7 @@
   gftp_bookmarks_var * tempentry;
   char *bmhdr, *tempstr;
   FILE * bmfile;
+  int i;
 
   bmhdr = N_("Bookmarks file for gFTP. Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org>. Warning: Any comments that you add to this file WILL be overwritten");
 
@@ -677,8 +710,15 @@
 	       || tempentry->pass == NULL ? "" : tempentry->pass,
 	       tempentry->acct == NULL ? "" : tempentry->acct);
 
-      if (tempentry->sftpserv_path)
-        fprintf (bmfile, "sftpserv_path=%s\n", tempentry->sftpserv_path);
+      if (tempentry->local_options_vars != NULL)
+        {
+          for (i=0; i<tempentry->num_local_options_vars; i++)
+            {
+              fprintf (bmfile, "%s=", tempentry->local_options_vars[i].key);
+              gftp_option_types[tempentry->local_options_vars[i].otype].write_function (&tempentry->local_options_vars[i], bmfile, 1);
+              fprintf (bmfile, "\n");
+            }
+        }
 
       fprintf (bmfile, "\n");
  
@@ -1115,14 +1155,12 @@
       
       request->num_local_options_vars++;
       request->local_options_vars = g_realloc (request->local_options_vars, 
-                                               sizeof (gftp_config_vars) * (request->num_local_options_vars + 1));
+                                               sizeof (gftp_config_vars) * request->num_local_options_vars);
 
       memcpy (&request->local_options_vars[request->num_local_options_vars - 1],
               tmpconfigvar, sizeof (*tmpconfigvar));
       memcpy (&request->local_options_vars[request->num_local_options_vars - 1].value, &value, sizeof (value));
 
-      memset (&request->local_options_vars[request->num_local_options_vars].value, 0, sizeof (value));
-
       g_hash_table_insert (request->local_options_hash, request->local_options_vars[request->num_local_options_vars - 1].key, &request->local_options_vars[request->num_local_options_vars - 1]);
     }
 }
@@ -1135,3 +1173,35 @@
   gftp_setup_global_options (config_vars);
 }
 
+
+void
+gftp_copy_local_options (gftp_config_vars ** new_options_vars, 
+                         GHashTable ** new_options_hash,
+                         gftp_config_vars * orig_options,
+                         int num_local_options_vars)
+{
+  int i;
+
+  if (orig_options == NULL || num_local_options_vars == 0)
+    {
+      *new_options_vars = NULL;
+      *new_options_hash = NULL;
+      return;
+    }
+
+  *new_options_hash = g_hash_table_new (string_hash_function,
+                                        string_hash_compare);
+
+  *new_options_vars = g_malloc (sizeof (gftp_config_vars) * num_local_options_vars);
+  memcpy (*new_options_vars, orig_options,
+          sizeof (gftp_config_vars) * num_local_options_vars);
+
+  for (i=0; i<num_local_options_vars; i++)
+    {
+      g_hash_table_insert (*new_options_hash, (*new_options_vars)[i].key,
+                           &(*new_options_vars)[i]);
+
+      /* FIXME - copy option values */
+    }
+}
+
--- a/lib/gftp.h	Mon Jun 23 01:07:05 2003 +0000
+++ b/lib/gftp.h	Wed Jun 25 01:53:45 2003 +0000
@@ -516,8 +516,9 @@
                      *next; 	/* The next sibling of this node */
   gpointer cnode; 
 
-  /* Site options */
-  char *sftpserv_path;		/* Path to the sftp server */
+  gftp_config_vars * local_options_vars;
+  int num_local_options_vars;
+  GHashTable * local_options_hash;
 };
 
 
@@ -661,9 +662,6 @@
 
 void free_tdata 			( gftp_transfer * tdata );
 
-void gftp_copy_local_options 		( gftp_request * dest, 
-					  gftp_request * source );
-
 gftp_request * copy_request 		( gftp_request * req,
 					  int copy_local_options );
 
@@ -679,6 +677,13 @@
 
 char * base64_encode 			( char *str );
 
+void gftp_free_bookmark 		( gftp_bookmarks_var * entry );
+
+void gftp_copy_local_options 		( gftp_config_vars ** new_options_vars, 
+					  GHashTable ** new_options_hash,
+					  gftp_config_vars * orig_options,
+					  int num_local_options_vars );
+
 /* protocols.c */
 #define GFTP_FTP_NUM				0
 #define GFTP_HTTP_NUM				1
--- a/lib/misc.c	Mon Jun 23 01:07:05 2003 +0000
+++ b/lib/misc.c	Wed Jun 25 01:53:45 2003 +0000
@@ -549,37 +549,6 @@
 }
 
 
-void
-gftp_copy_local_options (gftp_request * dest, gftp_request * source)
-{
-  int i;
-
-  if (source->local_options_vars == NULL)
-    {
-      dest->local_options_vars = NULL;
-      dest->num_local_options_vars = 0;
-      dest->local_options_hash = NULL;
-      return;
-    }
-
-  dest->local_options_hash = g_hash_table_new (string_hash_function,
-                                               string_hash_compare);
-
-  for (i=0; source->local_options_vars[i].key != NULL; i++);
-
-  dest->local_options_vars = g_malloc (sizeof (gftp_config_vars) * (i + 1));
-  memcpy (dest, source, sizeof (gftp_config_vars) * (i + 1));
-  dest->num_local_options_vars = i;
-
-  for (i=0; dest->local_options_vars[i].key != NULL; i++)
-    {
-      g_hash_table_insert (dest->local_options_hash, 
-                           dest->local_options_vars[i].key,
-                           &dest->local_options_vars[i]);
-    }
-}
-
-
 gftp_request * 
 copy_request (gftp_request * req, int copy_local_options)
 {
@@ -604,7 +573,10 @@
   newreq->hostp = req->hostp;
 
   if (copy_local_options)
-    gftp_copy_local_options (newreq, req);
+    gftp_copy_local_options (&newreq->local_options_vars, 
+                             &newreq->local_options_hash,
+                             req->local_options_vars,
+                             req->num_local_options_vars);
 
   if (req->init (newreq) < 0)
     {
@@ -1043,3 +1015,34 @@
   return (newstr);
 }
 
+
+void
+gftp_free_bookmark (gftp_bookmarks_var * entry)
+{
+  if (entry->hostname)
+    g_free (entry->hostname);
+  if (entry->remote_dir)
+    g_free (entry->remote_dir);
+  if (entry->local_dir)
+    g_free (entry->local_dir);
+  if (entry->user)
+    g_free (entry->user);
+  if (entry->pass)
+    g_free (entry->pass);
+  if (entry->acct)
+    g_free (entry->acct);
+  if (entry->protocol)
+    g_free (entry->protocol);
+
+  if (entry->local_options_vars != NULL)
+    {
+      g_free (entry->local_options_vars);
+      entry->local_options_vars = NULL;
+
+      entry->num_local_options_vars = 0;
+
+      g_hash_table_destroy (entry->local_options_hash);
+      entry->local_options_hash = NULL;
+    }
+}
+
--- a/lib/protocols.c	Mon Jun 23 01:07:05 2003 +0000
+++ b/lib/protocols.c	Wed Jun 25 01:53:45 2003 +0000
@@ -534,6 +534,11 @@
         i = GFTP_FTP_NUM;
     }
 
+  gftp_copy_local_options (&request->local_options_vars,
+                           &request->local_options_hash,
+                           tempentry->local_options_vars,
+                           tempentry->num_local_options_vars);
+
   if ((init_ret = gftp_protocols[i].init (request)) < 0)
     {
       gftp_request_destroy (request, 0);
--- a/lib/sslcommon.c	Mon Jun 23 01:07:05 2003 +0000
+++ b/lib/sslcommon.c	Wed Jun 25 01:53:45 2003 +0000
@@ -42,9 +42,15 @@
   {NULL, NULL, 0, NULL, NULL, 0, NULL, 0, NULL}
 };  
 
+static GMutex ** gftp_ssl_mutexes = NULL;
+static volatile int gftp_ssl_initialized = 0;
 static SSL_CTX * ctx = NULL;
 
-static volatile int gftp_ssl_initialized = 0;
+struct CRYPTO_dynlock_value
+{ 
+  GMutex * mutex;
+};
+
 
 void
 ssl_register_module (void)
@@ -71,7 +77,6 @@
 }
 
 
-
 static int 
 gftp_ssl_verify_callback (int ok, X509_STORE_CTX *store)
 {
@@ -126,62 +131,136 @@
  
           if (strcmp (extstr, "subjectAltName") == 0)
             {
-    unsigned char  *data;
-    STACK_OF(CONF_VALUE) *val;
-    CONF_VALUE   *nval;
-    X509V3_EXT_METHOD *meth;
-    void     *ext_str = NULL;
+              unsigned char  *data;
+              STACK_OF(CONF_VALUE) *val;
+              CONF_VALUE   *nval;
+              X509V3_EXT_METHOD *meth;
+              void *ext_str = NULL;
  
-    if (!(meth = X509V3_EXT_get(ext)))
-     break;
-    data = ext->value->data;
+              if (!(meth = X509V3_EXT_get (ext)))
+                break;
+
+              data = ext->value->data;
 
 #if (OPENSSL_VERSION_NUMBER > 0x00907000L)
-    if (meth->it)
-     ext_str = ASN1_item_d2i(NULL, &data, ext->value->length,
-           ASN1_ITEM_ptr(meth->it));
-    else
-     ext_str = meth->d2i(NULL, &data, ext->value->length);
+              if (meth->it)
+                ext_str = ASN1_item_d2i (NULL, &data, ext->value->length,
+                                        ASN1_ITEM_ptr (meth->it));
+              else
+                ext_str = meth->d2i (NULL, &data, ext->value->length);
 #else
-    ext_str = meth->d2i(NULL, &data, ext->value->length);
+              ext_str = meth->d2i(NULL, &data, ext->value->length);
 #endif
-    val = meth->i2v(meth, ext_str, NULL);
-    for (j = 0; j < sk_CONF_VALUE_num(val); j++)
-    {
-     nval = sk_CONF_VALUE_value(val, j);
-     if (strcmp(nval->name, "DNS") == 0 && strcmp(nval->value, request->hostname) == 0)
-     {
-      ok = 1;
-      break;
-     }
+              val = meth->i2v(meth, ext_str, NULL);
+
+              for (j = 0; j < sk_CONF_VALUE_num(val); j++)
+                {
+                  nval = sk_CONF_VALUE_value (val, j);
+                  if (strcmp (nval->name, "DNS") == 0 && 
+                      strcmp (nval->value, request->hostname) == 0)
+                    {
+                      ok = 1;
+                      break;
+                    }
+                }
+            }
+
+          if (ok)
+            break;
+        }
     }
-   }
-   if (ok)
-    break;
-  }
- }
  
-/* FIXME
- if (!ok && (subj = X509_get_subject_name (cert)) &&
-     X509_NAME_get_text_by_NID (subj, NID_commonName, data, 256) > 0)
-   {
-     data[sizeof (data) - 1] = '\0';
-     if (strcasecmp (data, request->hostname) != 0)
-       {
-         request->logging_function (gftp_logging_error, request,
-                                    _("The SSL certificate's host %s does not match the host %s that we connected to\n"),
-                                    data, request->hostname);
-         X509_free (cert);
-         return (X509_V_ERR_APPLICATION_VERIFICATION);
-       }
-   }
-*/
+  if (!ok && (subj = X509_get_subject_name (cert)) &&
+      X509_NAME_get_text_by_NID (subj, NID_commonName, data, 256) > 0)
+    {
+      data[sizeof (data) - 1] = '\0';
+      if (strcasecmp (data, request->hostname) != 0)
+        {
+          request->logging_function (gftp_logging_error, request,
+                                     _("ERROR: The host in the SSL certificate (%s) does not match the host that we connected to (%s). Aborting connection.\n"),
+                                     data, request->hostname);
+          X509_free (cert);
+          return (X509_V_ERR_APPLICATION_VERIFICATION);
+        }
+    }
  
   X509_free (cert);
+
   return (SSL_get_verify_result(request->ssl));
 }
 
 
+static void
+_gftp_ssl_locking_function (int mode, int n, const char * file, int line)
+{
+  if (mode & CRYPTO_LOCK)
+    g_mutex_lock (gftp_ssl_mutexes[n]);
+  else
+    g_mutex_unlock (gftp_ssl_mutexes[n]);
+}
+
+
+static unsigned long
+_gftp_ssl_id_function (void)
+{ 
+#if GLIB_MAJOR_VERSION > 1
+  return ((unsigned long) g_thread_self ());
+#else
+  /* FIXME _ call pthread version */
+  return (0);
+#endif
+} 
+
+
+static struct CRYPTO_dynlock_value *
+_gftp_ssl_create_dyn_mutex (const char *file, int line)
+{ 
+  struct CRYPTO_dynlock_value *value;
+
+  value = g_malloc (sizeof (*value));
+  value->mutex = g_mutex_new ();
+  return (value);
+}
+
+
+static void
+_gftp_ssl_dyn_mutex_lock (int mode, struct CRYPTO_dynlock_value *l,
+                          const char *file, int line)
+{
+  if (mode & CRYPTO_LOCK)
+    g_mutex_lock (l->mutex);
+  else
+    g_mutex_unlock (l->mutex);
+}
+
+
+static void
+_gftp_ssl_destroy_dyn_mutex (struct CRYPTO_dynlock_value *l,
+                             const char *file, int line)
+{
+  g_mutex_free (l->mutex);
+  g_free (l);
+}
+
+
+static void
+_gftp_ssl_thread_setup (void)
+{
+  int i;
+
+  gftp_ssl_mutexes = g_malloc (CRYPTO_num_locks( ) * sizeof (*gftp_ssl_mutexes));
+
+  for (i = 0; i < CRYPTO_num_locks ( ); i++)
+    gftp_ssl_mutexes[i] = g_mutex_new ();
+
+  CRYPTO_set_id_callback (_gftp_ssl_id_function);
+  CRYPTO_set_locking_callback (_gftp_ssl_locking_function);
+  CRYPTO_set_dynlock_create_callback (_gftp_ssl_create_dyn_mutex);
+  CRYPTO_set_dynlock_lock_callback (_gftp_ssl_dyn_mutex_lock);
+  CRYPTO_set_dynlock_destroy_callback (_gftp_ssl_destroy_dyn_mutex);
+} 
+
+
 int
 gftp_ssl_startup (gftp_request * request)
 {
@@ -193,7 +272,9 @@
 
   gftp_ssl_initialized = 1;
 
-  /* FIXME _ thread setup */
+  if (g_thread_supported ())
+    _gftp_ssl_thread_setup ();
+
   if (!SSL_library_init ())
     {
       request->logging_function (gftp_logging_error, request,
@@ -246,7 +327,10 @@
       return (GFTP_EFATAL);
     }
 
-  if (gftp_fd_set_sockblocking (request, request->datafd, 0) < 0) /* FIXME */
+  /* FIXME - take this out. I need to find out how to do timeouts with the SSL
+     functions (a select() or poll() like function) */
+
+  if (gftp_fd_set_sockblocking (request, request->datafd, 0) < 0)
     {
       gftp_disconnect (request);
       return (GFTP_ERETRYABLE);
@@ -276,9 +360,10 @@
 
   if ((ret = gftp_ssl_post_connection_check (request)) != X509_V_OK)
     {
-      request->logging_function (gftp_logging_error, request,
-                                 _("Error with peer certificate: %s\n"),
-                                 X509_verify_cert_error_string (ret));
+      if (ret != X509_V_ERR_APPLICATION_VERIFICATION)
+        request->logging_function (gftp_logging_error, request,
+                                   _("Error with peer certificate: %s\n"),
+                                   X509_verify_cert_error_string (ret));
       return (GFTP_EFATAL);
     }
 
@@ -311,7 +396,6 @@
       if ((ret = SSL_read (request->ssl, ptr, size)) < 0)
         { 
           err = SSL_get_error (request->ssl, ret);
-           printf ("error is %d\n", err);
           if (errno == EINTR)
             {
               if (request != NULL && request->cancel)
--- a/src/gtk/bookmarks.c	Mon Jun 23 01:07:05 2003 +0000
+++ b/src/gtk/bookmarks.c	Wed Jun 25 01:53:45 2003 +0000
@@ -22,7 +22,7 @@
 
 static GtkWidget * bm_hostedit, * bm_portedit, * bm_localdiredit,
   * bm_remotediredit, * bm_useredit, * bm_passedit, * bm_acctedit, * anon_chk,
-  * bm_pathedit, * bm_protocol, * tree, *bm_sftppath;
+  * bm_pathedit, * bm_protocol, * tree;
 static GHashTable * new_bookmarks_htable;
 static gftp_bookmarks_var * new_bookmarks;
 static GtkItemFactory * edit_factory;
@@ -176,26 +176,6 @@
 }
 
 
-static void
-free_bookmark_entry_items (gftp_bookmarks_var * entry)
-{
-  if (entry->hostname)
-    g_free (entry->hostname);
-  if (entry->remote_dir)
-    g_free (entry->remote_dir);
-  if (entry->local_dir)
-    g_free (entry->local_dir);
-  if (entry->user)
-    g_free (entry->user);
-  if (entry->pass)
-    g_free (entry->pass);
-  if (entry->acct)
-    g_free (entry->acct);
-  if (entry->protocol)
-    g_free (entry->protocol);
-}
-
-
 static gftp_bookmarks_var *
 copy_bookmarks (gftp_bookmarks_var * bookmarks)
 {
@@ -303,7 +283,7 @@
 	  g_free (tempstr);
 	}
 
-      free_bookmark_entry_items (tempentry);
+      gftp_free_bookmark (tempentry);
 
       if (tempentry->children != NULL)
 	tempentry = tempentry->children;
@@ -378,7 +358,7 @@
   tempentry = new_bookmarks;
   while (tempentry != NULL)
     {
-      free_bookmark_entry_items (tempentry);
+      gftp_free_bookmark (tempentry);
       g_free (tempentry->path);
 
       if (tempentry->children != NULL)
@@ -534,18 +514,7 @@
   tempentry = entry;
   while (tempentry != NULL)
     {
-      if (tempentry->path)
-	g_free (tempentry->path);
-      if (tempentry->hostname)
-	g_free (tempentry->hostname);
-      if (tempentry->remote_dir)
-	g_free (tempentry->remote_dir);
-      if (tempentry->user)
-	g_free (tempentry->user);
-      if (tempentry->pass)
-	g_free (tempentry->pass);
-      if (tempentry->sftpserv_path)
-        g_free (tempentry->sftpserv_path);
+      gftp_free_bookmark (tempentry);
 
       if (tempentry->children != NULL)
 	{
@@ -989,19 +958,6 @@
     gtk_entry_set_text (GTK_ENTRY (bm_localdiredit), entry->local_dir);
   gtk_widget_show (bm_localdiredit);
 
-  tempwid = gtk_label_new (_("Remote SSH sftp path:"));
-  gtk_misc_set_alignment (GTK_MISC (tempwid), 1, 0.5);
-  gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 1, 6, 7);
-  gtk_widget_show (tempwid);
-
-  bm_sftppath = gtk_entry_new ();
-  gtk_table_attach_defaults (GTK_TABLE (table), bm_sftppath, 1, 2, 6, 7);
-  if (entry->isfolder)
-    gtk_widget_set_sensitive (bm_sftppath, 0);
-  else if (entry->sftpserv_path)
-    gtk_entry_set_text (GTK_ENTRY (bm_sftppath), entry->sftpserv_path);
-  gtk_widget_show (bm_sftppath);
-
   tempwid = gtk_hseparator_new ();
   gtk_table_attach_defaults (GTK_TABLE (table), tempwid, 0, 2, 7, 8);
   gtk_widget_show (tempwid);