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

Chntpw ng 1.01 #3

Open
wants to merge 2 commits into
base: chntpw-ng-1.01
Choose a base branch
from
Open

Conversation

WicRus
Copy link

@WicRus WicRus commented Nov 7, 2019

As you requested here, I have rebased my pull request to this branch.
Ready to discuss about bugs in my code.

@adrian15
Copy link
Collaborator

adrian15 commented Nov 9, 2019

As you requested here, I have rebased my pull request to this branch.
Ready to discuss about bugs in my code.

Sorry, it's almost there.

You need to create your pull request against our https://github.com/rescatux/chntpw/tree/chntpw-ng-1.01 branch. Not against our master branch.

Thank you.

@WicRus WicRus changed the base branch from master to chntpw-ng-1.01 November 12, 2019 15:37
@WicRus
Copy link
Author

WicRus commented Nov 12, 2019

Sorry. The target branch have been changed.

Makefile Outdated
@@ -13,7 +13,7 @@ OSSLINC=$(OSSLPATH)/include
CC=gcc

# Force 32 bit
CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall -m32
CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall -m32
Copy link
Collaborator

Choose a reason for hiding this comment

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

This typo fixing need to go into its own commit.

chntpw.c Outdated
@@ -408,7 +408,7 @@ char *change_pw(char *buf, int rid, int vlen, int stat)
cheap_uni2ascii(vp + fullname_offset,fullname,fullname_len);
cheap_uni2ascii(vp + comment_offset,comment,comment_len);
cheap_uni2ascii(vp + homedir_offset,homedir,homedir_len);

Copy link
Collaborator

Choose a reason for hiding this comment

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

This typo fixing need to go into its own commit.

libsam.c Outdated
@@ -349,7 +349,6 @@ struct sid_array *sam_make_sid_array(struct sid_binary *sidbuf, int size)

void sam_free_sid_array(struct sid_array *array)
{

Copy link
Collaborator

@adrian15 adrian15 Nov 12, 2019

Choose a reason for hiding this comment

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

If every function has an additional line you shouldn't remove it.
I haven't checked it.
Otherwise if removing this line matches the other functions style then this typo fixing need to go into its own commit.
(I mean all the typos fixing need to go into a single commit.)

samusrgrp.c Outdated
@@ -260,7 +382,6 @@ int main(int argc, char **argv)
H_SAM = 0;
}


Copy link
Collaborator

Choose a reason for hiding this comment

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

Once again.
Check if it makes sense to remove this line.
If it makes sense you need to put this into the 'Typos' commit.

libsam.c Outdated
@@ -511,7 +510,7 @@ int sam_put_grp_members_sid(struct hive *hdesc, int grp, struct sid_array *sarra

if (gverbose) printf("put_grp_members_sid: ajusted: mofs = %x, mlen = %x (%d)\n", mofs + 0x34 ,mlen,mlen);

if (gverbose) hexdump(&c->data, 0, c->len, 1);
if (gverbose) hexdump((char *)&(c->data), 0, c->len, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain why you change & into (char *)&( ?
Either as an in-code comment (better) or in the commit description.

libsam.c Outdated
printf(" Member # %d = <%s>\n", i, str);
FREE(str);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

gverbose should only be used to turn on or off the printf statement.
Else if gverbose is false then your code does not do anything useful.

printf("sam_add_sid_to_grp: user SID is <%s>\n", str);
free(str);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

gverbose should only be used to turn on or off the printf statement.
Else if gverbose is false then your code does not do anything useful.

printf(" Member # %d = <%s>\n", o, str);
FREE(str);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

gverbose should only be used to turn on or off the printf statement.
Else if gverbose is false then your code does not do anything useful.

printf(" Member # %u = <%s>\n", o, str);
FREE(str);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

gverbose should only be used to turn on or off the printf statement.
Else if gverbose is false then your code does not do anything useful.

FREE(str);
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

gverbose should only be used to turn on or off the printf statement.
Else if gverbose is false then your code does not do anything useful.

printf(" Member # %u = <%s>\n", o, str);
FREE(str);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

gverbose should only be used to turn on or off the printf statement.
Else if gverbose is false then your code does not do anything useful.

libsam.c Outdated
@@ -1559,7 +1734,7 @@ void sam_list_groups(struct hive *hdesc, int listmembers, int human) {
cheap_uni2ascii((char *)cd + grpnamoffs, groupname, grpnamlen);

if (human) printf("=== Group #%4x : %s\n",grp,groupname);
else if (!listmembers) printf("%x:%s:%d\n",grp,groupname,cd->grp_members);
else if (!listmembers) printf("%x:%s:%d\n",grp,groupname,cd->grp_members);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Identation fixes should be in a third commit different from the useful commit and the typos one.

libsam.c Outdated
}
FREE(str);

}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should go into the identation commit.

samusrgrp.c Outdated
@@ -260,7 +382,6 @@ int main(int argc, char **argv)
H_SAM = 0;
}


Copy link
Collaborator

Choose a reason for hiding this comment

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

Goes into typos commit.

}

if ( sid ) use_sid = 1;
if ( usr ) use_sid = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

There shouldn't be an additional line before the closing } in this function in order to match current style.

Codestyle's fixes.
Removed useless changes.
Fixed gverbose statment logic.
Fixed compiler warnings in libsam.c lines 514, 542, hexdump require char *, but &c->data have type &int.
Fixed compiler warnings in libsam.c line 531, printf %x require int, but sidptr have type void *.
@WicRus
Copy link
Author

WicRus commented Nov 25, 2019

Sorry for the delay with fixes.
I have tried to fix all your remarks.

double free fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants