From: <svn...@op...> - 2009-09-25 19:44:56
|
Author: paule Date: Fri Sep 25 21:44:39 2009 New Revision: 5852 URL: http://www.opensync.org/changeset/5852 Log: opie-sync: remove the password configuration option, and instead generate it randomly on first sync and store it in the main sink's state db. (From the Opie side this was never meant to be something the user can configure, and users usually (mistakenly) end up using their actual root password which is not really desirable.) Modified: plugins/opie-sync/README plugins/opie-sync/src/opie-sync plugins/opie-sync/src/opie_sync.c Modified: plugins/opie-sync/README ============================================================================== --- plugins/opie-sync/README Fri Sep 25 21:36:03 2009 (r5851) +++ plugins/opie-sync/README Fri Sep 25 21:44:39 2009 (r5852) @@ -53,13 +53,6 @@ Username User name to log into the device as (default root). - Password - Password to log into the device with (default Qtopia). Note that this is - the synchronisation password and _not_ the actual password for the user. - Note: in current versions of Opie this password must begin with "Qtopia" - or "rootme" and the two characters after that are ignored. This will be - fixed in later versions. - Advanced Options The "advanced options" specific to opie-sync are as follows: @@ -127,8 +120,7 @@ Make sure you have set the security options properly on the Opie side - go to Settings->Security->Sync and set the "Accept sync from network" option to an appropriate value for your network setup. You should also check the - username and password set in the configuration for the plugin. See the notes - under the "Password" option above. + username set in the configuration for the plugin (should usually be "root"). Syncing freezes at a particular point Modified: plugins/opie-sync/src/opie-sync ============================================================================== --- plugins/opie-sync/src/opie-sync Fri Sep 25 21:36:03 2009 (r5851) +++ plugins/opie-sync/src/opie-sync Fri Sep 25 21:44:39 2009 (r5852) @@ -39,7 +39,6 @@ </AdvancedOptions> <Authentication> <Username>root</Username> - <Password>Qtopia</Password> </Authentication> <Connection> <Network> Modified: plugins/opie-sync/src/opie_sync.c ============================================================================== --- plugins/opie-sync/src/opie_sync.c Fri Sep 25 21:36:03 2009 (r5851) +++ plugins/opie-sync/src/opie_sync.c Fri Sep 25 21:44:39 2009 (r5852) @@ -49,7 +49,6 @@ /* Set defaults */ env->username = g_strdup("root"); - env->password = g_strdup("Qtopia"); env->host = g_strdup("192.168.0.202"); env->device_type = OPIE_SYNC_OPIE; env->conn_type = OPIE_CONN_FTP; @@ -84,11 +83,6 @@ g_free(env->username); env->username = g_strdup(username); } - const char *password = osync_plugin_authentication_get_password(auth); - if(password) { - g_free(env->password); - env->password = g_strdup(password); - } } OSyncList *advoptions = osync_plugin_config_get_advancedoptions(config); @@ -253,7 +247,26 @@ OSyncError *error = NULL; g_mutex_lock(env->plugin_env->plugin_mutex); - + + /* Get the sync key (password) + We generate this ourselves rather than allowing the user to set it - + that's how it's supposed to be done */ + OSyncSinkStateDB *state_db = osync_objtype_sink_get_state_db(sink); + char *key = osync_sink_state_get(state_db, "sync_key", &error); + if(!key) { + g_mutex_unlock(env->plugin_env->plugin_mutex); + goto error; + } + g_free(env->plugin_env->password); + if(strlen(key) == 0) { + g_free(key); + key = osync_rand_str(10, &error); + env->plugin_env->password = g_strdup_printf("QtopiaXX%s", key); + } + else + env->plugin_env->password = g_strdup(key); + osync_free(key); + if(!env->plugin_env->connected) { /* We only want to connect once per session */ |