[PATCH 3/4] adsldp: Map "1.3.6.1.4.1.1466.115.121.1.24" to ADSTYPE_UTC_TIME.

Dmitry Timoshkov dmitry at baikal.ru
Tue Apr 7 05:14:03 CDT 2020


Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/adsldp/adsldp.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 dlls/adsldp/schema.c |  2 ++
 2 files changed, 46 insertions(+)

diff --git a/dlls/adsldp/adsldp.c b/dlls/adsldp/adsldp.c
index f2773262a6..8897545e4f 100644
--- a/dlls/adsldp/adsldp.c
+++ b/dlls/adsldp/adsldp.c
@@ -1528,6 +1528,50 @@ static HRESULT add_column_values(LDAP_namespace *ldap, struct ldap_search_contex
         col->hReserved = values;
         break;
     }
+
+    case ADSTYPE_UTC_TIME:
+    {
+        struct berval **values = ldap_get_values_lenW(ldap->ld, ldap_ctx->entry, name);
+        if (!values)
+            return E_ADS_COLUMN_NOT_SET;
+        count = ldap_count_values_len(values);
+
+        col->pADsValues = heap_alloc_zero(count * sizeof(col->pADsValues[0]));
+        if (!col->pADsValues)
+        {
+            ldap_value_free_len(values);
+            return E_OUTOFMEMORY;
+        }
+
+        for (i = 0; i < count; i++)
+        {
+            col->pADsValues[i].dwType = type;
+            if (values[i]->bv_len < 14 ||
+                _snscanf_l(values[i]->bv_val, values[i]->bv_len, "%04u%02u%02u%02u%02u%02u", NULL,
+                           &col->pADsValues[i].u.UTCTime.wYear, &col->pADsValues[i].u.UTCTime.wMonth,
+                           &col->pADsValues[i].u.UTCTime.wDay, &col->pADsValues[i].u.UTCTime.wHour,
+                           &col->pADsValues[i].u.UTCTime.wMinute, &col->pADsValues[i].u.UTCTime.wSecond) != 6)
+            {
+                FIXME("not recognized UTCTime: %s\n", debugstr_an(values[i]->bv_val, values[i]->bv_len));
+                memset(&col->pADsValues[i].u.UTCTime, 0, sizeof(col->pADsValues[i].u.UTCTime));
+                continue;
+            }
+
+            if ((values[i]->bv_val[14] != '.' && values[i]->bv_val[14] != ',') ||
+                values[i]->bv_val[15] != '0' || values[i]->bv_val[16] != 'Z')
+                    FIXME("not handled time zone: %s\n", debugstr_an(values[i]->bv_val + 14, values[i]->bv_len - 14));
+
+            TRACE("%s => %02u.%02u.%04u %02u:%02u:%02u\n", debugstr_an(values[i]->bv_val, values[i]->bv_len),
+                  col->pADsValues[i].u.UTCTime.wDay, col->pADsValues[i].u.UTCTime.wMonth,
+                  col->pADsValues[i].u.UTCTime.wYear, col->pADsValues[i].u.UTCTime.wHour,
+                  col->pADsValues[i].u.UTCTime.wMinute, col->pADsValues[i].u.UTCTime.wSecond);
+        }
+
+        ldap_value_free_len(values);
+        col->hReserved = NULL;
+        break;
+    }
+
     }
 
     col->dwADsType = type;
diff --git a/dlls/adsldp/schema.c b/dlls/adsldp/schema.c
index f0ecfc3ac6..6965dc3274 100644
--- a/dlls/adsldp/schema.c
+++ b/dlls/adsldp/schema.c
@@ -93,6 +93,8 @@ ADSTYPEENUM get_schema_type(const WCHAR *name, const struct attribute_type *at,
         return ADSTYPE_DN_STRING;
     if (!wcscmp(type->syntax, L"1.3.6.1.4.1.1466.115.121.1.15"))
         return ADSTYPE_CASE_IGNORE_STRING;
+    if (!wcscmp(type->syntax, L"1.3.6.1.4.1.1466.115.121.1.24"))
+        return ADSTYPE_UTC_TIME;
     if (!wcscmp(type->syntax, L"1.3.6.1.4.1.1466.115.121.1.27"))
         return ADSTYPE_INTEGER;
     if (!wcscmp(type->syntax, L"1.3.6.1.4.1.1466.115.121.1.38"))
-- 
2.25.2




More information about the wine-devel mailing list