ports: sudo

This commit is contained in:
Matheus
2024-08-29 22:50:52 -03:00
parent 5cc76c5e55
commit 789daa2778
3 changed files with 142 additions and 0 deletions
+112
View File
@@ -0,0 +1,112 @@
diff --git sudo-clean/plugins/sudoers/getspwuid.c sudo-workdir/plugins/sudoers/getspwuid.c
index dd5092d..319facd 100644
--- sudo-clean/plugins/sudoers/getspwuid.c
+++ sudo-workdir/plugins/sudoers/getspwuid.c
@@ -119,7 +119,8 @@ sudo_setspent(void)
setprpwent();
#endif
#ifdef HAVE_GETSPNAM
- setspent();
+ fprintf(stderr, "sudo: setspent not implemented!\n");
+ //setspent();
#endif
debug_return;
}
diff --git sudo-clean/scripts/install-sh sudo-workdir/scripts/install-sh
index 228a0b1..9a2fc41 100755
--- sudo-clean/scripts/install-sh
+++ sudo-workdir/scripts/install-sh
@@ -7,8 +7,8 @@
PROGNAME=`basename $0`
## Paths to programs. CHOWN, STRIP and WHOAMI are checked below.
-CHOWN=chown
-CHGRP=chgrp
+CHOWN=true
+CHGRP=true
CHMOD=chmod
CP=cp
LN=ln
@@ -19,21 +19,21 @@ STRIP=strip
WHOAMI="echo root"
## Some systems don't support -x, so we have to use -f.
-for d in /sbin /etc /usr/sbin /usr/etc; do
- if [ -f $d/chown ]; then
- CHOWN=${d}/chown
- break
- fi
-done
+#for d in /sbin /etc /usr/sbin /usr/etc; do
+# if [ -f $d/chown ]; then
+# CHOWN=${d}/chown
+# break
+# fi
+#done
-for d in /usr/bin /bin /usr/ucb /usr/bsd; do
- if [ -f $d/whoami ]; then
- WHOAMI=${d}/whoami
- break
- elif [ -f $d/id ]; then
- WHOAMI=${d}/id | sed -n 's/^[^(]*(\([^)]*\)).*/\1/p'
- fi
-done
+#for d in /usr/bin /bin /usr/ucb /usr/bsd; do
+# if [ -f $d/whoami ]; then
+# WHOAMI=${d}/whoami
+# break
+# elif [ -f $d/id ]; then
+# WHOAMI=${d}/id | sed -n 's/^[^(]*(\([^)]*\)).*/\1/p'
+# fi
+#done
for d in /usr/ccs/bin /usr/bin /bin; do
if [ -f $d/strip ]; then
diff --git sudo-clean/src/utmp.c sudo-workdir/src/utmp.c
index 7ce683d..79ff0f7 100644
--- sudo-clean/src/utmp.c
+++ sudo-workdir/src/utmp.c
@@ -189,6 +189,8 @@ bool
utmp_login(const char *from_line, const char *to_line, int ttyfd,
const char *user)
{
+ return false;
+#if 0
sudo_utmp_t utbuf, *ut_old = NULL;
bool ret = false;
debug_decl(utmp_login, SUDO_DEBUG_UTMP);
@@ -204,7 +206,7 @@ utmp_login(const char *from_line, const char *to_line, int ttyfd,
/* Lookup old line. */
memset(&utbuf, 0, sizeof(utbuf));
strncpy(utbuf.ut_line, from_line, sizeof(utbuf.ut_line));
- ut_old = sudo_getutline(&utbuf);
+// ut_old = sudo_getutline(&utbuf);
sudo_setutent();
}
utmp_fill(to_line, user, ut_old, &utbuf);
@@ -213,11 +215,14 @@ utmp_login(const char *from_line, const char *to_line, int ttyfd,
sudo_endutent();
debug_return_bool(ret);
+#endif
}
bool
utmp_logout(const char *line, int status)
{
+ return false;
+#if 0
bool ret = false;
sudo_utmp_t *ut, utbuf;
debug_decl(utmp_logout, SUDO_DEBUG_UTMP);
@@ -242,8 +247,8 @@ utmp_logout(const char *line, int status)
ret = true;
}
debug_return_bool(ret);
+#endif
}
-
#else /* !HAVE_GETUTSID && !HAVE_GETUTXID && !HAVE_GETUTID */
/*
+20
View File
@@ -0,0 +1,20 @@
name=sudo
revision=1
from_source=sudo
imagedeps="base-devel"
hostdeps="xgcc xbinutils"
deps="mlibc libxcrypt"
build() {
${source_dir}/configure --host=x86_64-astral --prefix=${prefix} --with-secure-path --with-env-editor --with-passprompt="[sudo] password for %p: " --disable-nls
make -j ${parallelism}
}
package() {
make install DESTDIR=${dest_dir}
export mode=$(stat -c "%a" ${dest_dir}/etc/sudoers)
chmod 700 ${dest_dir}/etc/sudoers
echo "astral ALL=(ALL:ALL) ALL" >> ${dest_dir}/etc/sudoers
chmod ${mode} ${dest_dir}/etc/sudoers
chmod u+s ${dest_dir}/etc/sudoers
}
+10
View File
@@ -0,0 +1,10 @@
name=sudo
version=1.9.15p5
source_method=tarball
tarball_url="https://github.com/sudo-project/sudo/releases/download/SUDO_1_9_15p5/sudo-1.9.15p5.tar.gz"
tarball_sha512="ebac69719de2fe7bd587924701bdd24149bf376a68b17ec02f69b2b96d4bb6fa5eb8260a073ec5ea046d3ac69bb5b1c0b9d61709fe6a56f1f66e40817a70b15a"
hostdeps="autoconf automake pkgconfig libtool"
regenerate() {
autoreconf -fvi
cp -v $(find /usr/local/share/automake* -name config.sub) scripts
}