dart dartdap exception when parsing search result - active-directory

I'm using the dartdap library to connect to an LDAP server on Win 2008. The bind operation works fine. As soon as I perform any search I get an exception while the result is parsed by dartdap.
Exception while processing message. Exception RangeError: Value not in range (158)
The stack trace points here:
package:dartdap/src/connection/connection_manager.dart:297:21
Here is the code I use:
var filter = Filter.substring("CN=ma*");
var attrs = ["dn", "cn", "objectClass"];
LDAPConfiguration ldapConfig = new LDAPConfiguration("ldap.yaml","default");
LDAPConnection ldap;
ldapConfig.getConnection(false).then((LDAPConnection ldap){
ldap.bind(/*bindDN*/"CN=CP LDAP,OU=Contract Program,DC=mydomain,DC=de",/*password*/"xxxxx").then((_){
ldap.search("DC=mydomain,DC=de", filter, attrs).stream.forEach((item)=>print(item)).catchError((err) =>print(err));
}).catchError((err)=>print(err));
}).catchError((err)=>print(err));
For my project I need to authenticate users using data from an Active Directory. Any help would be appreciated.

Related

SignalR MSSQL scale

Have hard time to get push notifications from server when using MSSQL scalling.
Message flow is one way from server to subscribers (are distributed by groups)
Push messages are not received on UI with the following host configuration:
GlobalHost.DependencyResolver.UseSqlServer(new SqlScaleoutConfiguration(ConfigurationManager.ConnectionStrings["SignalR"].ConnectionString));
Messages are created in SignalRDb and records are present in tables. However they do not reach UI. With SQL scaling disabled all messages propagates to UI successfully.
Here is my Notification code:
public void OnNext(ResultModel value)
{
Clients.Group(group).notify(value);
}
OnNext method always executes witho or without Scalling also group and value are correct. No exceptions thrown on UI or beckend. Below is UI part:
var hubProxy = $.connection.visitsHub;
hubProxy.client.notify = function (updatedResult) {
console.log(updatedResult.Id);
});
};
Any help is appreciated.

Sterling database silverlight ArgumentOutOfRangeException

We are developing an out-of-browser application using sterling and we have the following scenario:
The app can be opened with a shortcut
If we open-edit files (with specific extension) the app opens up.
Problem is that instances opened in case 2 seems to have a different IsolatedStorage and data is not being shared, so we tried to do the following
var folder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\MyApp\\";
IsolatedStorageDriver driver = new IsolatedStorageDriver(folder,true);
driver.DatabaseName = "sterling";
Database = _engine.SterlingDatabase.RegisterDatabase<OurInternalDB>(driver);
This produces the following exception:
System.ArgumentOutOfRangeException was unhandled by user code
Message=Specified argument was out of the range of valid values.
Parameter name: basePath
StackTrace:
at Wintellect.Sterling.IsolatedStorage.PathProvider._ContractForBasePath(String basePath)
at Wintellect.Sterling.IsolatedStorage.PathProvider.GetKeysPath(String basePath, String databaseName, Type tableType, ISterlingDriver driver)
at Wintellect.Sterling.IsolatedStorage.IsolatedStorageDriver.DeserializeKeys(Type type, Type keyType, IDictionary dictionary)
at Wintellect.Sterling.Keys.KeyCollection2._DeserializeKeys()
at Wintellect.Sterling.Keys.KeyCollection2..ctor(ISterlingDriver driver, Func2 resolver)
at Wintellect.Sterling.Database.TableDefinition2..ctor(ISterlingDriver driver, Func2 resolver, Func2 key)
at Wintellect.Sterling.Database.BaseDatabaseInstance.CreateTableDefinition[T,TKey](Func`2 keyFunction)
at Waf.Dal.Sterling.Database.OURInternalDB.RegisterTables()
at Wintellect.Sterling.Database.BaseDatabaseInstance.PublishTables(ISterlingDriver driver)
at Wintellect.Sterling.Database.SterlingDatabase.RegisterDatabase[T](ISterlingDriver driver)
at Waf.Dal.SterlingService.Starting()
at Waf.Dal.Factory.Sterling.InitializeDatabase()
at Waf.Dal.AireaStorageHelper.InitializeDatabase()
at Waf.App.App..ctor()
InnerException:
Update: I tried to replace the folder value
var folder = (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\MyApp\\").Replace("\\","/");
And the exception goes away, but my original problem persists, it's like the 2 instances of the app are using different IsolatedStorages.
As I placed on the update, this fixed my problem with the isolated storage driver:
var folder = (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\MyApp\\").Replace("\\","/");
BUT, I learned that isolated storages are not shared between instances of the same application.
Hopes this is of use for someone

Error 503 Will Not Perform when Adding a Group Entry using UnboundID

I'm trying to add a Group to my Active Directory service using the UnboundID LDAP SDK, and keep getting error 503: Will Not Perform.
I have verified I'm using an SSL connection, and that I'm connecting with a user that belongs to the Administrators group, which -unless I'm mistaken - gives him the right to create new entries.
I have also raised the logging level of the LDAP Interface Events all the way to 5, and the event viewer registers a number of events, none of which are useful in explaining why the service is unwilling to perform my create entry operation.
Any ideas on what can be causing this problem?
Below is a sample of the scala code I'm using:
val connection = connect("MyAdminUser", "MyAdminPass")
val addGroupResult = connection.add("CN=TestGroup2,OU=Groups,OU=mydomain,DC=mydomain,DC=local",
new Attribute("objectClass", "top", "group"),
new Attribute("name","TestGroup2"),
new Attribute("sAMAccountName","TestGroup2"),
new Attribute("sAMAccountType","268435456"),
new Attribute("objectCategory","CN=Group,CN=Schema,CN=Configuration,DC=mydomain,DC=local"),
new Attribute("cn","TestGroup2"),
new Attribute("distinguishedName","CN=TestGroup2,OU=Groups,OU=mydomain,DC=mydomain,DC=local"),
new Attribute("instanceType","4"),
new Attribute("groupType","-2147483646")
)
private def connect(user: String, pass: String) = {
val options = new LDAPConnectionOptions()
options.setFollowReferrals(true)
val sslUtil = new SSLUtil(new TrustAllTrustManager())
val socketFactory = sslUtil.createSSLSocketFactory()
new LDAPConnection(socketFactory, options, host, securePort, DN(user), pass)
}
And here's the error message I'm getting:
Exception in thread "main" LDAPException(resultCode=53 (unwilling to perform), errorMessage='0000209A: SvcErr: DSID-031A104A, problem 5003 (WILL_NOT_PERFORM), data 0', diagnosticMessage='0000209A: SvcErr: DSID-031A104A, problem 5003 (WILL_NOT_PERFORM), data 0')
My error was including too many attributes in the Add operation, some of which are not supposed to be set manually but rather by the SAM (Security Account Manager).
The correct code is as follows:
val addGroupResult = connection.add("CN=TestGroup2,OU=Groups,OU=simpleBI,DC=domain,DC=local",
new Attribute("objectClass", "top", "group"),
new Attribute("name","TestGroup2"),
new Attribute("sAMAccountName","TestGroup2"),
new Attribute("objectCategory","CN=Group,CN=Schema,CN=Configuration,DC=domain,DC=local")
)
Note that I've removed a few attributes, including sAMAccountType, which were rejected by AD. I've also removed some redundant ones. I believe what I have is the minimal attribute set that fulfills my needs.
The connection code was unchanged.

Using SolrNet to query Solr from a console application?

I'm trying to use SolrNet in a command line application (or more accurately, from LINQPad) to test some queries, and when trying to initialize the library, I get the following error:
Key 'SolrNet.Impl.SolrConnection.UserQuery+Resource.SolrNet.Impl.SolrConnection' already registered in container
However, if I catch this error and continue, the ServiceLocator gives me the following error:
Activation error occured while trying to get instance of type ISolrOperations`1, key ""
With the inner exception:
The given key was not present in the dictionary.
My full code looks like this:
try
{
Startup.Init<Resource>("http://localhost:8080/solr/");
Console.WriteLine("Initialized\n");
}
catch (Exception ex)
{
Console.WriteLine("Already Initialized: " + ex.Message);
}
// This line causes the error if Solr is already initialized
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Resource>>();
// Do the search
var results = solr.Query(new SolrQuery("title:test"));
I'm running Tomcat 7 on Windows 7x64 with Solr 3.4.0 installed.
There's another message about the same problem on StackOverflow, though the accepted answer of putting the Startup.Init code in Global.asax is only relevant to ASP.NET.
Restarting the Tomcat7 service resolves the problem, but having to do this after every query is a pain.
What is the correct way to use the SolrNet library to interact with Solr from a C# console application?
The correct way to use SolrNet in a console application is to only execute the line
Startup.Init<Resource>("http://localhost:8080/solr/");
once for the life of your console application. I typically put it as the first line in my Main method as shown below...
static void Main(string[] args)
{
Startup.Init<Resource>("http://localhost:8080/solr/");
//Call method or do work to query from solr here...
//Using your code in a method...
QuerySolr();
}
private static void QuerySolr()
{
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Resource>>();
// Do the search
var results = solr.Query(new SolrQuery("title:test"));
}
Your error is coming from the fact that you are trying to initialize the SolrNet connection multiple times. You only need to initialize it once when the console application starts and then reference (look up) via the ServiceLocator when needed.
My Solution is clear Startup before Init
Startup.Container.Clear();
Startup.InitContainer();
Startup.Init<Resource>("http://localhost:8080/solr/");

Com Interop problem Silverlight 4 and MS Access 2010

I am trying to launch an existing MS Access database (Access 2010) from a Silverlight 4 OOB with elevated authorisation set. I keep getting an error. I can create a new Access application using the CreateObject keyword, but when I try to launch an existing one I get an error: "No object was found registered for specified ProgID."
Any help is appreciated. Here is the code I use:
string sMSAccess = "C:\\Users\\storltx\\Documents\\SL4Demo.accdb";
dynamic MSAccess = ComAutomationFactory.GetObject(sMSAccess);
MSAccess.Visible = true;
I think you should pass "Access.Application" string to GetObject call. like this:
dynamic MSAccess = ComAutomationFactory.GetObject("Access.Application");
Try your code like this:-
string sMSAccess = "C:\\Users\\storltx\\Documents\\SL4Demo.accdb";
dynamic app = ComAutomationFactory.CreateObject("Access.Application");
app .Visible = true;
app.OpenCurrentDatabase(sMSAccess);

Resources