Matching /etc/coldsync/palms entries

7 views
Skip to first unread message

lukasz_mp

unread,
Dec 31, 2008, 6:56:05 AM12/31/08
to ColdSync Hackers
Hello,
as my new message to this group I'd like to suggest a new feature.
I my environment, where many palms synchronize with one host, the
Tungsten E2 devices do not provide valid serial numbers over USB and
'netsync' connection. To bypass this malfunction I do not provide
these in /etc/coldsync/palms file. So sample entry looks like:

|ET|15228|palm3

But i'd like to store these somewhere along with the same information
as in 'palms' file.
My suggestion is to add an option to config file to skip
identification by serial number.
Afterthat, in runmode.c the line
palment = lookup_palment(palm, PMATCH_EXACT);
could be changed (according to config option) to
palment = lookup_palment(palm, PMATCH_USERNAME | PMATCH_USERID);
which is (for me) sufficient, as there is no information from device
about it's Serial Number.

Please let me know how to do this best way.

Regars,

Lukasz

Alessandro Zummo

unread,
Jan 1, 2009, 12:02:22 PM1/1/09
to coldsync...@googlegroups.com, lukasz...@gmail.com
On Wed, 31 Dec 2008 03:56:05 -0800 (PST)
lukasz_mp <lukasz...@gmail.com> wrote:

> |ET|15228|palm3
>
> But i'd like to store these somewhere along with the same information
> as in 'palms' file.
> My suggestion is to add an option to config file to skip
> identification by serial number.
> Afterthat, in runmode.c the line
> palment = lookup_palment(palm, PMATCH_EXACT);
> could be changed (according to config option) to
> palment = lookup_palment(palm, PMATCH_USERNAME | PMATCH_USERID);
> which is (for me) sufficient, as there is no information from device
> about it's Serial Number.

Hi Lucasz,

that's perfectly doable ad works as long as you do trust all of you users.
we probably need a match-criteria option in daemon mode to allow
the user to choice its preferred style.

the serial number of the eventual sd memory card could be taken
in account too.

are you willing to work on that?

--

Best regards,

Alessandro Zummo,
Tower Technologies - Torino, Italy

http://www.towertech.it

lukasz_mp

unread,
Feb 3, 2009, 3:41:37 AM2/3/09
to ColdSync Hackers

Hello,

I'm a beginner in developing, so this may be not a valid diff file,
please give me a try :)
There is one extra change in backup.c, in my environment without the
change coldsync hangs during identification.
P.S. How to attach a file in this newsgroup? I've made copy-paste, it
may contain errors.

-------------------------------------

diff -u -r coldsync/src/backup.c coldsync-ex_ignoresn/src/backup.c
--- coldsync/src/backup.c 2009-01-02 11:56:54.000000000 +0100
+++ coldsync-ex_ignoresn/src/backup.c 2009-02-03 09:30:03.000000000
+0100
@@ -606,7 +606,7 @@
fprintf(stderr, "Wrote \"%s\" to \"%s\"\n",
dbinfo->name, bakfname);

- err = DlpCloseDB(pconn, dbh, 0);
+/* lk - for me should be without closing err = DlpCloseDB(pconn, dbh,
0); */
free_pdb(pdb);
close(bakfd);
va_add_to_log(pconn, "%s %s - %s\n",
diff -u -r coldsync/src/coldsync.h coldsync-ex_ignoresn/src/coldsync.h
--- coldsync/src/coldsync.h 2009-01-02 11:56:54.000000000 +0100
+++ coldsync-ex_ignoresn/src/coldsync.h 2009-02-03 09:30:39.000000000
+0100
@@ -333,6 +333,9 @@
* Palm has no internal serial
number
* (m125, Zire71)
*/
+ Bool3 ignore_serial_number; /* lk: If true, coldsync
will ignore first field in /etc/coldsync/palms file
+ and disable Serial Number
verification.
+ */
/* XXX - Perhaps allow "final" here, so that the
sysadmin
* can lock options in place.
*/
diff -u -r coldsync/src/conduit.c coldsync-ex_ignoresn/src/conduit.c
--- coldsync/src/conduit.c 2009-01-02 11:56:54.000000000 +0100
+++ coldsync-ex_ignoresn/src/conduit.c 2009-02-03 09:31:37.000000000
+0100
@@ -1123,6 +1123,13 @@
/* See if there is anything pending on 'fromchild' */
while (1)
{
+ /* lk: without these code it hangs on identification */
+ if (fromchild == NULL) {
+ CONDUIT_TRACE(5)
+ fprintf(stderr, "LK in abort, fromchild is NULL
\n");
+ break;
+ }
+ /* lk end */
err = poll_fd(fileno(fromchild), False);

if (err < 0)
@@ -1182,7 +1189,7 @@
* databases.
*/

- DlpCloseDB(palm_pconn(palm), DLPCMD_CLOSEALLDBS, 0);
+/* lk - tak jest w dzialajacym DlpCloseDB(palm_pconn(palm),
DLPCMD_CLOSEALLDBS, 0); */

close(spcpipe[0]);
close(spcpipe[1]);
diff -u -r coldsync/src/config.c coldsync-ex_ignoresn/src/config.c
--- coldsync/src/config.c 2009-01-02 11:56:54.000000000 +0100
+++ coldsync-ex_ignoresn/src/config.c 2009-02-03 09:47:52.000000000
+0100
@@ -383,6 +383,8 @@
*
for the last options, so they default to
*
False here.
*/
+ sync_config->options.ignore_serial_number = False; /* lk mod
*/
+

/* Add a default conduit to the head of the queue, equivalent
* to:
diff -u -r coldsync/src/lexer.l coldsync-ex_ignoresn/src/lexer.l
--- coldsync/src/lexer.l 2009-01-02 11:56:54.000000000 +0100
+++ coldsync-ex_ignoresn/src/lexer.l 2009-01-02 12:00:17.000000000
+0100
@@ -197,6 +197,7 @@
"Chosen" { KEYWORD(SAVED); }
"Heathen" { KEYWORD(UNSAVED); }
"use_card_serial" { KEYWORD(USE_CARD_SERIAL); }
+"ignore_sn" { KEYWORD(IGNORE_SN); }

/* Boolean values */
[Tt]"rue" { KEYWORD(TRUE); }
diff -u -r coldsync/src/parser.y coldsync-ex_ignoresn/src/parser.y
--- coldsync/src/parser.y 2009-01-02 11:56:54.000000000 +0100
+++ coldsync-ex_ignoresn/src/parser.y 2009-02-03 09:32:32.000000000
+0100
@@ -101,6 +101,7 @@
%token TYPE
%token UNSAVED
%token USE_CARD_SERIAL
+%token IGNORE_SN

%token SERIAL
%token USB
@@ -975,6 +976,14 @@
fprintf(stderr, "Option: use_card_serial.\n");
file_config->options.use_card_serial = True3;
}
+ /* lk */
+ | IGNORE_SN ';'
+ {
+ PARSE_TRACE(3)
+ fprintf(stderr, "Ignore Serial Number in palms
file when authenticating device on net protocol.\n");
+ file_config->options.ignore_serial_number = True3;
+ }
+ /* lk end */
| HOSTID colon NUMBER semicolon
{
PARSE_TRACE(3)
diff -u -r coldsync/src/runmode.c coldsync-ex_ignoresn/src/runmode.c
--- coldsync/src/runmode.c 2009-01-02 11:56:54.000000000 +0100
+++ coldsync-ex_ignoresn/src/runmode.c 2009-01-02 15:05:12.000000000
+0100
@@ -838,7 +838,19 @@
/* XXX - Figure out exactly what the search criteria should be
*/
/* XXX - If userid is 0, abort? */

- palment = lookup_palment(palm, PMATCH_EXACT);
+ SYNC_TRACE(3)
+ fprintf(stderr, "\nlk: sync_config-
>options.ignore_serial_number %i \n", sync_config-
>options.ignore_serial_number );
+ if (sync_config->options.ignore_serial_number) {
+ /* lk modification: ignore SN field in palms file */
+ palment = lookup_palment(palm, PMATCH_USERNAME |
PMATCH_USERID);
+ }
+ else {
+ /* old way */
+ palment = lookup_palment(palm, PMATCH_EXACT);
+ }
+
+
+

if (palment == NULL)
{

edo

unread,
Feb 7, 2009, 6:34:02 PM2/7/09
to ColdSync Hackers
On 1 янв, 20:02, Alessandro Zummo <alessandro.zu...@towertech.it>
wrote:
>  Hi Lucasz,
>
>   that's perfectly doable ad works as long as you do trust all of you users.
>  we probably need a match-criteria option in daemon mode to allow
>  the user to choice its preferred style.
>
>   the serial number of the eventual sd memory card could be taken
>  in account too.

i have worknig solution - if SN cannot be detected, then small
programm is installed.

this program try to get serial number from ROM (or generate random
serial for devices w/o SN) and write this number to table.
later coldsync read SN from this table.

anyone need this code?

i do use coldsync with some other patches and can submit it too. but
palmos is dead now :(

lukasz_mp

unread,
Feb 12, 2009, 3:07:40 AM2/12/09
to ColdSync Hackers


On Feb 8, 12:34 am, edo <edo....@gmail.com> wrote:
>
> i have worknig solution - if SN cannot be detected, then small
> programm is installed.
On the server side?

> this program try to get serial number from ROM (or generate random
> serial for devices w/o SN) and write this number to table.
> later coldsync read SN from this table.
>
> anyone need this code?
Let's have a look at it.

Lukasz

edo

unread,
Feb 15, 2009, 5:17:44 PM2/15/09
to ColdSync Hackers
On 12 фев, 11:07, lukasz_mp <lukasz.bu...@gmail.com> wrote:
> On Feb 8, 12:34 am, edo <edo....@gmail.com> wrote:
>
> > i have worknig solution - if SN cannot be detected, then small
> > programm is installed.
>
> On the server side?

coldsync install program to palm.

> > this program try to get serial number from ROM (or generate random
> > serial for devices w/o SN) and write this number to table.
> > later coldsync read SN from this table.
>
> > anyone need this code?
>
> Let's have a look at it.

ok, but i need some time
Reply all
Reply to author
Forward
0 new messages