wscript: Add check for --wrap linker flag
[vlendec/samba-autobuild/.git] / source3 / rpc_client / init_spoolss.c
index 7050fe97df2b1303aac12440f7a5ecd3a53125dd..9a4dab6d417176cde4626946b5f203036ad76cec 100644 (file)
@@ -48,15 +48,15 @@ bool init_systemtime(struct spoolss_Time *r,
 
 time_t spoolss_Time_to_time_t(const struct spoolss_Time *r)
 {
-       struct tm unixtime;
-
-       unixtime.tm_year        = r->year - 1900;
-       unixtime.tm_mon         = r->month - 1;
-       unixtime.tm_wday        = r->day_of_week;
-       unixtime.tm_mday        = r->day;
-       unixtime.tm_hour        = r->hour;
-       unixtime.tm_min         = r->minute;
-       unixtime.tm_sec         = r->second;
+       struct tm unixtime = {
+               .tm_year        = r->year - 1900,
+               .tm_mon         = r->month - 1,
+               .tm_wday        = r->day_of_week,
+               .tm_mday        = r->day,
+               .tm_hour        = r->hour,
+               .tm_min         = r->minute,
+               .tm_sec         = r->second,
+       };
 
        return mktime(&unixtime);
 }
@@ -97,9 +97,11 @@ bool spoolss_timestr_to_NTTIME(const char *str,
 bool spoolss_driver_version_to_qword(const char *str,
                                     uint64_t *data)
 {
-       unsigned int v1, v2, v3, v4;
+       unsigned int v1, v2, v3, v4 = 0;
 
-       if (sscanf(str, "%u.%u.%u.%u", &v1, &v2, &v3, &v4) != 4) {
+       if ((sscanf(str, "%u.%u.%u.%u", &v1, &v2, &v3, &v4) != 4) &&
+           (sscanf(str, "%u.%u.%u", &v1, &v2, &v3) != 3))
+       {
                return false;
        }
 
@@ -123,7 +125,7 @@ WERROR pull_spoolss_PrinterData(TALLOC_CTX *mem_ctx,
        ndr_err = ndr_pull_union_blob(blob, mem_ctx, data, type,
                        (ndr_pull_flags_fn_t)ndr_pull_spoolss_PrinterData);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-               return WERR_GENERAL_FAILURE;
+               return WERR_GEN_FAILURE;
        }
        return WERR_OK;
 }
@@ -139,7 +141,7 @@ WERROR push_spoolss_PrinterData(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
        ndr_err = ndr_push_union_blob(blob, mem_ctx, data, type,
                        (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-               return WERR_GENERAL_FAILURE;
+               return WERR_GEN_FAILURE;
        }
        return WERR_OK;
 }
@@ -157,12 +159,12 @@ void spoolss_printerinfo2_to_setprinterinfo2(const struct spoolss_PrinterInfo2 *
        s->drivername           = i->drivername;
        s->comment              = i->comment;
        s->location             = i->location;
-       s->devmode_ptr          = NULL;
+       s->devmode_ptr          = 0;
        s->sepfile              = i->sepfile;
        s->printprocessor       = i->printprocessor;
        s->datatype             = i->datatype;
        s->parameters           = i->parameters;
-       s->secdesc_ptr          = NULL;
+       s->secdesc_ptr          = 0;
        s->attributes           = i->attributes;
        s->priority             = i->priority;
        s->defaultpriority      = i->defaultpriority;
@@ -433,3 +435,14 @@ WERROR spoolss_create_default_secdesc(TALLOC_CTX *mem_ctx,
 
        return WERR_OK;
 }
+
+const char *spoolss_get_short_filesys_environment(const char *environment)
+{
+       if (strequal(environment, SPOOLSS_ARCHITECTURE_x64)) {
+               return "amd64";
+       } else if (strequal(environment, SPOOLSS_ARCHITECTURE_NT_X86)) {
+               return "x86";
+       } else {
+               return NULL;
+       }
+}