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
0a3094b6
Commit
0a3094b6
authored
Aug 17, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder MD5/crypt so MD5 comes first in the code.
parent
2637f887
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
45 deletions
+45
-45
src/backend/libpq/auth.c
src/backend/libpq/auth.c
+7
-7
src/backend/libpq/crypt.c
src/backend/libpq/crypt.c
+8
-8
src/interfaces/libpq/fe-auth.c
src/interfaces/libpq/fe-auth.c
+30
-30
No files found.
src/backend/libpq/auth.c
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
;
...
...
src/backend/libpq/crypt.c
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
;
...
...
src/interfaces/libpq/fe-auth.c
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
,
...
...
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