DatabaseProcApplicationCreatedLinks
sybsystemprocssp_helpmaplogin  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
3     
4     /*
5     ** Messages for "sp_helpmaplogin"    
6     **
7     ** 19257  "The authentication mechanism '%1!' is not valid." 
8     */
9     create or replace procedure sp_helpmaplogin
10        @authmethod varchar(255) = null, /* Authentication mechanism */
11        @externname varchar(255) = null /* user's remote name */
12    as
13        begin
14    
15            declare @authid int,
16                @suid int,
17                @login_class smallint,
18                @attrib smallint,
19                @nullarg char(1),
20                @dummy int,
21                @status int,
22                @gp_enabled int
23    
24    
25            /* 
26            ** If granular permissions is not enabled then sso_role is required.
27            ** If granular permissions is enabled then the permission 
28            ** 'manage any login' is required.  proc_role and proc_auditperm will 
29            ** also do auditing if required. Both will also print error message if required.
30            */
31    
32            select @nullarg = NULL
33            execute @status = sp_aux_checkroleperm "sso_role", "manage any login",
34                @nullarg, @gp_enabled output
35    
36            /* For Auditing */
37            if (@gp_enabled = 0)
38            begin
39                if (proc_role("sso_role") = 0)
40                    return (1)
41            end
42            else
43            begin
44                select @dummy = proc_auditperm("manage any login", @status)
45            end
46    
47            if (@status != 0)
48                return (1)
49            /*
50            ** Check that the auth method is valid. NULL means ANY.
51            ** Avoid selecting 'AUTH_MASK' for the value of 'ANY'.
52            */
53            if (@authmethod is null)
54                select @authmethod = 'ANY'
55    
56            if ((@externname is null) or (@externname = 'ANY'))
57                select @externname = '*'
58    
59            select @authid = low
60            from master.dbo.spt_values
61            where type = 'ua' and name = upper(@authmethod)
62    
63            if @@rowcount = 0
64            begin
65                /*		
66                ** 19257  "The authentication mechanism '%1!' is not valid." 
67                */
68                raiserror 19257, @authmethod
69                return (1)
70            end
71    
72            select @login_class = 20, @attrib = 0
73    
74            select isnull(s.name, "ANY") as authentication,
75                case object_cinfo
76                    when '*' then "ANY"
77                    else object_cinfo
78                end as clientname,
79                case object
80                    when - 2 then "ANY"
81                    when - 3 then "CREATE LOGIN"
82                    else isnull(suser_name(object), "NO MAP")
83                end loginame
84            into #sphelpmap1rs
85            from master.dbo.sysattributes, master.dbo.spt_values s
86            where class = @login_class and attribute = @attrib and
87                (object_info1 = s.low) and (s.name not in ('AUTH_MASK')) and
88                (s.type = 'ua') and
89                (object_cinfo = @externname or @externname = '*') and
90                (object_info1 & @authid) != 0
91            exec sp_autoformat @fulltabname = #sphelpmap1rs,
92                @selectlist = "authentication, 'client name' = clientname, 'login name' = loginame",
93                @orderby = "order by 1,2"
94            drop table #sphelpmap1rs
95            return (0)
96        end
97    


exec sp_procxmode 'sp_helpmaplogin', 'AnyMode'
go

Grant Execute on sp_helpmaplogin to public
go
DEFECTS
 MINU 4 Unique Index with nullable columns master..sysattributes master..sysattributes
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 91
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
61
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use JOIN Candidate index: sysattributes.csysattributes unique clustered
(class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo)
Intersection: {object_info1}
Uncovered: [object_type, object, object_info2, object_info3]
87
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
87
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 MGTP 3 Grant to public master..spt_values  
 MGTP 3 Grant to public master..sysattributes  
 MGTP 3 Grant to public sybsystemprocs..sp_helpmaplogin  
 MNER 3 No Error Check should check @@error after select into 74
 MNER 3 No Error Check should check return value of exec 91
 MUCO 3 Useless Code Useless Begin-End Pair 13
 MUCO 3 Useless Code Useless Brackets 37
 MUCO 3 Useless Code Useless Brackets 39
 MUCO 3 Useless Code Useless Brackets 40
 MUCO 3 Useless Code Useless Brackets 47
 MUCO 3 Useless Code Useless Brackets 48
 MUCO 3 Useless Code Useless Brackets 53
 MUCO 3 Useless Code Useless Brackets 56
 MUCO 3 Useless Code Useless Brackets 69
 MUCO 3 Useless Code Useless Brackets 95
 QAFM 3 Var Assignment from potentially many rows 59
 QNAJ 3 Not using ANSI Inner Join 85
 QNUA 3 Should use Alias: Column object_cinfo should use alias sysattributes 75
 QNUA 3 Should use Alias: Column object_cinfo should use alias sysattributes 77
 QNUA 3 Should use Alias: Column object should use alias sysattributes 79
 QNUA 3 Should use Alias: Column object should use alias sysattributes 82
 QNUA 3 Should use Alias: Table master..sysattributes 85
 QNUA 3 Should use Alias: Column attribute should use alias sysattributes 86
 QNUA 3 Should use Alias: Column class should use alias sysattributes 86
 QNUA 3 Should use Alias: Column object_info1 should use alias sysattributes 87
 QNUA 3 Should use Alias: Column object_cinfo should use alias sysattributes 89
 QNUA 3 Should use Alias: Column object_info1 should use alias sysattributes 90
 QPNC 3 No column in condition 89
 VNRD 3 Variable is not read @dummy 44
 VUNU 3 Variable is not used @suid 16
 MTR1 2 Metrics: Comments Ratio Comments: 26% 9
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 15 = 16dec - 3exi + 2 9
 MTR3 2 Metrics: Query Complexity Complexity: 44 9
 PRED_QUERY_COLLECTION 2 {a=master..sysattributes, sv=master..spt_values} 0 74

DEPENDENCIES
PROCS AND TABLES USED
reads table master..sysattributes (1)  
writes table tempdb..#sphelpmap1rs (1) 
reads table master..spt_values (1)  
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..sysconfigures (1)  
   reads table master..syscurconfigs (1)  
calls proc sybsystemprocs..sp_autoformat  
   writes table sybsystemprocs..sp_autoformat_rset_002 
   reads table tempdb..systypes (1)  
   reads table master..systypes (1)  
   calls proc sybsystemprocs..sp_autoformat  
   writes table sybsystemprocs..sp_autoformat_rset_003 
   reads table tempdb..syscolumns (1)  
   writes table sybsystemprocs..sp_autoformat_rset_001 
   reads table master..syscolumns (1)  
   writes table sybsystemprocs..sp_autoformat_rset_004 
   calls proc sybsystemprocs..sp_namecrack  
   writes table sybsystemprocs..sp_autoformat_rset_005 
   read_writes table tempdb..#colinfo_af (1)