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
ea43fec2
Commit
ea43fec2
authored
Apr 28, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with new pg_hba.conf code where the same comparison function
was incorrectly used for both qsort and bsearch.
parent
6c598869
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
10 deletions
+25
-10
src/backend/libpq/hba.c
src/backend/libpq/hba.c
+25
-10
No files found.
src/backend/libpq/hba.c
View file @
ea43fec2
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.8
2 2002/04/25 00:56:36
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.8
3 2002/04/28 22:49:07
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -335,21 +335,36 @@ tokenize_file(FILE *file)
/*
* Compare two
password-file lines on the basis of their user
names.
* Compare two
lines based on their user/group
names.
*
* Used for qsort() sorting
and bsearch() lookup
.
* Used for qsort() sorting.
*/
static
int
user_group_
cmp
(
const
void
*
user
,
const
void
*
list
)
user_group_
qsort_cmp
(
const
void
*
list1
,
const
void
*
list2
)
{
/* first node is line number */
char
*
user1
=
(
char
*
)
user
;
char
*
user2
=
lfirst
(
lnext
(
*
(
List
**
)
list
));
char
*
user1
=
lfirst
(
lnext
(
*
(
List
**
)
list1
))
;
char
*
user2
=
lfirst
(
lnext
(
*
(
List
**
)
list
2
));
return
strcmp
(
user1
,
user2
);
}
/*
* Compare two lines based on their user/group names.
*
* Used for bsearch() lookup.
*/
static
int
user_group_bsearch_cmp
(
const
void
*
user
,
const
void
*
list
)
{
/* first node is line number */
char
*
user2
=
lfirst
(
lnext
(
*
(
List
**
)
list
));
return
strcmp
(
user
,
user2
);
}
/*
* Lookup a group name in the pg_group file
*/
...
...
@@ -360,7 +375,7 @@ get_group_line(const char *group)
(
void
*
)
group_sorted
,
group_length
,
sizeof
(
List
*
),
user_group_cmp
);
user_group_
bsearch_
cmp
);
}
...
...
@@ -374,7 +389,7 @@ get_user_line(const char *user)
(
void
*
)
user_sorted
,
user_length
,
sizeof
(
List
*
),
user_group_cmp
);
user_group_
bsearch_
cmp
);
}
...
...
@@ -754,7 +769,7 @@ load_group()
foreach
(
line
,
group_lines
)
group_sorted
[
i
++
]
=
lfirst
(
line
);
qsort
((
void
*
)
group_sorted
,
group_length
,
sizeof
(
List
*
),
user_group_cmp
);
qsort
((
void
*
)
group_sorted
,
group_length
,
sizeof
(
List
*
),
user_group_
qsort_
cmp
);
}
else
group_sorted
=
NULL
;
...
...
@@ -792,7 +807,7 @@ load_user()
foreach
(
line
,
user_lines
)
user_sorted
[
i
++
]
=
lfirst
(
line
);
qsort
((
void
*
)
user_sorted
,
user_length
,
sizeof
(
List
*
),
user_group_cmp
);
qsort
((
void
*
)
user_sorted
,
user_length
,
sizeof
(
List
*
),
user_group_
qsort_
cmp
);
}
else
user_sorted
=
NULL
;
...
...
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