Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Add attributes not working in tac_author_read() #59

Open
pprindeville opened this issue Aug 15, 2016 · 0 comments
Open

Add attributes not working in tac_author_read() #59

pprindeville opened this issue Aug 15, 2016 · 0 comments

Comments

@pprindeville
Copy link
Collaborator

I'm looking at this code:

int tac_author_read(int fd, struct areply *re) {
    ...

    bzero(re, sizeof(struct areply));

followed by:

    /* prepare status */
    switch(tb->status) {
        /* success conditions */
        /* XXX support optional vs mandatory arguments */
        case TAC_PLUS_AUTHOR_STATUS_PASS_REPL:
            tac_free_attrib(&re->attr);

        case TAC_PLUS_AUTHOR_STATUS_PASS_ADD:
            {
                u_char *argp; 

                if(!re->msg) re->msg=xstrdup(author_ok_msg);
                    re->status=tb->status;

                /* add attributes received to attribute list returned to
                   the client */

and it strikes me that the comment rings false. We can't add new attributes to the list, because the list has been clobbered (along with the other members of *re).

For that matter, the tac_free_attrib() will always be a no-op because re->attr will be NULL.

The bzero() at the top of the function seems wrong. And if re->msg is an xstrdup()'d pointer, isn't this going to cause a leak?

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

No branches or pull requests

1 participant