s3-rpc_client: use spoolss_driver_version_to_qword in winreg_printer_ver_to_qword
authorGünther Deschner <gd@samba.org>
Fri, 23 Sep 2016 15:08:02 +0000 (17:08 +0200)
committerUri Simchoni <uri@samba.org>
Mon, 26 Sep 2016 22:09:18 +0000 (00:09 +0200)
Guenter

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
Autobuild-User(master): Uri Simchoni <uri@samba.org>
Autobuild-Date(master): Tue Sep 27 00:09:18 CEST 2016 on sn-devel-144

source3/rpc_client/cli_winreg_spoolss.c

index 2158229fca7419ebcc9fc05eba94fe74889c2fdd..90accd4185492fefff652fee5ec9e849b00465c9 100644 (file)
@@ -552,17 +552,13 @@ static WERROR winreg_printer_write_ver(TALLOC_CTX *mem_ctx,
 
 static WERROR winreg_printer_ver_to_qword(const char *str, uint64_t *data)
 {
-       unsigned int v1, v2, v3, v4;
+       bool ok;
 
-       if (sscanf(str, "%u.%u.%u.%u", &v1, &v2, &v3, &v4) != 4) {
+       ok = spoolss_driver_version_to_qword(str, data);
+       if (!ok) {
                return WERR_INVALID_PARAMETER;
        }
 
-       *data = ((uint64_t)(v1 & 0xFFFF) << 48) +
-               ((uint64_t)(v2 & 0xFFFF) << 32) +
-               ((uint64_t)(v3 & 0xFFFF) << 16) +
-               (uint64_t)(v4 & 0xFFFF);
-
        return WERR_OK;
 }