DatabaseProcApplicationCreatedLinks
sybsystemprocssp_revokelogin  14 déc. 14Defects Propagation Dependencies

1     
2     
3     /* 
4     ** SP_REVOKELOGIN
5     **
6     ** Revokes SQL Server access from a Windows NT-based group or user.
7     **
8     ** Message for "sp_revokelogin"
9     ** 	18070, "Access revoked."
10    */
11    
12    create or replace procedure sp_revokelogin
13        @col1 varchar(60) = NULL
14    as
15    
16        declare @msg varchar(255)
17        declare @nullarg char(1)
18        declare @dummy int
19        declare @status int
20        declare @gp_enabled int
21    
22        /* 
23        ** If granular permissions is not enabled then sso_role is required.
24        ** If granular permissions is enabled then the permission 'manage roles' is
25        ** required.  proc_role and proc_auditperm will also do auditing
26        ** if required. Both will also print error message if required.
27        */
28    
29        select @nullarg = NULL
30        execute @status = sp_aux_checkroleperm "sso_role", "manage roles",
31            @nullarg, @gp_enabled output
32    
33        /* For Auditing */
34        if (@gp_enabled = 0)
35        begin
36            if (proc_role("sso_role") = 0)
37                return (1)
38        end
39        else
40        begin
41            select @dummy = proc_auditperm("manage roles", @status)
42        end
43    
44        if (@status != 0)
45            return (1)
46    
47        dbcc iseadmin("revokelogin", @col1)
48    
49        /* if no error, report success */
50        if @@error = 0
51        begin
52            /*
53            ** 18070, "Access revoked."
54            */
55            exec sp_getmessage 18070, @msg output
56            print @msg
57            return (0)
58        end
59    
60        /* 
61        ** If there was an error, the specific message was already sent to client 
62        ** within the iseadmin() module.
63        */
64    
65        return (1)
66    
67    /* end of sp_revokelogin */
68    


exec sp_procxmode 'sp_revokelogin', 'AnyMode'
go

Grant Execute on sp_revokelogin to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_revokelogin  
 MNER 3 No Error Check should check return value of exec 55
 MUCO 3 Useless Code Useless Brackets 34
 MUCO 3 Useless Code Useless Brackets 36
 MUCO 3 Useless Code Useless Brackets 37
 MUCO 3 Useless Code Useless Brackets 44
 MUCO 3 Useless Code Useless Brackets 45
 MUCO 3 Useless Code Useless Brackets 57
 MUCO 3 Useless Code Useless Brackets 65
 VNRD 3 Variable is not read @dummy 41
 MTR1 2 Metrics: Comments Ratio Comments: 42% 12
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 5dec - 3exi + 2 12
 MTR3 2 Metrics: Query Complexity Complexity: 24 12

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_getmessage  
   reads table master..syslanguages (1)  
   reads table sybsystemprocs..sysusermessages  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..sysmessages (1)  
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..syscurconfigs (1)  
   reads table master..sysconfigures (1)