- samctx = samdb_connect(mem_ctx);
- if (samctx == NULL) {
- DEBUG(2,("Unable to open sam in cldap netlogon reply\n"));
- return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ if (cldapd->samctx == NULL) {
+ cldapd->samctx = samdb_connect(mem_ctx);
+ if (cldapd->samctx == NULL) {
+ DEBUG(2,("Unable to open sam in cldap netlogon reply\n"));
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }