DatabaseProcApplicationCreatedLinks
sybsystemprocssp_helpmaplogin  31 Aug 14Defects 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 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    
20            /*
21            ** Only a user with sso_role can see external login mappings
22            */
23            if (proc_role("sso_role") < 1)
24                return 1
25    
26            /*
27            ** Check that the auth method is valid. NULL means ANY.
28            ** Avoid selecting 'AUTH_MASK' for the value of 'ANY'.
29            */
30            if (@authmethod is null)
31                select @authmethod = 'ANY'
32    
33            if ((@externname is null) or (@externname = 'ANY'))
34                select @externname = '*'
35    
36            select @authid = low
37            from master.dbo.spt_values
38            where type = 'ua' and name = upper(@authmethod)
39    
40            if @@rowcount = 0
41            begin
42                /*		
43                ** 19257  "The authentication mechanism '%1!' is not valid." 
44                */
45                raiserror 19257, @authmethod
46                return (1)
47            end
48    
49            select @login_class = 20, @attrib = 0
50    
51            select isnull(s.name, "ANY") as authentication,
52                case object_cinfo
53                    when '*' then "ANY"
54                    else object_cinfo
55                end as clientname,
56                case object
57                    when - 2 then "ANY"
58                    when - 3 then "CREATE LOGIN"
59                    else isnull(suser_name(object), "NO MAP")
60                end loginame
61            into #sphelpmap1rs
62            from master.dbo.sysattributes, master.dbo.spt_values s
63            where class = @login_class and attribute = @attrib and
64                (object_info1 = s.low) and (s.name not in ('AUTH_MASK')) and
65                (s.type = 'ua') and
66                (object_cinfo = @externname or @externname = '*') and
67                (object_info1 & @authid) != 0
68            exec sp_autoformat @fulltabname = #sphelpmap1rs,
69                @selectlist = "authentication, 'client name' = clientname, 'login name' = loginame",
70                @orderby = "order by 1,2"
71            drop table #sphelpmap1rs
72            return (0)
73        end
74    


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 68
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
38
 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]
64
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
64
 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 51
 MNER 3 No Error Check should check return value of exec 68
 MUCO 3 Useless Code Useless Begin-End Pair 13
 MUCO 3 Useless Code Useless Brackets 23
 MUCO 3 Useless Code Useless Brackets 30
 MUCO 3 Useless Code Useless Brackets 33
 MUCO 3 Useless Code Useless Brackets 46
 MUCO 3 Useless Code Useless Brackets 72
 QAFM 3 Var Assignment from potentially many rows 36
 QNAJ 3 Not using ANSI Inner Join 62
 QNUA 3 Should use Alias: Column object_cinfo should use alias sysattributes 52
 QNUA 3 Should use Alias: Column object_cinfo should use alias sysattributes 54
 QNUA 3 Should use Alias: Column object should use alias sysattributes 56
 QNUA 3 Should use Alias: Column object should use alias sysattributes 59
 QNUA 3 Should use Alias: Table master..sysattributes 62
 QNUA 3 Should use Alias: Column attribute should use alias sysattributes 63
 QNUA 3 Should use Alias: Column class should use alias sysattributes 63
 QNUA 3 Should use Alias: Column object_info1 should use alias sysattributes 64
 QNUA 3 Should use Alias: Column object_cinfo should use alias sysattributes 66
 QNUA 3 Should use Alias: Column object_info1 should use alias sysattributes 67
 QPNC 3 No column in condition 66
 VUNU 3 Variable is not used @suid 16
 MTR1 2 Metrics: Comments Ratio Comments: 21% 9
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 13 = 13dec - 2exi + 2 9
 MTR3 2 Metrics: Query Complexity Complexity: 36 9
 PRED_QUERY_COLLECTION 2 {a=master..sysattributes, sv=master..spt_values} 0 51

DEPENDENCIES
PROCS AND TABLES USED
writes table tempdb..#sphelpmap1rs (1) 
reads table master..sysattributes (1)  
reads table master..spt_values (1)  
calls proc sybsystemprocs..sp_autoformat  
   reads table tempdb..systypes (1)  
   reads table tempdb..syscolumns (1)  
   reads table master..systypes (1)  
   calls proc sybsystemprocs..sp_namecrack  
   calls proc sybsystemprocs..sp_autoformat  
   read_writes table tempdb..#colinfo_af (1) 
   reads table master..syscolumns (1)