nsswitch: linux: Remove use of strcpy().
[sharpe/samba-autobuild/.git] / nsswitch / winbind_nss_aix.c
index 17578cf3501ad2b79206e0003a52f41748338dc1..c5c223f4758817c106c0cdf32e8d1ab65e51df98 100644 (file)
@@ -237,6 +237,9 @@ static struct group *fill_grent(struct winbindd_gr *gr, char *gr_mem)
 
        result->gr_mem = (char **)malloc(sizeof(char *) * (gr->num_gr_mem+1));
        if (!result->gr_mem) {
+               free(result->gr_name);
+               free(result->gr_passwd);
+               free(result);
                errno = ENOMEM;
                return NULL;
        }
@@ -276,7 +279,8 @@ static struct group *wb_aix_getgrgid(gid_t gid)
 
        request.data.gid = gid;
 
-       ret = winbindd_request_response(WINBINDD_GETGRGID, &request, &response);
+       ret = winbindd_request_response(NULL, WINBINDD_GETGRGID,
+                                       &request, &response);
 
        logit("getgrgid ret=%d\n", ret);
 
@@ -308,7 +312,8 @@ static struct group *wb_aix_getgrnam(const char *name)
 
        STRCPY_RETNULL(request.data.groupname, name);
 
-       ret = winbindd_request_response(WINBINDD_GETGRNAM, &request, &response);
+       ret = winbindd_request_response(NULL, WINBINDD_GETGRNAM,
+                                       &request, &response);
 
        HANDLE_ERRORS(ret);
 
@@ -367,7 +372,8 @@ static char *wb_aix_getgrset(char *user)
                free(r_user);
        }
 
-       ret = winbindd_request_response(WINBINDD_GETGROUPS, &request, &response);
+       ret = winbindd_request_response(NULL, WINBINDD_GETGROUPS,
+                                       &request, &response);
 
        HANDLE_ERRORS(ret);
 
@@ -406,7 +412,8 @@ static struct passwd *wb_aix_getpwuid(uid_t uid)
 
        request.data.uid = uid;
 
-       ret = winbindd_request_response(WINBINDD_GETPWUID, &request, &response);
+       ret = winbindd_request_response(NULL, WINBINDD_GETPWUID,
+                                       &request, &response);
 
        HANDLE_ERRORS(ret);
 
@@ -439,7 +446,8 @@ static struct passwd *wb_aix_getpwnam(const char *name)
 
        STRCPY_RETNULL(request.data.username, name);
 
-       ret = winbindd_request_response(WINBINDD_GETPWNAM, &request, &response);
+       ret = winbindd_request_response(NULL, WINBINDD_GETPWNAM,
+                                       &request, &response);
 
        HANDLE_ERRORS(ret);
 
@@ -472,7 +480,8 @@ static int wb_aix_lsuser(char *attributes[], attrval_t results[], int size)
        ZERO_STRUCT(request);
        ZERO_STRUCT(response);
 
-       ret = winbindd_request_response(WINBINDD_LIST_USERS, &request, &response);
+       ret = winbindd_request_response(NULL, WINBINDD_LIST_USERS,
+                                       &request, &response);
        if (ret != 0) {
                errno = EINVAL;
                return -1;
@@ -520,7 +529,8 @@ static int wb_aix_lsgroup(char *attributes[], attrval_t results[], int size)
        ZERO_STRUCT(request);
        ZERO_STRUCT(response);
 
-       ret = winbindd_request_response(WINBINDD_LIST_GROUPS, &request, &response);
+       ret = winbindd_request_response(NULL, WINBINDD_LIST_GROUPS,
+                                       &request, &response);
        if (ret != 0) {
                errno = EINVAL;
                return -1;
@@ -599,13 +609,25 @@ static attrval_t pwd_to_sid(struct passwd *pwd)
 
        request.data.uid = pwd->pw_uid;
 
-       if (winbindd_request_response(WINBINDD_UID_TO_SID, &request, &response) !=
+#if 0
+       /*
+        * Removed because WINBINDD_UID_TO_SID is replaced by
+        * WINBINDD_XIDS_TO_SIDS. I don't have an AIX build
+        * environment around, so I did not convert this call. If
+        * someone stumbles over this, please contact me:
+        * vl@samba.org, I'll convert this.
+        */
+       if (winbindd_request_response(NULL, WINBINDD_UID_TO_SID,
+                                     &request, &response) !=
            NSS_STATUS_SUCCESS) {
                r.attr_flag = ENOENT;
        } else {
                r.attr_flag = 0;
                r.attr_un.au_char = strdup(response.data.sid.sid);
        }
+#else
+       r.attr_flag = ENOENT;
+#endif
 
        return r;
 }
@@ -885,7 +907,8 @@ static int wb_aix_authenticate(char *user, char *pass,
                free(r_user);
        }
 
-       result = winbindd_request_response(WINBINDD_PAM_AUTH, &request, &response);
+       result = winbindd_request_response(NULL, WINBINDD_PAM_AUTH,
+                                          &request, &response);
 
        winbindd_free_response(&response);
 
@@ -934,7 +957,8 @@ static int wb_aix_chpass(char *user, char *oldpass, char *newpass, char **messag
                free(r_user);
        }
 
-       result = winbindd_request_response(WINBINDD_PAM_CHAUTHTOK, &request, &response);
+       result = winbindd_request_response(NULL, WINBINDD_PAM_CHAUTHTOK,
+                                          &request, &response);
 
        winbindd_free_response(&response);