DatabaseProcApplicationCreatedLinks
sybsystemprocssp_grantlogin  14 déc. 14Defects Propagation Dependencies

1     
2     /* 
3     ** SP_GRANTLOGIN
4     **
5     ** Grants SQL Server access to a Windows NT-based group or user.
6     **
7     ** Message for "sp_grantlogin"
8     ** 	18069, "Access granted."
9     */
10    
11    create or replace procedure sp_grantlogin
12        @account varchar(30) = NULL,
13        @privileges varchar(255) = 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("grantlogin", @account, @privileges)
48    
49        /* if no error, reported success */
50        if @@error = 0
51        begin
52            /*
53            ** 18069, "Access granted."
54            */
55            exec sp_getmessage 18069, @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_grantlogin */
68    


exec sp_procxmode 'sp_grantlogin', 'AnyMode'
go

Grant Execute on sp_grantlogin to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_grantlogin  
 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% 11
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 5dec - 3exi + 2 11
 MTR3 2 Metrics: Query Complexity Complexity: 24 11

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..syscurconfigs (1)  
   reads table master..sysconfigures (1)  
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)