freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
RE: [freetds] dblib question - handling bad login name/password from auser
- From: "Lowden, James K" <LowdenJK AT bernstein.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] dblib question - handling bad login name/password from auser
- Date: Mon, 26 Apr 2004 13:23:36 -0400
> From: Andy Cranston [mailto:a.cranston AT selwaymoore.com]
> Sent: April 26, 2004 11:59 AM
>
> However I'd like to write my own handlers. The main reason
> being to catch
> an invalid login attempt via:
>
> dbproc = dbopen(login, DEFAULT_SERVER);
>
> Instead of the program bombing out I'd like to be able to gracefully
> reprompt for another username and password.
>
> Am I right in thinking I need to amend the handler routines
> to do this? If
> so any suggestions on a "clean" way to do this.
Andy,
You might want to check simply that you got a non-null dbproc. There are
several possible causes for not being able to log in (user error being only
the most common with a working setup). Passing the message to the user
(using your handler) will at least provide the information to the person who
needs it, whether or not it's understood. ;-)
The simplest way in general to pass information from the handler to the main
code is through a global variable. In a threaded environment, that
translates to thread local storage or a per-thread map. When you call a
db-lib function that causes the library or the server to emit a message or
error, you are assured that your handler will be invoked before the function
returns. The sequence is always
call dbsomething
[a bad thing happens]
handler invoked
dbsomething returns
IOW, you never have to worry about a race condition. Or, at any rate,
behavior in exception to my description would be considered a bug. I don't
believe I've seen that written down anywhere, but I can't think of any
exceptions.
--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.
If you, as the intended recipient of this message, the purpose of which is to
inform and update our clients, prospects and consultants of developments
relating to our services and products, would not like to receive further
e-mail correspondence from the sender, please "reply" to the sender
indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New York,
NY 10105.
- RE: [freetds] dblib question - handling bad login name/password from auser, Lowden, James K, 04/26/2004
Archive powered by MHonArc 2.6.24.