Subject | Re: [IB-Java] Direct Client and authentication |
---|---|
Author | David Jencks |
Post date | 2001-12-03T15:09:42Z |
It looks like my programming sins are catching up to me;-) After I got it
to work for me I kind of forgot about this little bit of code;-(((
to work for me I kind of forgot about this little bit of code;-(((
On 2001.12.03 03:20:20 -0500 "Goedhart, Andrew" wrote:
> Had a look at the configuration XML script posted in the jboss
> documentation
> as a sample for configuring the dirver
> It has the following attributes:
>
> <attribute name="PrincipalMappingProperties">UserName=sysdba
> Password=masterkey</attribute>
>
> However this don't seem to work. When tryig it on windows 2000 at home I
> get
> Invalid user name and password
>
> Had a deeper loook at the source code of org.firebirdsql.jgds.gds_impl
> where
> the connection to the database is being made and the the GDSException
> thrown
>
>
> As far as I can tell the method responsible for actually making the
> connection is the following bit of code in the private method connect.
>
>
>
> //Here we identify the user to the engine. This may or may
> not
> be used
> //as login info to a database.
> String user = System.getProperty("user.name");
> if (debug) {System.out.println("user.name: " + user);}
> String host = InetAddress.getLocalHost().getHostName();
>
> byte[] user_id = new byte[200];
> int n = 0;
> user_id[n++] = 1; // CNCT_user
> user_id[n++] = (byte) user.length();
> System.arraycopy(user.getBytes(), 0, user_id, n,
> user.length());
> n += user.length();
>
> /* String passwd = "masterkey";
> user_id[n++] = 2; // CNCT_passwd
> user_id[n++] = (byte) passwd.length();
> System.arraycopy(passwd.getBytes(), 0, user_id, n,
> passwd.length());
> n += passwd.length();*/
>
> user_id[n++] = 4; // CNCT_host
> user_id[n++] = (byte) host.length();
> System.arraycopy(host.getBytes(), 0, user_id, n,
> host.length());
> n += host.length();
> //user_id[n++] = 6; // CNCT_user_verification
> //user_id[n++] = 0;
>
>
>
> It seems the driver is ignoring the entries in the configuration file and
> using system.getProperty("user.name"). A hard coded password of masterkey
> has been commented out.
This part of the code is only to establish a connection to the server.
Logging into the db happens in this code in isc_attach_database
DbAttachInfo dbai = new DbAttachInfo(file_name);
connect(db, dbai);
try {
if (debug) {System.out.print("op_attach ");}
db.out.writeInt(op_attach);
db.out.writeInt(0); //
packet->p_atch->p_atch_database
db.out.writeString(dbai.getFileName());
db.out.writeTyped(isc_dpb_version1, (Xdrable)c);
The Clumplet c has all the connection parameters including user name and
password from the connector configuration. So, when you are attaching to a
db, the user and password you set in firebirdsql-service.xml are being
used. The problem comes before this when you are connecting to the server.
As I recall I tried using the user +- password that you are trying to log
on with and it didn't work on linux. Maybe that is what is required for
windows, though.
My understanding of how this works is extremely murky at best, and
nonexistent for windows. If you can figure out what works that would be
wonderful. I guess we may need some platform specific code??? I hope not.
>
>
> Is there any version of the file somewhere (David this is where you
> hopefully say yes ;-) or do I have to try and get my mind around security
> in
> the murkey world of Connectors :-(.
>
> if I do do a fix how do i get it into CVS, I don't have any access other
> then via the Html web interface. I ftp'd the files one at a time. Do I
> post
> it here and hope that some one will put it into CVS for me ?
Posting a patch here, sending it to me directly, or putting it in the
sourceforge tracker are all good possibilities. I take it you haven't got
a win - cvs combo working? Is there anything I could send to make this
easier?
>
> By the way has anyone got any pointers as to where I could find the
> properties and extract the that where set in the configuration file. (I
> suppose thats where the work lies, oh well )
They are very close, in the Clumplet. The question I have is what is
expected in the initial connect message on windows.
>
> Hope to hear from someone. I don't want to do uneccessary work but as the
> authentication stands, the dirver cannot be used under Windows. Under
> linux
> where the database deferes authentication to the operating systemyes, but
> connectiong from windows no.
I'm definitely confused about the functions of the user in the initial
connection and the user + password in the op_attach or op_create calls.
I'm not sure how much is being authenticated by the os and how much is
using firebird authentication.
Hoping you can figure this out;-))
david jencks
>
> Andrew
>
> (A developer from Sunny South Africa)
>
>
>
> To unsubscribe from this group, send an email to:
> IB-Java-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>