Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
77f27d5e
Commit
77f27d5e
authored
Oct 15, 2001
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some portability problems (get it to compile, at least, on HP's cc)
parent
aa6970ef
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
41 deletions
+34
-41
contrib/pgcrypto/crypt-blowfish.c
contrib/pgcrypto/crypt-blowfish.c
+7
-13
contrib/pgcrypto/crypt-des.c
contrib/pgcrypto/crypt-des.c
+15
-12
contrib/pgcrypto/crypt-gensalt.c
contrib/pgcrypto/crypt-gensalt.c
+8
-14
contrib/pgcrypto/internal.c
contrib/pgcrypto/internal.c
+2
-2
contrib/rserv/rserv.c
contrib/rserv/rserv.c
+2
-0
No files found.
contrib/pgcrypto/crypt-blowfish.c
View file @
77f27d5e
...
...
@@ -30,7 +30,8 @@
* hadn't seen his code).
*/
#include <postgres.h>
#include "postgres.h"
#include "px-crypt.h"
#define __set_errno(v)
...
...
@@ -38,13 +39,6 @@
#define __set_errno(val) errno = (val)
#endif
#undef __CONST
#ifdef __GNUC__
#define __CONST __const
#else
#define __CONST
#endif
#ifdef __i386__
#define BF_ASM 0
/* 1 */
#define BF_SCALE 1
...
...
@@ -373,7 +367,7 @@ static unsigned char BF_atoi64[0x60] = {
(dst) = tmp; \
}
static
int
BF_decode
(
BF_word
*
dst
,
__CONST
char
*
src
,
int
size
)
static
int
BF_decode
(
BF_word
*
dst
,
const
char
*
src
,
int
size
)
{
unsigned
char
*
dptr
=
(
unsigned
char
*
)
dst
;
unsigned
char
*
end
=
dptr
+
size
;
...
...
@@ -397,7 +391,7 @@ static int BF_decode(BF_word *dst, __CONST char *src, int size)
return
0
;
}
static
void
BF_encode
(
char
*
dst
,
__CONST
BF_word
*
src
,
int
size
)
static
void
BF_encode
(
char
*
dst
,
const
BF_word
*
src
,
int
size
)
{
unsigned
char
*
sptr
=
(
unsigned
char
*
)
src
;
unsigned
char
*
end
=
sptr
+
size
;
...
...
@@ -536,9 +530,9 @@ extern void _BF_body_r(BF_ctx *ctx);
#endif
static
void
BF_set_key
(
__CONST
char
*
key
,
BF_key
expanded
,
BF_key
initial
)
static
void
BF_set_key
(
const
char
*
key
,
BF_key
expanded
,
BF_key
initial
)
{
__CONST
char
*
ptr
=
key
;
const
char
*
ptr
=
key
;
int
i
,
j
;
BF_word
tmp
;
...
...
@@ -556,7 +550,7 @@ static void BF_set_key(__CONST char *key, BF_key expanded, BF_key initial)
}
}
char
*
_crypt_blowfish_rn
(
__CONST
char
*
key
,
__CONST
char
*
setting
,
char
*
_crypt_blowfish_rn
(
const
char
*
key
,
const
char
*
setting
,
char
*
output
,
int
size
)
{
struct
{
...
...
contrib/pgcrypto/crypt-des.c
View file @
77f27d5e
...
...
@@ -58,18 +58,13 @@
* alignment).
*/
#include <postgres.h>
#include "postgres.h"
#include "px-crypt.h"
/* for ntohl/htonl */
#include <netinet/in.h>
/* We can't always assume gcc */
#ifdef __GNUC__
#define INLINE inline
#endif
#define _PASSWORD_EFMT1 '_'
static
uint8
IP
[
64
]
=
{
...
...
@@ -200,7 +195,7 @@ static uint32 comp_maskl[8][128],
static
uint32
old_rawkey0
,
old_rawkey1
;
static
INLINE
int
static
inline
int
ascii_to_bin
(
char
ch
)
{
if
(
ch
>
'z'
)
...
...
@@ -611,6 +606,7 @@ do_des(uint32 l_in, uint32 r_in, uint32 * l_out, uint32 * r_out, int count)
static
int
des_cipher
(
const
char
*
in
,
char
*
out
,
long
salt
,
int
count
)
{
uint32
buffer
[
2
];
uint32
l_out
,
r_out
,
rawl
,
...
...
@@ -622,13 +618,20 @@ des_cipher(const char *in, char *out, long salt, int count)
setup_salt
(
salt
);
rawl
=
ntohl
(
*
((
uint32
*
)
in
)
++
);
rawr
=
ntohl
(
*
((
uint32
*
)
in
));
/* copy data to avoid assuming input is word-aligned */
memcpy
(
buffer
,
in
,
sizeof
(
buffer
));
rawl
=
ntohl
(
buffer
[
0
]);
rawr
=
ntohl
(
buffer
[
1
]);
retval
=
do_des
(
rawl
,
rawr
,
&
l_out
,
&
r_out
,
count
);
*
((
uint32
*
)
out
)
++
=
htonl
(
l_out
);
*
((
uint32
*
)
out
)
=
htonl
(
r_out
);
buffer
[
0
]
=
htonl
(
l_out
);
buffer
[
1
]
=
htonl
(
r_out
);
/* copy data to avoid assuming output is word-aligned */
memcpy
(
out
,
buffer
,
sizeof
(
buffer
));
return
(
retval
);
}
...
...
contrib/pgcrypto/crypt-gensalt.c
View file @
77f27d5e
...
...
@@ -10,19 +10,13 @@
* may not be compiled always. -- marko
*/
#include <postgres.h>
#include "postgres.h"
#include "px-crypt.h"
#include <errno.h>
#ifndef __set_errno
#define __set_errno(val) errno = (val)
#endif
#undef __CONST
#ifdef __GNUC__
#define __CONST __const
#else
#define __CONST
#define __set_errno(val) (errno = (val))
#endif
typedef
unsigned
int
BF_word
;
...
...
@@ -31,7 +25,7 @@ unsigned char _crypt_itoa64[64 + 1] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
;
char
*
_crypt_gensalt_traditional_rn
(
unsigned
long
count
,
__CONST
char
*
input
,
int
size
,
char
*
output
,
int
output_size
)
const
char
*
input
,
int
size
,
char
*
output
,
int
output_size
)
{
if
(
size
<
2
||
output_size
<
2
+
1
||
(
count
&&
count
!=
25
))
{
if
(
output_size
>
0
)
output
[
0
]
=
'\0'
;
...
...
@@ -47,7 +41,7 @@ char *_crypt_gensalt_traditional_rn(unsigned long count,
}
char
*
_crypt_gensalt_extended_rn
(
unsigned
long
count
,
__CONST
char
*
input
,
int
size
,
char
*
output
,
int
output_size
)
const
char
*
input
,
int
size
,
char
*
output
,
int
output_size
)
{
unsigned
long
value
;
...
...
@@ -80,7 +74,7 @@ char *_crypt_gensalt_extended_rn(unsigned long count,
}
char
*
_crypt_gensalt_md5_rn
(
unsigned
long
count
,
__CONST
char
*
input
,
int
size
,
char
*
output
,
int
output_size
)
const
char
*
input
,
int
size
,
char
*
output
,
int
output_size
)
{
unsigned
long
value
;
...
...
@@ -121,7 +115,7 @@ char *_crypt_gensalt_md5_rn(unsigned long count,
static
unsigned
char
BF_itoa64
[
64
+
1
]
=
"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
;
static
void
BF_encode
(
char
*
dst
,
__CONST
BF_word
*
src
,
int
size
)
static
void
BF_encode
(
char
*
dst
,
const
BF_word
*
src
,
int
size
)
{
unsigned
char
*
sptr
=
(
unsigned
char
*
)
src
;
unsigned
char
*
end
=
sptr
+
size
;
...
...
@@ -154,7 +148,7 @@ static void BF_encode(char *dst, __CONST BF_word *src, int size)
}
char
*
_crypt_gensalt_blowfish_rn
(
unsigned
long
count
,
__CONST
char
*
input
,
int
size
,
char
*
output
,
int
output_size
)
const
char
*
input
,
int
size
,
char
*
output
,
int
output_size
)
{
if
(
size
<
16
||
output_size
<
7
+
22
+
1
||
(
count
&&
(
count
<
4
||
count
>
31
)))
{
...
...
contrib/pgcrypto/internal.c
View file @
77f27d5e
...
...
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: internal.c,v 1.
4 2001/08/21 00:42:41 momjian
Exp $
* $Id: internal.c,v 1.
5 2001/10/15 19:12:48 tgl
Exp $
*/
...
...
@@ -134,7 +134,7 @@ int_sha1_update(PX_MD * h, const uint8 * data, uint dlen)
{
SHA1_CTX
*
ctx
=
(
SHA1_CTX
*
)
h
->
p
.
ptr
;
SHA1Update
(
ctx
,
(
const
char
*
)
data
,
dlen
);
SHA1Update
(
ctx
,
data
,
dlen
);
}
static
void
...
...
contrib/rserv/rserv.c
View file @
77f27d5e
...
...
@@ -87,12 +87,14 @@ _rserv_log_()
if
(
TRIGGER_FIRED_BY_UPDATE
(
CurrentTriggerData
->
tg_event
))
newtuple
=
CurrentTriggerData
->
tg_newtuple
;
#ifndef PG_FUNCTION_INFO_V1
/*
* Setting CurrentTriggerData to NULL prevents direct calls to trigger
* functions in queries. Normally, trigger functions have to be called
* by trigger manager code only.
*/
CurrentTriggerData
=
NULL
;
#endif
/* Connect to SPI manager */
if
((
ret
=
SPI_connect
())
<
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment