Re: Proposed patch to datacopy to allow passwords to be read from stdin

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAHt6W4ewsKEjNHXorhxYK=K=i5PjnG9fzX4fiYpfUdWRYvCuUQ@mail.gmail.com>
2012/9/11 James K. Lowden <[email protected]>:
> On Mon, 10 Sep 2012 18:19:26 +0100
> Frediano Ziglio <[email protected]> wrote:
>
>> If I remember just using empty username and password will do so just
>> replacing strtok with strsep should work.
>
> strtok(3) is standard and OK to use here.  Command-line parsing isn't
> re-entrant or multithreaded.
>

Well, you could use strtok_r if you just need re-entrancy and
multihreading. However there is another difference between strtok and
strsep. If you try to split a string like "a//b" with "/" with strtok
you get "a", "b" while with strsep you get "a", "", "b". So passing
server/username/password if username and password are empty (something
like "server//") with strsep you get empty username and password (that
is Kerberos!).

Frediano
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.