Bug 476644 - Delete User can fail due to lack of constrained table delete.
Delete User can fail due to lack of constrained table delete.
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server (Show other bugs)
520
All Linux
low Severity medium
: ---
: ---
Assigned To: Michael Mráka
John Matthews
:
Depends On:
Blocks: 456985 473996
  Show dependency treegraph
 
Reported: 2008-12-16 07:46 EST by Martin Poole
Modified: 2010-10-23 02:36 EDT (History)
2 users (show)

See Also:
Fixed In Version: sat530
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-10 16:31:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test sql script (454 bytes, application/octet-stream)
2009-01-27 12:51 EST, John Matthews
no flags Details

  None (edit)
Description Martin Poole 2008-12-16 07:46:15 EST
Description of problem:

the database delete_user routine does not clear out any records in the rhnAppInstallSession table that are owned by the user being deleted.

As this table has a constraint on the rhnUser table the attempt to delete the user fails (and without a useful message)


simply adding the following to the delete_user routine would seem to suffice

  delete from rhnAppInstallSession where user_id = user_id_in;
Comment 1 Michael Mráka 2008-12-17 08:11:11 EST
Not able to reproduce.
Please fill in steps to reproduce, thanks.
Comment 2 Martin Poole 2008-12-17 08:18:54 EST
Do not know how to reproduce this since I'm not aware what exactly creates these records in the first place.

Despite this it should be obvious that ANY user constrained table which does not have a corresponding delete in the delete_user routine is a bug.
Comment 3 Michael Mráka 2008-12-18 06:59:05 EST
Fixed in Spacewalk repo
commit ffe35e6e6f6e73c5b9f7b23655e9c836f718cb8d
    Automatic commit of package [spacewalk-schema] release [0.4.10-1].
commit 4c0e2f44c939fd2d10fcb2720f9b7e2c97079bd7
    476644 - added rhn_org.pkb to schema upgrade
commit ab81083d01f0b96df3fc20d2a21b8cf7fa103f02
    476644 - added delete from rhnAppInstallSession
Comment 4 Michael Mráka 2008-12-18 07:05:45 EST
Steps to reproduce:
1. Create user aaaaaa via webUI
2. connect to database and create new record in rhnAppInstallSession:
SQL>  insert into rhnAppInstallInstance values (99999, to_char(sysdate), to_char(sysdate), to_char(sysdate), sysdate, sysdate);
SQL> insert into rhnserver values (999999, 1, 'a', 1000, 'a', 'a', null, null, null, 'a', null, 'N','N', null, 0, null, null, sysdate,sysdate);
SQL> insert into rhnAppInstallSession (select RHN_APPINST_SESSION_ID_SEQ.nextval, 99999, null, null, null, id, 999999, sysdate, sysdate from web_contact where login = 'aaaaaa');
SQL>  commit;
3. delete aaaaaa user via webUI

Actual results:
ISE, error messages in /var/log/tomcat5/catalina.out:
java.sql.SQLException: ORA-20255: (cannot_delete_user) - The specified user may not be deleted.
ORA-06512: at "SPACEWALK.RHN_EXCEPTION", line 23
ORA-06512: at "SPACEWALK.RHN_ORG", line 184
ORA-06512: at line 2

Expected results:
user deleted withou errors
Comment 5 John Matthews 2009-01-09 14:39:35 EST
Maybe the change didn't make it into the 12/23 ISO?


Followed reproducer in comment #4
Using ISO: Satellite-5.3.0-RHEL5-re20081223.1-i386-embedded-oracle.iso
 satellite-schema-5.3.2-2.el5


2009-01-09 14:22:13,500 [TP-Processor2] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/rhn].[action] - Servlet.service() for servlet action threw exception
java.sql.SQLException: ORA-20255: (cannot_delete_user) - The specified user may not be deleted.
ORA-06512: at "RHNSAT.RHN_EXCEPTION", line 23
ORA-06512: at "RHNSAT.RHN_ORG", line 184
ORA-06512: at line 2

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
Comment 6 Michael Mráka 2009-01-10 10:46:37 EST
Yes, satellite-schema-5.3.2-2.el5 is based on spacewalk-schema-0.4.9-1.
Comment 8 Michael Mráka 2009-01-22 09:22:38 EST
Please retry with Satellite-5.3.0-RHEL5-re20090119.1.
Comment 12 Brandon Perkins 2009-09-10 16:31:24 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html

Note You need to log in before you can comment on or make changes to this bug.