Re: Change UNIX password from Windows
Posted in 1996
Chao Y. Din <cdin@csc.com> Emailed me the following and asked me to post it since he's having trouble with his newsreader. My beef with this approach is the same as my previous followup: it requires the user to enter a password each time an app is run. I'm contemplating a variation of this that stores the password encrypted on a network drive (with the encryption done by the app, not Setnet). > Derrek, > > I was trying to answer your post through the news group; However, our > news group is down AGAIN. I will try to post the following response to > the news group later. > > All your 3 approaches are based upon the assumption that setnet cannot > be bypassed, which is not true. As I said previously, you cannot bypass > setnet under Powerbuilder 3, but it is possible under Powerbuilder 4. I > believe you are not using Powerbuilder 3 anyway. > > In our production environment, we delete informix.ini and setnet > icon/program for security reasons. Users must go through our > applications in order to access the database. > > Bypassing setnet for Powerbuilder 4 is not difficult. You need to > populate transaction object with required information which includes > user name, database name, server name, password, ... etc. You can > design a login screen to collect the information and then populate the > transaction object. > > In addition to the above information, you need two more pieces of > information: service and dbms The service part is not implemented in > Powerbuilder 3. That is the reason you cannot drop setnet for > Powerbuilder 3. > > The attached code is long. It has man more functions than just login. > However, the concept is simple. > > Chao > > ======================================================== > This is the ini file read by the u_ini_file object. The TIME=... part > is not necessary. > ======================================================== > [DATABASE] > DBMS=IN5 - I-Net v5.x > DBPARM="DISABLEBIND=1,INET_SERVICE='online7',TIME=' ""HH:MM"" '" > [INPUT] > database=input > server=input1 > > ======================================================== > This is the application script, which calls a user object to get > information defined in a window ini file. The content of the ini file > is listed above. > ======================================================== > integer li_logincount , li_errorcode > BOOLEAN lb_result > string ls_returned > > gs_app_name = THIS.appname > iu_ini_file = CREATE u_ini_file > IF (iu_ini_file.ufb_ini_init("ODIRMS", SQLCA )) THEN > OPEN(w_login) > IF Message.StringParm = "FAILED" THEN > HALT CLOSE > ELSE > EXECUTE IMMEDIATE "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED"; > gs_server_name = Trim(gs_server_name) > gs_current_user_id = sqlca.userid > OPEN(w_main) > w_main.title="Input Subsystem (Server " + gs_server_name + ")" > END IF > ELSE > HALT Close > END IF > > > ======================================================== > This is part of the u_ini_file object that populate the transaction > object. As you can see, > ======================================================== > at_dbtransaction.DBMS = > ProfileString(ss_app_ini,"DATABASE","dbms","") > at_dbtransaction.database = > ProfileString(ss_app_ini,gs_app_name,"database","") > //at_dbtransaction.userid = > ProfileString(ss_app_ini,"DATABASE","userid","") > //at_dbtransaction.dbpass = > ProfileString(ss_app_ini,"DATABASE","dbpass","") > //at_dbtransaction.logid = > ProfileString(ss_app_ini,"DATABASE","logid","") > //at_dbtransaction.logpass = > ProfileString(ss_app_ini,"DATABASE","logpass","") > at_dbtransaction.servername = > ProfileString(ss_app_ini,gs_app_name,"server","") > at_dbtransaction.dbparm = > ProfileString(ss_app_ini,"DATABASE","dbparm","") > RETURN(TRUE) > > ======================================================== > This is the script for the OK button of w_login screen. > ======================================================== > string ls_password > u_security lu_security > boolean lb_expired > boolean lb_multiple_connections > > SetPointer(HourGlass!) > ls_password = TRIM(sle_user_id.text) > > ii_login_attempts = ii_login_attempts + 1 > > SQLCA.userid = TRIM(sle_user_id.text) > SQLCA.dbpass = TRIM(sle_password.text) > > CONNECT USING SQLCA; > > IF SQLCA.SQLCODE = 0 THEN > COMMIT USING SQLCA; > // Handle the application security here > SetPointer (Arrow!) > > IF lb_expired = TRUE THEN > CloseWithReturn (parent, "FAILED") > ELSE > CloseWithReturn (parent, "SUCCESS") > END IF > > ELSE > // Display login error message > ROLLBACK USING SQLCA; > sle_password.SelectText(1,Len(sle_password.text)) > sle_password.SetFocus() > IF ii_login_attempts = 3 THEN > MessageBox ("Sorry!", "Login failed", STOPSIGN!) > CloseWithReturn (Parent, "FAILED") > END IF > END IF -- --- - Derrek (dirk@xmission.com)