passwd: add UPN validation support#1633
Conversation
|
This is what I’ve managed to put in place with the time I had available... |
|
@MarcinDigitic do you mind testing? |
|
I've fixed several issues for you. v2:
range-diff |
4ea29c1 to
97b1a5c
Compare
| #include "sysconf.h" | ||
|
|
||
|
|
||
| #define DOMAIN_MAXLEN 253 |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
97b1a5c to
0428dee
Compare
|
I've fixed a few more issues for you. v3:
range-diffv3b:
range-diff |
I think the reason for the failing tests is that I changed the code to accept |
d71db36 to
c3625ee
Compare
|
I've fixed a few more things for you. v4:
range-diffv5:
range-diffDetails |
c3625ee to
48d9c38
Compare
48d9c38 to
23c7a53
Compare
|
I've fixed a bug for you. v6:
range-diff |
|
I'm actively looking into this PR now that the dependencies are merged. Please do not push |
d971d4d to
b12037f
Compare
|
This is ready for review again |
alejandro-colomar
left a comment
There was a problem hiding this comment.
Here's a review of the first commit. Except for one comment, it looks good to me.
alejandro-colomar
left a comment
There was a problem hiding this comment.
Thanks! LGTM.
Reviewed-by: Alejandro Colomar <alx@kernel.org>
I only have some comments about the source-code comments, but the source code is good.
Add is_valid_upn() function to validate User Principal Name format. UPN validation splits on @ and validates the prefix using existing username rules and suffix part using RFC 1035/1123 compliant domain name validation. Link: <https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.1> Co-authored-by: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com> Co-authored-by: Alejandro Colomar <alx@kernel.org> Signed-off-by: Alejandro Colomar <alx@kernel.org> Reviewed-by: Alejandro Colomar <alx@kernel.org>
Add comprehensive unit tests for is_valid_upn() function in `tests/unit/test_chkname.c` covering: - Valid UPN formats (user@domain.com) - Invalid structures (missing @, multiple @) - Domain validation (RFC compliance) - Boundary limits (253/254 char domains, 63+ char labels) Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com> Reviewed-by: Alejandro Colomar <alx@kernel.org>
Add User Principal Name (UPN) validation to allow passwd command to accept usernames in user@domain.com format. Currently, passwd will accept both traditional usernames and UPN format. Fixes: 326889c (2024-10-22; "Fix coverity unbound buffer issues") Closes: <shadow-maint#1626> Reported-by: @nooreldeenmansour Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com> Reviewed-by: Alejandro Colomar <alx@kernel.org>
|
@alejandro-colomar feel free to merge if you agree with the changes |
053efca
into
shadow-maint:master
|
Merged. BTW, I forgot... I had this in mind a few weeks ago, but forgot about it... Is passwd the only program that needs this? Do we need to do the same thing for other programs? |
|
Yes, I think so. |
|
Thanks! Let's keep it as is, and if someone finds and reports issues with any other tool, we'll address them. :) |
Add User Principal Name (UPN) validation to allow
passwdcommand to accept usernames inuser@domain.comformat. This addresses rejection of valid UPN usernames by implementing proper RFC-compliant domain validation.Changes include:
is_valid_upn(), is_valid_domain_name(), andis_valid_domain_label()functions tolib/chkname.cwith RFC 1035/1123 compliant validationpasswd.cto accept both traditional usernames and UPN formatFixes: 326889c (2024-10-22; "Fix coverity unbound buffer issues")
Closes: #1626
Reported-by: @nooreldeenmansour
Supersedes: #1627