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
b40b3306
Commit
b40b3306
authored
Dec 17, 2003
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove pg_id.
parent
99e922a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
174 deletions
+4
-174
src/bin/Makefile
src/bin/Makefile
+2
-2
src/bin/initdb/initdb.c
src/bin/initdb/initdb.c
+2
-2
src/bin/pg_id/Makefile
src/bin/pg_id/Makefile
+0
-37
src/bin/pg_id/pg_id.c
src/bin/pg_id/pg_id.c
+0
-133
No files found.
src/bin/Makefile
View file @
b40b3306
...
...
@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/Makefile,v 1.4
0 2003/11/29 19:52:04 pgsql
Exp $
# $PostgreSQL: pgsql/src/bin/Makefile,v 1.4
1 2003/12/17 18:44:08 petere
Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -13,7 +13,7 @@ subdir = src/bin
top_builddir
=
../..
include
$(top_builddir)/src/Makefile.global
DIRS
:=
initdb initlocation ipcclean pg_ctl pg_dump
pg_id
\
DIRS
:=
initdb initlocation ipcclean pg_ctl pg_dump
\
psql scripts pg_config pg_controldata pg_resetxlog
\
pg_encoding
...
...
src/bin/initdb/initdb.c
View file @
b40b3306
...
...
@@ -43,7 +43,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.1
6 2003/12/01 23:15:47 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.1
7 2003/12/17 18:44:08 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -649,7 +649,7 @@ exit_nicely(void)
}
/*
* find the current user
using code lifted from pg_id.c
* find the current user
*
* on unix make sure it isn't really root
*/
...
...
src/bin/pg_id/Makefile
deleted
100644 → 0
View file @
99e922a0
#-------------------------------------------------------------------------
#
# Makefile for src/bin/pg_id
#
# Copyright (C) 2000 by PostgreSQL Global Development Team
#
# $PostgreSQL: pgsql/src/bin/pg_id/Makefile,v 1.21 2003/11/29 19:52:05 pgsql Exp $
#
#-------------------------------------------------------------------------
subdir
=
src/bin/pg_id
top_builddir
=
../../..
include
$(top_builddir)/src/Makefile.global
all
:
pg_id
pg_id
:
pg_id.o
$(CC)
$(CFLAGS)
$(LDFLAGS)
$^
$(LIBS)
-o
$@
install
:
all installdirs
$(INSTALL_PROGRAM)
pg_id
$(X)
$(DESTDIR)$(bindir)
/pg_id
$(X)
installdirs
:
$(mkinstalldirs)
$(DESTDIR)$(bindir)
uninstall
:
rm
-f
$(DESTDIR)$(bindir)
/pg_id
$(X)
depend dep
:
$(CC)
-MM
$(CFLAGS)
*
.c
>
depend
clean distclean maintainer-clean
:
rm
-f
pg_id
$(X)
pg_id.o
ifeq
(depend,$(wildcard depend))
include
depend
endif
src/bin/pg_id/pg_id.c
deleted
100644 → 0
View file @
99e922a0
/*
* pg_id.c
*
* A crippled id utility for use in various shell scripts in use by PostgreSQL
* (in particular initdb)
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/pg_id/pg_id.c,v 1.26 2003/11/29 19:52:06 pgsql Exp $
*/
#include "postgres_fe.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
int
main
(
int
argc
,
char
*
argv
[])
{
int
c
;
int
name_only_flag
=
0
,
use_real_uid_flag
=
0
,
limit_user_info
=
0
;
const
char
*
username
=
NULL
;
extern
int
optind
;
#ifndef WIN32
struct
passwd
*
pw
;
#else
struct
passwd_win32
{
int
pw_uid
;
char
pw_name
[
128
];
}
pass_win32
;
struct
passwd_win32
*
pw
=
&
pass_win32
;
unsigned
long
pwname_size
=
sizeof
(
pass_win32
.
pw_name
)
-
1
;
pw
->
pw_uid
=
1
;
#endif
while
((
c
=
getopt
(
argc
,
argv
,
"nru"
))
!=
-
1
)
{
switch
(
c
)
{
case
'n'
:
name_only_flag
=
1
;
break
;
case
'r'
:
use_real_uid_flag
=
1
;
break
;
case
'u'
:
limit_user_info
=
1
;
break
;
default:
#ifndef WIN32
fprintf
(
stderr
,
"Usage: %s [-n] [-r] [-u] [username]
\n
"
,
argv
[
0
]);
#else
fprintf
(
stderr
,
"Usage: %s [-n] [-r] [-u]
\n
"
,
argv
[
0
]);
#endif
exit
(
1
);
}
}
if
(
argc
-
optind
>=
1
)
#ifndef WIN32
username
=
argv
[
optind
];
#else
{
fprintf
(
stderr
,
"%s: specifying a username is not supported on this platform
\n
"
,
argv
[
0
]);
exit
(
1
);
}
#endif
if
(
name_only_flag
&&
!
limit_user_info
)
{
fprintf
(
stderr
,
"%s: -n must be used together with -u
\n
"
,
argv
[
0
]);
exit
(
1
);
}
if
(
username
&&
use_real_uid_flag
)
{
fprintf
(
stderr
,
"%s: -r cannot be used when a user name is given
\n
"
,
argv
[
0
]);
exit
(
1
);
}
#ifndef WIN32
if
(
username
)
{
pw
=
getpwnam
(
username
);
if
(
!
pw
)
{
fprintf
(
stderr
,
"%s: %s: no such user
\n
"
,
argv
[
0
],
username
);
exit
(
1
);
}
}
else
if
(
use_real_uid_flag
)
pw
=
getpwuid
(
getuid
());
else
pw
=
getpwuid
(
geteuid
());
if
(
!
pw
)
{
perror
(
argv
[
0
]);
exit
(
1
);
}
#else
if
(
!
use_real_uid_flag
)
{
fprintf
(
stderr
,
"%s: -r must be used on this platform
\n
"
,
argv
[
0
]);
exit
(
1
);
}
GetUserName
(
pw
->
pw_name
,
&
pwname_size
);
#endif
if
(
!
limit_user_info
)
printf
(
"uid=%d(%s)
\n
"
,
(
int
)
pw
->
pw_uid
,
pw
->
pw_name
);
else
if
(
name_only_flag
)
puts
(
pw
->
pw_name
);
else
#ifdef __BEOS__
if
(
pw
->
pw_uid
==
0
)
printf
(
"1
\n
"
);
else
#endif
printf
(
"%d
\n
"
,
(
int
)
pw
->
pw_uid
);
return
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