The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,470 other followers

Archive for the ‘iSeries’ Category

Time for a golden oldie: Pragmatic Software Development Tips

Posted by jpluimers on 2013/05/09

From the century start era of The Pragmatic Bookshelf | The Pragmatic Programmer, a – still valid – list of Pragmatic Software Development Tips.

From Care About Your Craft, via DRY, Some Things Are Better Done than DescribedKeep Knowledge in Plain Text, Work With a User to Think Like a User, Find the Box, and many others till Sign Your Work.

–jeroen

via: The Pragmatic Bookshelf | List of Tips.

Posted in .NET, C++, Cloud Development, COBOL, CommandLine, Delphi, Development, Fortran, iSeries, Java, Pascal, RegEx, Scripting, Software Development, Web Development, xCode/Mac/iPad/iPhone/iOS/cocoa | 3 Comments »

Great session on how to prevent SQL Injection Myths and Fallacies

Posted by jpluimers on 2012/08/15

A few weeks ago, Bill Karwin did a must watch webinar on the prevention SQL Injection titled  “SQL Injection Myths and Fallacies“.

Bill Karwin (twitter, new blog, old blog, Amazon) is famous for much work in the SQL database community, including InterBase/Firebird, mySQL, Oracle and many more.

He also:

Anyway, his webinar is awesome. Be sure to get the slides, watch the replay, and read the questions follow up.

Watching it you’ll get a better understanding of defending against SQL injection.

A few very valuable points he made: Read the rest of this entry »

Posted in .NET, .NET 3.5, .NET 4.5, .NET ORM, ASP.NET, Batch-Files, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C++, Cloud Development, COBOL, CommandLine, Database Development, Delphi, Delphi for PHP, Delphi x64, Delphi XE2, Development, EF Entity Framework, F#, Firebird, FireMonkey, History, InterBase, iSeries, Java, JavaScript/ECMAScript, Jet OLE DB, LINQ, LLBLGen, MEF, Microsoft Surface, Mobile Development, PHP, PowerShell, Prism, Scripting, SharePoint, SilverLight, Software Development, SQL, SQL Server, SQL Server 2000, SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, SQL Server 7, VB.NET, VBS, Visual Studio 11, Visual Studio 2002, Visual Studio 2003, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools, Web Development, Windows Azure, WinForms, WPF, XAML, xCode/Mac/iPad/iPhone/iOS/cocoa | 1 Comment »

Impersonation on the iSeries: Changing Profile User

Posted by jpluimers on 2011/10/12

When running on Windows, changing the current user is called impersionation.

There are various ways to do this in Windows, including

On the iSeries, there is only one way, as everything goes through the same API: use QSYGETPH (Get Profile Handle) to verify a username/password combination and obtain a handle to the authentication token, then use QWTSETP (Set Profile Handle) to change the user currently signed on, as for instance mentioned by Colin Williams directing to the CHGCURUSR tool on FreeRpgTools.com and an article on Swapping AS/400 User Profiles by Shannon O’Donnel that comes with source code.

On the iSeries, when you are done, you should use QSYRLSPH (Release Profile Handle) when done impersonating, and you need to get the handle from the original user profile if you want to return to it.

The IBM documentation contains a small sample with QSYGETPH, QWTSETP and QSYSRLSPH that sets and restores the profile handle (edit 20120214: it got moved to http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fapis%2Fapiexushand.htm)

Note that on both Windows ans iSeries, impersonation within a process/thread will make it run in the new context, but the process still keeps the identity of the user that started the process.

If you want to change that, then on both you need to start a new process from the impersonated thread.

In Windows, you can combine the impersionation and the creation of a new process by using the CreateProcessWithLogonW function (as mentioned at the Old New Thing by Raymond Chan). I’ve yet to find an equivalent on the iSeries.

–jeroen

Posted in .NET, C#, Delphi, Development, iSeries, Software Development | Leave a Comment »

 
%d bloggers like this: