import_running = FALSE;
}
+static void
+pgui_sanitize_connection_string(char *connection_string)
+{
+ char *ptr = strstr(connection_string, "password");
+ if ( ptr )
+ {
+ ptr += 9;
+ while( *ptr != ' ' && *ptr != '\0' )
+ {
+ *ptr = '*';
+ ptr++;
+ }
+ }
+ return;
+}
+
static void
pgui_action_connection_test(GtkWidget *widget, gpointer data)
{
char *connection_string = NULL;
char *connection_sanitized = NULL;
- char *ptr = NULL;
if ( ! (connection_string = pgui_read_connection()) )
{
return;
}
- /* Clean the password out of the string before we display it. */
connection_sanitized = strdup(connection_string);
- ptr = strstr(connection_sanitized, "password");
- if ( ptr )
- {
- ptr += 9;
- while( *ptr != ' ' && *ptr != '\0' )
- {
- *ptr = '*';
- ptr++;
- }
- }
+ pgui_sanitize_connection_string(connection_string);
pgui_logf("Connecting: %s", connection_sanitized);
free(connection_sanitized);
pgui_action_import(GtkWidget *widget, gpointer data)
{
char *connection_string = NULL;
+ char *connection_sanitized = NULL;
char *dest_string = NULL;
int ret, i = 0;
char *header, *footer, *record;
}
/* Log what we know so far */
- pgui_logf("Connection: %s", connection_string);
+ connection_sanitized = strdup(connection_string);
+ pgui_sanitize_connection_string(connection_sanitized);
+ pgui_logf("Connection: %s", connection_sanitized);
pgui_logf("Destination: %s.%s", config->schema, config->table);
pgui_logf("Source File: %s", config->shp_file);
+ free(connection_sanitized);
/* Connect to the database. */
if ( pg_connection ) PQfinish(pg_connection);