]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/winbind.c
Merge branch 'fix-compiler-warnings-2' of https://github.com/enaess/ppp
[ppp.git] / pppd / plugins / winbind.c
index 8c98e2a82972797219be4ab6c9de814caadb3e14..76db234737e93876f38d97171ab3877aea19c729 100644 (file)
@@ -167,7 +167,7 @@ plugin_init(void)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-size_t strhex_to_str(char *p, size_t len, const char *strhex)
+size_t strhex_to_str(unsigned char *p, size_t len, const char *strhex)
 {
        size_t i;
        size_t num_chars = 0;
@@ -299,15 +299,20 @@ unsigned int run_ntlm_auth(const char *username,
        if (forkret == 0) {
                /* child process */
                uid_t uid;
+               gid_t gid;
 
                close(child_out[0]);
                close(child_in[1]);
 
                /* run winbind as the user that invoked pppd */
-               setgid(getgid());
+               gid = getgid();
+               if (setgid(gid) == -1 || getgid() != gid) {
+                       fatal("pppd/winbind: could not setgid to %d: %m", gid);
+               }
                uid = getuid();
-               if (setuid(uid) == -1 || getuid() != uid)
+               if (setuid(uid) == -1 || getuid() != uid) {
                        fatal("pppd/winbind: could not setuid to %d: %m", uid);
+               }
                execl("/bin/sh", "sh", "-c", ntlm_auth, NULL);  
                fatal("pppd/winbind: could not exec /bin/sh: %m");
        }
@@ -522,7 +527,7 @@ winbind_chap_verify(char *user, char *ourname, int id,
        char *domain;
        char *username;
        char *p;
-       char saresponse[MS_AUTH_RESPONSE_LENGTH+1];
+       unsigned char saresponse[MS_AUTH_RESPONSE_LENGTH+1];
 
        /* The first byte of each of these strings contains their length */
        challenge_len = *challenge++;