From: <dg...@su...> - 2009-01-30 15:13:13
|
Author: bellmich Date: Fri Jan 30 16:11:35 2009 New Revision: 909 URL: http://libsyncml.opensync.org/changeset/909 Log: added support for device faking and direct target setting Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Jan 30 16:01:07 2009 (r908) +++ trunk/tools/syncml-ds-tool.c Fri Jan 30 16:11:35 2009 (r909) @@ -97,7 +97,10 @@ * @subsection OPTION_GENERAL General SyncML options * * @param --identifier "<ident>" - * set the identity of the SyncML peer. + * set the local identity of SyncML (source). + * + * @param --target "<ident>" + * set the remote identity of SyncML (target). * * @param --username "<username>" * set the username for authentication. @@ -146,6 +149,20 @@ * @arg @b version can be "1.0", "1.1" or "1.2". * The default version is "1.1". * + * @subsection OPTION_FAKE_DEVICE Device faking options + * + * Some SyncML servers try to enforce access policies via device filtering. + * These options can be used to work around such filters. + * + * @param --fake-manufacturer "<Man>" + * set the manufacturer of the faked device. + * + * @param --fake-model "<Mod>" + * set the model of the faked device. + * + * @param --fake-software-version "<SwV>" + * set the software version of the faked device. + * * @section EXAMPLES * * @subsection EXAMPLE_BLUETOOTH Get the contacts from your phone via Bluetooth @@ -224,6 +241,7 @@ SmlError *error = NULL; char *identifier = NULL; +char *target = NULL; char *username = NULL; char *password = NULL; @@ -792,7 +810,8 @@ fprintf(stderr, "\tGeneral SyncML options:\n"); fprintf(stderr, "\t=======================\n\n"); - fprintf(stderr, "\t--identifier <ident>\tsets the identity of the SyncML peer.\n"); + fprintf(stderr, "\t--identifier <ident>\tsets the local identity of the SyncML (source).\n"); + fprintf(stderr, "\t--target <ident>\tsets the remote identity of SyncML (target).\n"); fprintf(stderr, "\t--username <username>\tsets the username for authentication.\n"); fprintf(stderr, "\t--password <password>\tsets the password for authentication.\n"); fprintf(stderr, "\t--maxMsgSize <limit>\tsets the maximum message size (default: %s)\n", maxMsgSize); @@ -813,7 +832,13 @@ fprintf(stderr, "\t\tNokias for example often requires \"PC Suite\".\n"); fprintf(stderr, "\t\tPlease use --identifier \"PC Suite\" in this case.\n"); fprintf(stderr, "\t<version>\tcan be \"1.0\", \"1.1\" or \"1.2\".\n"); - fprintf(stderr, "\t\tThe default version is \"1.1\".\n"); + fprintf(stderr, "\t\tThe default version is \"1.1\".\n\n"); + + fprintf(stderr, "\tDevice faking configuration:\n"); + fprintf(stderr, "\t============================\n\n"); + fprintf(stderr, "\t--fake-manufacturer <Man>\tset the manufacturer of the faked device.\n"); + fprintf(stderr, "\t--fake-model <Mod>\t\tset the model of the faked device.\n"); + fprintf(stderr, "\t--fake-software-version <SwV>\tset the software version of the faked device.\n"); fprintf(stderr, "\n"); exit (1); @@ -1106,6 +1131,16 @@ argv[i], error)) goto error; identifier = g_strdup(argv[i]); + } else if (!strcmp (arg, "--target")) { + i++; + if (!argv[i]) + usage (argv[0]); + if (!smlDataSyncSetOption( + dsObject, + SML_DATA_SYNC_CONFIG_TARGET, + argv[i], error)) + goto error; + target = g_strdup(argv[i]); } else if (!strcmp (arg, "--username")) { i++; if (!argv[i]) @@ -1244,6 +1279,48 @@ SML_TRANSPORT_CONFIG_SSL_SERVER_CERT, argv[i], error)) goto error; + } else if (!strcmp (arg, "--fake-manufacturer")) { + i++; + if (!argv[i]) + usage (argv[0]); + if (!smlDataSyncSetOption( + dsObject, + SML_DATA_SYNC_CONFIG_FAKE_DEVICE, + "1", error)) + goto error; + if (!smlDataSyncSetOption( + dsObject, + SML_DATA_SYNC_CONFIG_FAKE_MANUFACTURER, + argv[i], error)) + goto error; + } else if (!strcmp (arg, "--fake-model")) { + i++; + if (!argv[i]) + usage (argv[0]); + if (!smlDataSyncSetOption( + dsObject, + SML_DATA_SYNC_CONFIG_FAKE_DEVICE, + "1", error)) + goto error; + if (!smlDataSyncSetOption( + dsObject, + SML_DATA_SYNC_CONFIG_FAKE_MODEL, + argv[i], error)) + goto error; + } else if (!strcmp (arg, "--fake-software-version")) { + i++; + if (!argv[i]) + usage (argv[0]); + if (!smlDataSyncSetOption( + dsObject, + SML_DATA_SYNC_CONFIG_FAKE_DEVICE, + "1", error)) + goto error; + if (!smlDataSyncSetOption( + dsObject, + SML_DATA_SYNC_CONFIG_FAKE_SOFTWARE_VERSION, + argv[i], error)) + goto error; } else if (!strcmp (arg, "--")) { break; } else { @@ -1349,7 +1426,8 @@ printf("unknown\n"); break; } - printf("Identifier: %s\n", identifier); + printf("Identifier (Source): %s \n", identifier); + printf("Target: %s\n", target); printf("\nDatastores:\n"); int i = 0; for (i = 0; i < smlDevInfNumDataStores(remoteDevinf); i++) { |