s3: Remove unused "retry" from cli_full_connection
[nivanova/samba-autobuild/.git] / source3 / utils / smbcquotas.c
index 3f98b1250319d63dffd59ce23c0bea8ea6dc5c67..522af1730633f5ec75577eb0c3831ed4c1c0e662 100644 (file)
 */
 
 #include "includes.h"
+#include "popt_common.h"
 #include "../librpc/gen_ndr/ndr_lsa.h"
 #include "rpc_client/cli_lsarpc.h"
+#include "fake_file.h"
+#include "../libcli/security/security.h"
 
 static char *server;
 
@@ -114,8 +117,8 @@ static bool StringToSid(struct dom_sid *sid, const char *str)
        struct dom_sid *sids = NULL;
        bool result = True;
 
-       if (strncmp(str, "S-", 2) == 0) {
-               return string_to_sid(sid, str);
+       if (string_to_sid(sid, str)) {
+               return true;
        }
 
        if (!cli_open_policy_hnd() ||
@@ -235,11 +238,14 @@ static int do_quota(struct cli_state *cli,
        uint16_t quota_fnum = 0;
        SMB_NTQUOTA_LIST *qtl = NULL;
        SMB_NTQUOTA_STRUCT qt;
+       NTSTATUS status;
+
        ZERO_STRUCT(qt);
 
-       if (!NT_STATUS_IS_OK(cli_get_fs_attr_info(cli, &fs_attrs))) {
+       status = cli_get_fs_attr_info(cli, &fs_attrs);
+       if (!NT_STATUS_IS_OK(status)) {
                d_printf("Failed to get the filesystem attributes %s.\n",
-                       cli_errstr(cli));
+                        nt_errstr(status));
                return -1;
        }
 
@@ -248,10 +254,12 @@ static int do_quota(struct cli_state *cli,
                return 0;
        }
 
-       if (!NT_STATUS_IS_OK(cli_get_quota_handle(cli, &quota_fnum))) {
+       status = cli_get_quota_handle(cli, &quota_fnum);
+       if (!NT_STATUS_IS_OK(status)) {
                d_printf("Quotas are not enabled on this share.\n");
                d_printf("Failed to open %s  %s.\n",
-                       FAKE_FILE_NAME_QUOTA_WIN32,cli_errstr(cli));
+                        FAKE_FILE_NAME_QUOTA_WIN32,
+                        nt_errstr(status));
                return -1;
        }
 
@@ -396,8 +404,7 @@ static struct cli_state *connect_one(const char *share)
                                            lp_workgroup(),
                                            get_cmdline_auth_info_password(smbcquotas_auth_info),
                                            flags,
-                                           get_cmdline_auth_info_signing_state(smbcquotas_auth_info),
-                                           NULL);
+                                           get_cmdline_auth_info_signing_state(smbcquotas_auth_info));
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0,("cli_full_connection failed! (%s)\n", nt_errstr(nt_status)));
                return NULL;
@@ -461,10 +468,8 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
        ZERO_STRUCT(qt);
 
        /* set default debug level to 1 regardless of what smb.conf sets */
-       setup_logging( "smbcquotas", True );
-       DEBUGLEVEL_CLASS[DBGC_ALL] = 1;
-       dbf = x_stderr;
-       x_setbuf( x_stderr, NULL );
+       setup_logging( "smbcquotas", DEBUG_STDERR);
+       lp_set_cmdline("log level", "1");
 
        setlinebuf(stdout);