This file is indexed.

/usr/share/cricket/util/LeanODBC/LeanODBC.xs is in cricket 1.0.5-20.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "stripsql.h"

static int
not_here(char *s)
{
    croak("%s not implemented on this architecture", s);
    return -1;
}

static double
constant(char *name, int arg)
{
    errno = 0;
    switch (*name) {
    case 'A':
	break;
    case 'B':
	break;
    case 'C':
	break;
    case 'D':
	break;
    case 'E':
	break;
    case 'F':
	break;
    case 'G':
	break;
    case 'H':
	break;
    case 'I':
	break;
    case 'J':
	break;
    case 'K':
	break;
    case 'L':
	break;
    case 'M':
	break;
    case 'N':
	break;
    case 'O':
	break;
    case 'P':
	break;
    case 'Q':
	break;
    case 'R':
	break;
    case 'S':
	if (strEQ(name, "SQL_ERROR"))
#ifdef SQL_ERROR
	    return SQL_ERROR;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_HANDLE_DBC"))
#ifdef SQL_HANDLE_DBC
	    return SQL_HANDLE_DBC;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_HANDLE_DESC"))
#ifdef SQL_HANDLE_DESC
	    return SQL_HANDLE_DESC;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_HANDLE_ENV"))
#ifdef SQL_HANDLE_ENV
	    return SQL_HANDLE_ENV;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_HANDLE_STMT"))
#ifdef SQL_HANDLE_STMT
	    return SQL_HANDLE_STMT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_INVALID_HANDLE"))
#ifdef SQL_INVALID_HANDLE
	    return SQL_INVALID_HANDLE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_NO_DATA"))
#ifdef SQL_NO_DATA
	    return SQL_NO_DATA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_NO_DATA_FOUND"))
#ifdef SQL_NO_DATA_FOUND
	    return SQL_NO_DATA_FOUND;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_NTS"))
#ifdef SQL_NTS
	    return SQL_NTS;
#else
	    goto not_there;
#endif
if (strEQ(name, "SQL_NULL_DATA"))
#ifdef SQL_NULL_DATA
	    return SQL_NULL_DATA;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_NULL_HANDLE"))
#ifdef SQL_NULL_HANDLE
	    return SQL_NULL_HANDLE;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_NULL_HDBC"))
#ifdef SQL_NULL_HDBC
	    return SQL_NULL_HDBC;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_NULL_HDESC"))
#ifdef SQL_NULL_HDESC
	    return SQL_NULL_HDESC;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_NULL_HENV"))
#ifdef SQL_NULL_HENV
	    return SQL_NULL_HENV;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_NULL_HSTMT"))
#ifdef SQL_NULL_HSTMT
	    return SQL_NULL_HSTMT;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_SUCCESS"))
#ifdef SQL_SUCCESS
	    return SQL_SUCCESS;
#else
	    goto not_there;
#endif
	if (strEQ(name, "SQL_SUCCESS_WITH_INFO"))
#ifdef SQL_SUCCESS_WITH_INFO
	    return SQL_SUCCESS_WITH_INFO;
#else
	    goto not_there;
#endif
	break;
    case 'T':
	break;
    case 'U':
	break;
    case 'V':
	break;
    case 'W':
	break;
    case 'X':
	break;
    case 'Y':
	break;
    case 'Z':
	break;
    }
    errno = EINVAL;
    return 0;

not_there:
    errno = ENOENT;
    return 0;
}


MODULE = LeanODBC		PACKAGE = LeanODBC		


double
constant(name,arg)
	char *		name
	int		arg

short   
SQLAllocHandle(HandleType, InputHandle)
	short HandleType
	void* InputHandle
	PREINIT:
	void* OutputHandle;
	short rc;
	PPCODE:
	rc = SQLAllocHandle(HandleType,InputHandle,&OutputHandle);
	if (rc == SQL_SUCCESS && HandleType == SQL_HANDLE_ENV) {
	   SQLSetEnvAttr(OutputHandle,SQL_ATTR_ODBC_VERSION,(void*)SQL_OV_ODBC3,NULL);
	}
	EXTEND(SP, 2);
	PUSHs(sv_2mortal(newSViv(rc)));
	PUSHs(sv_2mortal(newSViv((long) OutputHandle)));

short    
SQLFreeHandle(HandleType, Handle)
	short	HandleType
	void*	Handle

short
SQLDisconnect(ConnectionHandle)
        void* ConnectionHandle

short
SQLGetDiagRec(HandleType, Handle, RecNumber)
	short HandleType 
	void* Handle
	short RecNumber 
	PREINIT:
	char sqlState[6];
        long NativeError;
	char MessageText[1024];
	short TextLength, rc;
	PPCODE:
	rc = SQLGetDiagRec(HandleType,Handle,RecNumber,
                (unsigned char*)sqlState,&NativeError,
		(unsigned char*)MessageText,1024,&TextLength);
	EXTEND(SP,5);
	PUSHs(sv_2mortal(newSViv(rc)));
	PUSHs(sv_2mortal(newSVpv(sqlState,5)));
	PUSHs(sv_2mortal(newSViv(NativeError)));
	PUSHs(sv_2mortal(newSVpv(MessageText,TextLength)));
	PUSHs(sv_2mortal(newSViv(TextLength)));

short
SQLDriverConnect(hdbc,szConnectStrIn,cbConnectStrIn)
	void*         hdbc
	char*	      szConnectStrIn
	short         cbConnectStrIn
	PREINIT:
	short cbConnStrOut;
	char szConnectStrOut[1024];
	short rc;
	PPCODE:
	rc = SQLDriverConnect(hdbc,NULL,
           (unsigned char*)szConnectStrIn, cbConnectStrIn,
	   (unsigned char*)szConnectStrOut,
           1024,&cbConnStrOut,SQL_DRIVER_NOPROMPT);
	EXTEND(SP,3);
	PUSHs(sv_2mortal(newSViv(rc)));
	PUSHs(sv_2mortal(newSVpv(szConnectStrOut,cbConnStrOut)));
	PUSHs(sv_2mortal(newSViv(cbConnStrOut)));           

short
SQLExecDirect(StatementHandle, StatementText, TextLength)
	void* StatementHandle
	unsigned char* StatementText 
	long TextLength

short   
SQLFetch(StatementHandle)
	void* StatementHandle

short   
SQLNumResultCols(StatementHandle)
	void* StatementHandle
	PREINIT:
	short ColumnCount, rc;
	PPCODE:
	rc = SQLNumResultCols(StatementHandle, &ColumnCount);
	EXTEND(SP,2);
	PUSHs(sv_2mortal(newSViv(rc)));
	PUSHs(sv_2mortal(newSViv(ColumnCount)));

short    
SQLGetData(StatementHandle, ColumnNumber)
	void* StatementHandle
	unsigned short ColumnNumber
	PREINIT:
	char TargetValue[1024] = "dummy";
	long StrLen_or_Ind, rc;
	PPCODE:
	rc = SQLGetData(StatementHandle,ColumnNumber,SQL_C_CHAR,
           (SQLPOINTER) TargetValue,1024,&StrLen_or_Ind);
	EXTEND(SP,3);
	PUSHs(sv_2mortal(newSViv(rc)));
	if (StrLen_or_Ind > 0) {
	   PUSHs(sv_2mortal(newSVpv(TargetValue,StrLen_or_Ind)));
	} else {
           TargetValue[0] = '\0';       
	   PUSHs(sv_2mortal(newSVpv(TargetValue,0)));
	}
	PUSHs(sv_2mortal(newSViv(StrLen_or_Ind)));

short   
SQLCloseCursor(StatementHandle)
	void* StatementHandle

short
SQLConnect(StatementHandle,ServerName,UserName,Authentication)
        void* StatementHandle
        unsigned char* ServerName
        unsigned char* UserName
        unsigned char* Authentication
        CODE:
        RETVAL = SQLConnect(StatementHandle, ServerName, SQL_NTS,
                 UserName, SQL_NTS, Authentication, SQL_NTS);
        OUTPUT:
        RETVAL