Problem: How to allow users to change their own passwords in InterBase Version: IB 5 Solution: The information in this article applies to: * InterBase v5.x Step 1: Connect to ISC4 and grant update to public on the USERS table Step 2: Create a before update trigger to ensure that users are only changing their own information Step 3: In your application use the following code: ========================================= implementation {$R *.DFM} uses IBHeader, IBExternals; procedure TForm1.Button1Click(Sender: TObject); var Sec_data: TUserSecData; IBLibrary: THandle; isc_modify_user: Tisc_modify_user; StatusVec: array[0..20] of ISC_STATUS; begin { Clear out the structure } FillChar (Sec_data, sizeof (Sec_Data), 0); {Setup the flags. Since I am using TCPIP, I need to set sec_server_spec } Sec_data.sec_flags := (sec_password_spec or sec_server_spec); Sec_data.protocol := sec_protocol_tcpip; { Add the servername, password, and username } Sec_data.server := 'localhost'; Sec_data.password := 'abcde'; Sec_data.user_name := 'test_user'; try { Load the client library } IBLibrary := LoadLibrary ('gds32.dll'); try { Lookup the address of the function } isc_modify_user := GetProcAddress (IBLibrary, 'isc_modify_user'); { Call isc_modify_user with the proper parameters } isc_modify_user (@StatusVec, @Sec_data); { Check for errors } if StatusVec[1] <> 0 then Raise Exception.Create('Password not modified') else ShowMessage ('Password Updated'); except on E: Exception do ShowMessage (E.Message); end; finally FreeLibrary (IBLibrary); end; end; =========================================
Last Modified: 27-OCT-00