r25598: Add missing become_root/unbecome_root around calls of add_aliases.
[samba.git] / source / rpcclient / cmd_unixinfo.c
index 762a795bbc6652dc5cc7e09f500789741a36c681..e6f1e04a457a551b2f515a9218380c118a4a74c1 100644 (file)
@@ -6,7 +6,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
 #include "rpcclient.h"
-#include "rpc_client/cli_unixinfo.h"
 
 static NTSTATUS cmd_unixinfo_uid2sid(struct rpc_pipe_client *cli,
                                     TALLOC_CTX *mem_ctx,
@@ -71,7 +69,7 @@ static NTSTATUS cmd_unixinfo_sid2uid(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       printf("%llu\n", uid);
+       printf("%llu\n", (unsigned long long)uid);
 
 done:
        return result;
@@ -126,7 +124,7 @@ static NTSTATUS cmd_unixinfo_sid2gid(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       printf("%llu\n", gid);
+       printf("%llu\n", (unsigned long long)gid);
 
 done:
        return result;
@@ -157,7 +155,14 @@ static NTSTATUS cmd_unixinfo_getpwuid(struct rpc_pipe_client *cli,
                uids[i] = atoi(argv[i+1]);
        }
 
-       result = rpccli_unixinfo_GetPWUid(cli, mem_ctx, &num_uids, uids, &info);
+       info = TALLOC_ARRAY(mem_ctx, struct unixinfo_GetPWUidInfo, num_uids);
+       if (info == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+
+       result = rpccli_unixinfo_GetPWUid(cli, mem_ctx, &num_uids, uids,
+                                         info);
 
        if (!NT_STATUS_IS_OK(result)) {
                return result;
@@ -165,10 +170,11 @@ static NTSTATUS cmd_unixinfo_getpwuid(struct rpc_pipe_client *cli,
 
        for (i=0; i<num_uids; i++) {
                if (NT_STATUS_IS_OK(info[i].status)) {
-                       printf("%llu:%s:%s\n", uids[i], info[i].homedir,
-                              info[i].shell);
+                       printf("%llu:%s:%s\n", (unsigned long long)uids[i],
+                              info[i].homedir, info[i].shell);
                } else {
-                       printf("%llu:%s\n", uids[i], nt_errstr(info[i].status));
+                       printf("%llu:%s\n", (unsigned long long)uids[i],
+                              nt_errstr(info[i].status));
                }
        }