Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create parent dirs for useradd -m #2

Closed
wants to merge 1 commit into from

Conversation

thorstenb
Copy link

Code from pwdutils 3.2.2 with slight adaptations, under BSD-3-clause project license of course. Fixes the 'XXX - create missing parent directories. --marekm' problem.

Code from pwdutils 3.2.2 with slight adaptations.
@thorstenb
Copy link
Author

A polite ping - is this PR still of interest?


path[0] = '\0';
bhome = strdup (user_home);
++bhome;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check for strdup failure before incrementing here.

@hallyn
Copy link
Member

hallyn commented Aug 5, 2016

Thanks for doing this patch, sorry for the delay. Indeed it seems worth doing, although the alternative (for which there is an open debian bug) is to simply drop this functionality from shadow and have everyone switch to other implemenetations.

@hallyn
Copy link
Member

hallyn commented Mar 24, 2018

Hi - one last ping; If no reply (or if you ask me to) I'll update the patch myself and apply.

Thanks.

path[0] = '\0';
bhome = strdup (user_home);
++bhome;

#ifdef WITH_SELINUX
if (set_selinux_file_context (user_home) != 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more change - this set_selinux_file_context() must happen after the parent directories have been created, else it will apply to the parent directories we create.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes please, I've somewhat moved on from that code. Given my response latency, perhaps best if you roll your proposed changes in.

@jubalh
Copy link
Member

jubalh commented May 14, 2018

What's the current state of this PR?

Is there still interest in adding this feature?

jubalh added a commit to jubalh/shadow that referenced this pull request May 15, 2018
Equivalent of `mkdir -p`. It will create all parent directories.
Example: `useradd -d /home2/testu1 -m testu1`

Based on shadow-maint#2 by Thorsten Kukuk
and Thorsten Behrens which was Code from pwdutils 3.2.2 with slight adaptations.
jubalh added a commit to jubalh/shadow that referenced this pull request May 15, 2018
Equivalent of `mkdir -p`. It will create all parent directories.
Example: `useradd -d /home2/testu1 -m testu1`

Based on shadow-maint#2 by Thorsten Kukuk
and Thorsten Behrens which was Code from pwdutils 3.2.2 with slight adaptations.

Adapted to so it applies to current code.
@hallyn hallyn closed this May 23, 2018
cgzones added a commit to cgzones/shadow that referenced this pull request Jan 30, 2023
A crypt method needs to be specified before the rounds can set:

    #0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse4_2.S:227
    shadow-maint#1  0x0000555555557755 in process_flags (argv=0x7fffffffe4d8, argc=3) at chgpasswd.c:188
    shadow-maint#2  main (argc=3, argv=0x7fffffffe4d8) at chgpasswd.c:427

    chgpasswd.c:188:42: warning: use of NULL where non-null expected [CWE-476] [-Wanalyzer-null-argument]
cgzones added a commit to cgzones/shadow that referenced this pull request Feb 28, 2023
A crypt method needs to be specified before the rounds can set:

    #0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse4_2.S:227
    shadow-maint#1  0x0000555555557755 in process_flags (argv=0x7fffffffe4d8, argc=3) at chgpasswd.c:188
    shadow-maint#2  main (argc=3, argv=0x7fffffffe4d8) at chgpasswd.c:427

    chgpasswd.c:188:42: warning: use of NULL where non-null expected [CWE-476] [-Wanalyzer-null-argument]
cgzones added a commit to cgzones/shadow that referenced this pull request Mar 31, 2023
A crypt method needs to be specified before the rounds can set:

    #0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse4_2.S:227
    shadow-maint#1  0x0000555555557755 in process_flags (argv=0x7fffffffe4d8, argc=3) at chgpasswd.c:188
    shadow-maint#2  main (argc=3, argv=0x7fffffffe4d8) at chgpasswd.c:427

    chgpasswd.c:188:42: warning: use of NULL where non-null expected [CWE-476] [-Wanalyzer-null-argument]
cgzones added a commit to cgzones/shadow that referenced this pull request Apr 1, 2023
Free the actual struct of the removed entry.

Example userdel report:

    Direct leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x55b230efe857 in reallocarray (./src/userdel+0xda857)
        shadow-maint#1 0x55b230f6041f in mallocarray ./lib/./alloc.h:97:9
        shadow-maint#2 0x55b230f6041f in commonio_open ./lib/commonio.c:563:7
        shadow-maint#3 0x55b230f39098 in open_files ./src/userdel.c:555:6
        shadow-maint#4 0x55b230f39098 in main ./src/userdel.c:1189:2
        shadow-maint#5 0x7f9b48c64189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
cgzones added a commit to cgzones/shadow that referenced this pull request Apr 11, 2023
A crypt method needs to be specified before the rounds can set:

    #0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse4_2.S:227
    shadow-maint#1  0x0000555555557755 in process_flags (argv=0x7fffffffe4d8, argc=3) at chgpasswd.c:188
    shadow-maint#2  main (argc=3, argv=0x7fffffffe4d8) at chgpasswd.c:427

    chgpasswd.c:188:42: warning: use of NULL where non-null expected [CWE-476] [-Wanalyzer-null-argument]
hallyn pushed a commit that referenced this pull request Apr 26, 2023
Free the actual struct of the removed entry.

Example userdel report:

    Direct leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x55b230efe857 in reallocarray (./src/userdel+0xda857)
        #1 0x55b230f6041f in mallocarray ./lib/./alloc.h:97:9
        #2 0x55b230f6041f in commonio_open ./lib/commonio.c:563:7
        #3 0x55b230f39098 in open_files ./src/userdel.c:555:6
        #4 0x55b230f39098 in main ./src/userdel.c:1189:2
        #5 0x7f9b48c64189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants