Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
0a3094b6
Commit
0a3094b6
authored
23 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Reorder MD5/crypt so MD5 comes first in the code.
parent
2637f887
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/backend/libpq/auth.c
+7
-7
7 additions, 7 deletions
src/backend/libpq/auth.c
src/backend/libpq/crypt.c
+8
-8
8 additions, 8 deletions
src/backend/libpq/crypt.c
src/interfaces/libpq/fe-auth.c
+30
-30
30 additions, 30 deletions
src/interfaces/libpq/fe-auth.c
with
45 additions
and
45 deletions
src/backend/libpq/auth.c
+
7
−
7
View file @
0a3094b6
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.6
0
2001/08/17
02:59:19
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.6
1
2001/08/17
15:40:07
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -420,8 +420,8 @@ auth_failed(Port *port)
authmethod
=
"IDENT"
;
break
;
case
uaPassword
:
case
uaCrypt
:
case
uaMD5
:
case
uaCrypt
:
authmethod
=
"Password"
;
break
;
}
...
...
@@ -501,13 +501,13 @@ ClientAuthentication(Port *port)
status
=
recv_and_check_password_packet
(
port
);
break
;
case
ua
Crypt
:
sendAuthRequest
(
port
,
AUTH_REQ_
CRYPT
);
case
ua
MD5
:
sendAuthRequest
(
port
,
AUTH_REQ_
MD5
);
status
=
recv_and_check_password_packet
(
port
);
break
;
case
ua
MD5
:
sendAuthRequest
(
port
,
AUTH_REQ_
MD5
);
case
ua
Crypt
:
sendAuthRequest
(
port
,
AUTH_REQ_
CRYPT
);
status
=
recv_and_check_password_packet
(
port
);
break
;
...
...
@@ -643,8 +643,8 @@ map_old_to_new(Port *port, UserAuth old, int status)
{
switch
(
port
->
auth_method
)
{
case
uaCrypt
:
case
uaMD5
:
case
uaCrypt
:
case
uaReject
:
status
=
STATUS_ERROR
;
break
;
...
...
This diff is collapsed.
Click to expand it.
src/backend/libpq/crypt.c
+
8
−
8
View file @
0a3094b6
...
...
@@ -9,7 +9,7 @@
* Dec 17, 1997 - Todd A. Brandys
* Orignal Version Completed.
*
* $Id: crypt.c,v 1.3
6
2001/08/17
03:09:31
momjian Exp $
* $Id: crypt.c,v 1.3
7
2001/08/17
15:40:07
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -294,13 +294,6 @@ md5_crypt_verify(const Port *port, const char *user, const char *pgpass)
*/
switch
(
port
->
auth_method
)
{
case
uaCrypt
:
{
char
salt
[
3
];
StrNCpy
(
salt
,
port
->
cryptSalt
,
3
);
crypt_pwd
=
crypt
(
passwd
,
salt
);
break
;
}
case
uaMD5
:
crypt_pwd
=
palloc
(
MD5_PASSWD_LEN
+
1
);
if
(
isMD5
(
passwd
))
...
...
@@ -334,6 +327,13 @@ md5_crypt_verify(const Port *port, const char *user, const char *pgpass)
pfree
(
crypt_pwd2
);
}
break
;
case
uaCrypt
:
{
char
salt
[
3
];
StrNCpy
(
salt
,
port
->
cryptSalt
,
3
);
crypt_pwd
=
crypt
(
passwd
,
salt
);
break
;
}
default:
crypt_pwd
=
passwd
;
break
;
...
...
This diff is collapsed.
Click to expand it.
src/interfaces/libpq/fe-auth.c
+
30
−
30
View file @
0a3094b6
...
...
@@ -10,7 +10,7 @@
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.5
4
2001/08/17 15:
11:15
momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.5
5
2001/08/17 15:
40:07
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -438,6 +438,33 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq)
switch
(
areq
)
{
case
AUTH_REQ_MD5
:
{
char
*
crypt_pwd2
;
if
(
!
(
crypt_pwd
=
malloc
(
MD5_PASSWD_LEN
+
1
))
||
!
(
crypt_pwd2
=
malloc
(
MD5_PASSWD_LEN
+
1
)))
{
perror
(
"malloc"
);
return
STATUS_ERROR
;
}
if
(
!
EncryptMD5
(
password
,
conn
->
pguser
,
strlen
(
conn
->
pguser
),
crypt_pwd2
))
{
free
(
crypt_pwd
);
free
(
crypt_pwd2
);
return
STATUS_ERROR
;
}
if
(
!
EncryptMD5
(
crypt_pwd2
+
strlen
(
"md5"
),
conn
->
md5Salt
,
sizeof
(
conn
->
md5Salt
),
crypt_pwd
))
{
free
(
crypt_pwd
);
free
(
crypt_pwd2
);
return
STATUS_ERROR
;
}
free
(
crypt_pwd2
);
break
;
}
case
AUTH_REQ_CRYPT
:
{
char
salt
[
3
];
...
...
@@ -446,33 +473,6 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq)
crypt_pwd
=
crypt
(
password
,
salt
);
break
;
}
case
AUTH_REQ_MD5
:
{
char
*
crypt_pwd2
;
if
(
!
(
crypt_pwd
=
malloc
(
MD5_PASSWD_LEN
+
1
))
||
!
(
crypt_pwd2
=
malloc
(
MD5_PASSWD_LEN
+
1
)))
{
perror
(
"malloc"
);
return
STATUS_ERROR
;
}
if
(
!
EncryptMD5
(
password
,
conn
->
pguser
,
strlen
(
conn
->
pguser
),
crypt_pwd2
))
{
free
(
crypt_pwd
);
free
(
crypt_pwd2
);
return
STATUS_ERROR
;
}
if
(
!
EncryptMD5
(
crypt_pwd2
+
strlen
(
"md5"
),
conn
->
md5Salt
,
sizeof
(
conn
->
md5Salt
),
crypt_pwd
))
{
free
(
crypt_pwd
);
free
(
crypt_pwd2
);
return
STATUS_ERROR
;
}
free
(
crypt_pwd2
);
break
;
}
default:
/* discard const so we can assign it */
crypt_pwd
=
(
char
*
)
password
;
...
...
@@ -535,9 +535,9 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
return
STATUS_ERROR
;
#endif
case
AUTH_REQ_PASSWORD
:
case
AUTH_REQ_CRYPT
:
case
AUTH_REQ_MD5
:
case
AUTH_REQ_CRYPT
:
case
AUTH_REQ_PASSWORD
:
if
(
password
==
NULL
||
*
password
==
'\0'
)
{
(
void
)
sprintf
(
PQerrormsg
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment