Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-07 Thread Roberto E. Vargas Caballero
Hi,

On Thu, Mar 07, 2024 at 02:52:49PM -0500, neeshy wrote:
> On Thu Mar 7, 2024 at 1:19 PM EST, Roberto E. Vargas Caballero wrote:
> > I think it makes it simpler while keeping the correct behaviour that I 
> > broke.
> 
> Looks good to me!

Pushed!



Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-07 Thread neeshy
On Thu Mar 7, 2024 at 1:19 PM EST, Roberto E. Vargas Caballero wrote:
> I think it makes it simpler while keeping the correct behaviour that I broke.

Looks good to me!



Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-07 Thread Roberto E. Vargas Caballero
Hi,

On Thu, Mar 07, 2024 at 02:18:28AM -0500, neeshy wrote:
> It seems that the modifications you made break the use case where su is
> called without a username. It would normally default to the root
> user, but now it invokes usage() instead. My original patch worked as
> intended. Could you rebase using the original patch instead? Thank you.
> 

Sadly, I cannot rebase it as it is already in the central repository.
What do you think about adding a new change like this:


diff --git a/su.c b/su.c
index eb8bea7..8eea82b 100644
--- a/su.c
+++ b/su.c
@@ -26,7 +26,7 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
-   char *usr = "root", *pass;
+   char *usr, *pass;
char *shell, *envshell, *term;
struct passwd *pw;
char *newargv[3];
@@ -43,9 +43,14 @@ main(int argc, char *argv[])
usage();
} ARGEND;
 
-   if (argc != 1)
+   if (argc > 1)
usage();
-   usr = argv[0];
+   usr = argc > 0 ? argv[0] : "root";
 
errno = 0;
pw = getpwnam(usr);

I think it makes it simpler while keeping the correct behaviour that I broke.

Kind Regards,
Roberto Vargas



Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-06 Thread neeshy
On Wed Mar 6, 2024 at 4:14 AM EST, Roberto E. Vargas Caballero wrote:
> Hi,
>
>
> On Mon, Feb 12, 2024 at 04:25:49PM -0500, neeshy wrote:
> > Inline dologin, and simplify common code
>
> I have applied the 4 patches with a minor modification to the 1st
> one.
>
> Kind regards,
> Roberto Vargas.

Hello,

It seems that the modifications you made break the use case where su is
called without a username. It would normally default to the root
user, but now it invokes usage() instead. My original patch worked as
intended. Could you rebase using the original patch instead? Thank you.



Re: [hackers] [ubase][PATCH 1/4] su: simplify logic

2024-03-06 Thread Roberto E. Vargas Caballero
Hi,


On Mon, Feb 12, 2024 at 04:25:49PM -0500, neeshy wrote:
> Inline dologin, and simplify common code

I have applied the 4 patches with a minor modification to the 1st
one.

Kind regards,
Roberto Vargas.